Projectname large_stringclasses 15
values | Filepath large_stringlengths 4 106 ⌀ | Function large_stringlengths 11 3.45k | Label list |
|---|---|---|---|
Linux Kernel | security/apparmor/label.c |
void aa_label_seq_print(struct seq_file *f, struct aa_label *label, gfp_t gfp) {
struct aa_ns *ns = aa_get_current_ns();
aa_label_seq_xprint(f, ns, label, FLAG_VIEW_SUBNS, gfp);
aa_put_ns(ns);
} | [
0,
0
] |
Linux Kernel | security/apparmor/label.c | static struct aa_profile *fqlookupn_profile(struct aa_label *base,
struct aa_label *currentbase,
const char *str, size_t n) {
const char *first = skipn_spaces(str, n);
if (first && *first == ':')
return aa_fqlookupn_profile... | [
1,
0
] |
Linux Kernel | security/apparmor/label.c | static struct aa_label *__label_update(struct aa_label *label) {
struct aa_label *new, *tmp;
struct aa_labelset *ls;
unsigned long flags;
int i, invcount = 0;
AA_BUG(!label);
AA_BUG(!mutex_is_locked(&labels_ns(label)->lock));
new = aa_label_alloc(label->size, label->proxy, GFP_KERNEL);
if (!new)
r... | [
1,
1
] |
Linux Kernel | security/apparmor/lib.c | const char *aa_splitn_fqname(const char *fqname, size_t n, const char **ns_name,
size_t *ns_len) {
const char *end = fqname + n;
const char *name = skipn_spaces(fqname, n);
*ns_name = NULL;
*ns_len = 0;
if (!name)
return NULL;
if (name[0] == ':') {
char *split = strnc... | [
1,
0
] |
Linux Kernel | security/apparmor/lib.c | void aa_perm_mask_to_str(char *str, size_t str_size, const char *chrs,
u32 mask) {
unsigned int i, perm = 1;
size_t num_chrs = strlen(chrs);
for (i = 0; i < num_chrs; perm <<= 1, i++) {
if (mask & perm) {
if (WARN_ON_ONCE(str_size <= 1))
break;
*str++ = chrs[i];... | [
1,
0
] |
Linux Kernel | security/apparmor/lib.c | void aa_apply_modes_to_perms(struct aa_profile *profile,
struct aa_perms *perms) {
switch (AUDIT_MODE(profile)) {
case AUDIT_ALL:
perms->audit = ALL_PERMS_MASK;
fallthrough;
case AUDIT_NOQUIET:
perms->quiet = 0;
break;
case AUDIT_QUIET:
perms->audit = 0;
fall... | [
1,
1
] |
Linux Kernel | security/apparmor/lib.c |
static u32 map_xbits(u32 x) { return ((x & 0x1) << 7) | ((x & 0x7e) << 9); } | [
1,
0
] |
Linux Kernel | security/apparmor/lib.c | void aa_perms_accum(struct aa_perms *accum, struct aa_perms *addend) {
accum->deny |= addend->deny;
accum->allow &= addend->allow & ~accum->deny;
accum->audit |= addend->audit & accum->allow;
accum->quiet &= addend->quiet & ~accum->allow;
accum->kill |= addend->kill & ~accum->allow;
accum->stop |= addend->s... | [
0,
0
] |
Linux Kernel | security/apparmor/lib.c | int aa_profile_label_perm(struct aa_profile *profile, struct aa_profile *target,
u32 request, int type, u32 *deny,
struct common_audit_data *sa) {
struct aa_perms perms;
aad(sa)->label = &profile->label;
aad(sa)->peer = &target->label;
aad(sa)->request = requ... | [
1,
0
] |
Linux Kernel | security/apparmor/lib.c | void aa_policy_destroy(struct aa_policy *policy) {
AA_BUG(on_list_rcu(&policy->profiles));
AA_BUG(on_list_rcu(&policy->list));
aa_put_str(policy->hname);
} | [
0,
0
] |
Linux Kernel | security/apparmor/lsm.c | static void apparmor_cred_free(struct cred *cred) {
aa_put_label(cred_label(cred));
set_cred_label(cred, NULL);
} | [
0,
0
] |
Linux Kernel | security/apparmor/lsm.c | static int apparmor_capget(struct task_struct *target, kernel_cap_t *effective,
kernel_cap_t *inheritable, kernel_cap_t *permitted) {
struct aa_label *label;
const struct cred *cred;
rcu_read_lock();
cred = __task_cred(target);
label = aa_get_newest_cred_label(cred);
if (!unconf... | [
0,
0
] |
Linux Kernel | security/apparmor/lsm.c |
static int apparmor_path_mknod(const struct path *dir, struct dentry *dentry,
umode_t mode, unsigned int dev) {
return common_perm_create(OP_MKNOD, dir, dentry, AA_MAY_CREATE, mode);
} | [
0,
0
] |
Linux Kernel | security/apparmor/lsm.c |
static int apparmor_path_truncate(const struct path *path) {
return common_perm_cond(OP_TRUNC, path, MAY_WRITE | AA_MAY_SETATTR);
} | [
0,
0
] |
Linux Kernel | security/apparmor/lsm.c |
static int apparmor_path_symlink(const struct path *dir, struct dentry *dentry,
const char *old_name) {
return common_perm_create(OP_SYMLINK, dir, dentry, AA_MAY_CREATE, S_IFLNK);
} | [
0,
0
] |
Linux Kernel | security/apparmor/lsm.c | static int common_file_perm(const char *op, struct file *file, u32 mask,
bool in_atomic) {
struct aa_label *label;
int error = 0;
if (file->f_path.dentry == aa_null.dentry)
return -EACCES;
label = __begin_current_label_crit_section();
error = aa_file_perm(op, label, file, mas... | [
0,
0
] |
Linux Kernel | security/apparmor/lsm.c | static int apparmor_getprocattr(struct task_struct *task, const char *name,
char **value) {
int error = -ENOENT;
const struct cred *cred = get_task_cred(task);
struct aa_task_ctx *ctx = task_ctx(current);
struct aa_label *label = NULL;
if (strcmp(name, "current") == 0)
la... | [
0,
0
] |
Linux Kernel | security/apparmor/lsm.c | static void apparmor_bprm_committing_creds(struct linux_binprm *bprm) {
struct aa_label *label = aa_current_raw_label();
struct aa_label *new_label = cred_label(bprm->cred);
/* bail out if unconfined or not changing profile */
if ((new_label->proxy == label->proxy) || (unconfined(new_label)))
return;
aa... | [
0,
0
] |
Linux Kernel | security/apparmor/lsm.c | static void apparmor_sk_clone_security(const struct sock *sk,
struct sock *newsk) {
struct aa_sk_ctx *ctx = SK_CTX(sk);
struct aa_sk_ctx *new = SK_CTX(newsk);
if (new->label)
aa_put_label(new->label);
new->label = aa_get_label(ctx->label);
if (new->peer)
aa_put... | [
0,
0
] |
Linux Kernel | security/apparmor/lsm.c | static int apparmor_socket_post_create(struct socket *sock, int family,
int type, int protocol, int kern) {
struct aa_label *label;
if (kern) {
label = aa_get_label(kernel_t);
} else
label = aa_get_current_label();
if (sock->sk) {
struct aa_sk_ctx *ctx = SK_C... | [
0,
0
] |
Linux Kernel | security/apparmor/lsm.c | static int apparmor_socket_getsockname(struct socket *sock) {
return aa_sock_perm(OP_GETSOCKNAME, AA_MAY_GETATTR, sock);
} | [
0,
0
] |
Linux Kernel | security/apparmor/lsm.c | static int apparmor_socket_shutdown(struct socket *sock, int how) {
return aa_sock_perm(OP_SHUTDOWN, AA_MAY_SHUTDOWN, sock);
} | [
0,
0
] |
Linux Kernel | security/apparmor/lsm.c |
static struct aa_label *sk_peer_label(struct sock *sk) {
struct aa_sk_ctx *ctx = SK_CTX(sk);
if (ctx->peer)
return ctx->peer;
return ERR_PTR(-ENOPROTOOPT);
} | [
0,
0
] |
Linux Kernel | security/apparmor/lsm.c | static int apparmor_socket_getpeersec_stream(struct socket *sock,
sockptr_t optval, sockptr_t optlen,
unsigned int len) {
char *name = NULL;
int slen, error = 0;
struct aa_label *label;
struct aa_label *peer;
label = be... | [
1,
0
] |
Linux Kernel | security/apparmor/lsm.c | /**
* apparmor_socket_getpeersec_dgram - get security label of packet
* @sock: the peer socket
* @skb: packet data
* @secid: pointer to where to put the secid of the packet
*
* Sets the netlabel socket state on sk from parent
*/
static int apparmor_socket_getpeersec_dgram(struct socket *sock,
... | [
0,
1
] |
Linux Kernel | security/apparmor/lsm.c | static int param_set_aalockpolicy(const char *val,
const struct kernel_param *kp) {
if (!apparmor_enabled)
return -EINVAL;
if (apparmor_initialized && !aa_current_policy_admin_capable(NULL))
return -EPERM;
return param_set_bool(val, kp);
} | [
0,
0
] |
Linux Kernel | security/apparmor/lsm.c | static int param_set_aauint(const char *val, const struct kernel_param *kp) {
int error;
if (!apparmor_enabled)
return -EINVAL;
if (apparmor_initialized)
return -EPERM;
error = param_set_uint(val, kp);
aa_g_path_max = max_t(uint32_t, aa_g_path_max, sizeof(union aa_buffer));
pr_info("AppArmor: buf... | [
1,
0
] |
Linux Kernel | security/apparmor/lsm.c | static int param_set_aaintbool(const char *val, const struct kernel_param *kp) {
struct kernel_param kp_local;
bool value;
int error;
if (apparmor_initialized)
return -EPERM;
value = !!*((int *)kp->arg);
memcpy(&kp_local, kp, sizeof(kp_local));
kp_local.arg = &value;
error = param_set_bool(val, &... | [
1,
0
] |
Linux Kernel | security/apparmor/lsm.c | static int param_get_aaintbool(char *buffer, const struct kernel_param *kp) {
struct kernel_param kp_local;
bool value;
value = !!*((int *)kp->arg);
memcpy(&kp_local, kp, sizeof(kp_local));
kp_local.arg = &value;
return param_get_bool(buffer, &kp_local);
} | [
1,
0
] |
Linux Kernel | security/apparmor/lsm.c |
static int param_set_aacompressionlevel(const char *val,
const struct kernel_param *kp) {
int error;
if (!apparmor_enabled)
return -EINVAL;
if (apparmor_initialized)
return -EPERM;
error = param_set_int(val, kp);
aa_g_rawdata_compression_level = clamp(aa_g_r... | [
0,
0
] |
Linux Kernel | security/apparmor/lsm.c |
static int param_set_audit(const char *val, const struct kernel_param *kp) {
int i;
if (!apparmor_enabled)
return -EINVAL;
if (!val)
return -EINVAL;
if (apparmor_initialized && !aa_current_policy_admin_capable(NULL))
return -EPERM;
i = match_string(audit_mode_names, AUDIT_MAX_INDEX, val);
if ... | [
0,
0
] |
Linux Kernel | security/apparmor/lsm.c |
static int param_get_mode(char *buffer, const struct kernel_param *kp) {
if (!apparmor_enabled)
return -EINVAL;
if (apparmor_initialized && !aa_current_policy_view_capable(NULL))
return -EPERM;
return sprintf(buffer, "%s", aa_profile_mode_names[aa_g_profile_mode]);
} | [
1,
0
] |
Linux Kernel | security/apparmor/lsm.c | static int apparmor_dointvec(struct ctl_table *table, int write, void *buffer,
size_t *lenp, loff_t *ppos) {
if (!aa_current_policy_admin_capable(NULL))
return -EPERM;
if (!apparmor_enabled)
return -EINVAL;
return proc_dointvec(table, write, buffer, lenp, ppos);
} | [
0,
0
] |
Linux Kernel | security/apparmor/lsm.c |
static int __init apparmor_init_sysctl(void) {
return register_sysctl_paths(apparmor_sysctl_path, apparmor_sysctl_table)
? 0
: -ENOMEM;
}
#else | [
0,
0
] |
Linux Kernel | security/apparmor/lsm.c | static inline int apparmor_init_sysctl(void) { return 0; }
#endif
#if defined(CONFIG_NETFILTER) && defined(CONFIG_NETWORK_SECMARK) | [
0,
0
] |
Linux Kernel | security/apparmor/lsm.c |
static void __net_exit apparmor_nf_unregister(struct net *net) {
nf_unregister_net_hooks(net, apparmor_nf_ops, ARRAY_SIZE(apparmor_nf_ops));
} | [
0,
0
] |
Linux Kernel | security/apparmor/match.c |
int aa_setup_dfa_engine(void) {
int error;
nulldfa = aa_dfa_unpack(nulldfa_src, sizeof(nulldfa_src),
TO_ACCEPT1_FLAG(YYTD_DATA32) |
TO_ACCEPT2_FLAG(YYTD_DATA32));
if (IS_ERR(nulldfa)) {
error = PTR_ERR(nulldfa);
nulldfa = NULL;
return error;
... | [
1,
0
] |
Linux Kernel | security/apparmor/match.c |
void aa_teardown_dfa_engine(void) {
aa_put_dfa(stacksplitdfa);
aa_put_dfa(nulldfa);
} | [
0,
0
] |
Linux Kernel | security/apparmor/match.c | unsigned int aa_dfa_match(struct aa_dfa *dfa, unsigned int start,
const char *str) {
u16 *def = DEFAULT_TABLE(dfa);
u32 *base = BASE_TABLE(dfa);
u16 *next = NEXT_TABLE(dfa);
u16 *check = CHECK_TABLE(dfa);
unsigned int state = start;
if (state == 0)
return 0;
if (dfa->tables... | [
1,
0
] |
Linux Kernel | security/apparmor/match.c | unsigned int aa_dfa_match_until(struct aa_dfa *dfa, unsigned int start,
const char *str, const char **retpos) {
u16 *def = DEFAULT_TABLE(dfa);
u32 *base = BASE_TABLE(dfa);
u16 *next = NEXT_TABLE(dfa);
u16 *check = CHECK_TABLE(dfa);
u32 *accept = ACCEPT_TABLE(dfa);
unsigned in... | [
1,
0
] |
Linux Kernel | security/apparmor/match.c | static bool is_loop(struct match_workbuf *wb, unsigned int state,
unsigned int *adjust) {
unsigned int pos = wb->pos;
unsigned int i;
if (wb->history[pos] < state)
return false;
for (i = 0; i <= wb->len; i++) {
if (wb->history[pos] == state) {
*adjust = i;
return true;
... | [
1,
0
] |
Linux Kernel | security/apparmor/mount.c | static void audit_cb(struct audit_buffer *ab, void *va) {
struct common_audit_data *sa = va;
if (aad(sa)->mnt.type) {
audit_log_format(ab, " fstype=");
audit_log_untrustedstring(ab, aad(sa)->mnt.type);
}
if (aad(sa)->mnt.src_name) {
audit_log_format(ab, " srcname=");
audit_log_untrustedstring(a... | [
0,
0
] |
Linux Kernel | security/apparmor/mount.c | static unsigned int match_mnt_flags(struct aa_dfa *dfa, unsigned int state,
unsigned long flags) {
unsigned int i;
for (i = 0; i <= 31; ++i) {
if ((1 << i) & flags)
state = aa_dfa_next(dfa, state, i + 1);
}
return state;
} | [
0,
0
] |
Linux Kernel | security/apparmor/mount.c | static struct aa_perms compute_mnt_perms(struct aa_dfa *dfa,
unsigned int state) {
struct aa_perms perms = {
.allow = dfa_user_allow(dfa, state),
.audit = dfa_user_audit(dfa, state),
.quiet = dfa_user_quiet(dfa, state),
};
return perms;
} | [
0,
0
] |
Linux Kernel | security/apparmor/mount.c | static int do_match_mnt(struct aa_dfa *dfa, unsigned int start,
const char *mntpnt, const char *devname,
const char *type, unsigned long flags, void *data,
bool binary, struct aa_perms *perms) {
unsigned int state;
AA_BUG(!dfa);
AA_BUG(!perm... | [
1,
0
] |
Linux Kernel | security/apparmor/mount.c |
static int path_flags(struct aa_profile *profile, const struct path *path) {
AA_BUG(!profile);
AA_BUG(!path);
return profile->path_flags |
(S_ISDIR(path->dentry->d_inode->i_mode) ? PATH_IS_DIR : 0);
} | [
0,
0
] |
Linux Kernel | security/apparmor/mount.c |
int aa_bind_mount(struct aa_label *label, const struct path *path,
const char *dev_name, unsigned long flags) {
struct aa_profile *profile;
char *buffer = NULL, *old_buffer = NULL;
struct path old_path;
int error;
AA_BUG(!label);
AA_BUG(!path);
if (!dev_name || !*dev_name)
return ... | [
0,
0
] |
Linux Kernel | security/apparmor/mount.c | static struct aa_label *build_pivotroot(struct aa_profile *profile,
const struct path *new_path,
char *new_buffer,
const struct path *old_path,
char *old_buffer... | [
0,
0
] |
Linux Kernel | security/apparmor/mount.c | int aa_pivotroot(struct aa_label *label, const struct path *old_path,
const struct path *new_path) {
struct aa_profile *profile;
struct aa_label *target = NULL;
char *old_buffer = NULL, *new_buffer = NULL, *info = NULL;
int error;
AA_BUG(!label);
AA_BUG(!old_path);
AA_BUG(!new_path);
... | [
0,
1
] |
Linux Kernel | security/apparmor/net.c | int aa_profile_af_perm(struct aa_profile *profile, struct common_audit_data *sa,
u32 request, u16 family, int type) {
struct aa_perms perms = {};
unsigned int state;
__be16 buffer[2];
AA_BUG(family >= AF_MAX);
AA_BUG(type < 0 || type >= SOCK_MAX);
if (profile_unconfined(profile))
... | [
1,
0
] |
Linux Kernel | security/apparmor/net.c | int aa_sk_perm(const char *op, u32 request, struct sock *sk) {
struct aa_label *label;
int error;
AA_BUG(!sk);
AA_BUG(in_interrupt());
/* TODO: switch to begin_current_label ???? */
label = begin_current_label_crit_section();
error = aa_label_sk_perm(label, op, request, sk);
end_current_label_crit_sec... | [
0,
1
] |
Linux Kernel | security/apparmor/path.c | static int prepend(char **buffer, int buflen, const char *str, int namelen) {
buflen -= namelen;
if (buflen < 0)
return -ENAMETOOLONG;
*buffer -= namelen;
memcpy(*buffer, str, namelen);
return 0;
} | [
1,
0
] |
Linux Kernel | security/apparmor/path.c | int aa_path_name(const struct path *path, int flags, char *buffer,
const char **name, const char **info,
const char *disconnected) {
char *str = NULL;
int error = d_namespace_path(path, buffer, &str, flags, disconnected);
if (info && error) {
if (error == -ENOENT)
*inf... | [
0,
0
] |
Linux Kernel | security/apparmor/policy.c | void aa_free_profile(struct aa_profile *profile) {
struct rhashtable *rht;
int i;
AA_DEBUG("%s(%p)\n", __func__, profile);
if (!profile)
return;
aa_policy_destroy(&profile->base);
aa_put_profile(rcu_access_pointer(profile->parent));
aa_put_ns(profile->ns);
kfree_sensitive(profile->rename);
aa... | [
0,
0
] |
Linux Kernel | security/apparmor/policy.c | static struct aa_policy *__lookup_parent(struct aa_ns *ns, const char *hname) {
struct aa_policy *policy;
struct aa_profile *profile = NULL;
char *split;
policy = &ns->base;
for (split = strstr(hname, "
profile = __strn_find_child(&policy->profiles, hname,
split - hname);
if (!profile)
... | [
1,
0
] |
Linux Kernel | security/apparmor/policy.c |
static struct aa_profile *__lookup_profile(struct aa_policy *base,
const char *hname) {
return __lookupn_profile(base, hname, strlen(hname));
} | [
0,
0
] |
Linux Kernel | security/apparmor/policy.c | struct aa_profile *aa_fqlookupn_profile(struct aa_label *base,
const char *fqname, size_t n) {
struct aa_profile *profile;
struct aa_ns *ns;
const char *name, *ns_name;
size_t ns_len;
name = aa_splitn_fqname(fqname, n, &ns_name, &ns_len);
if (ns_name) {
ns = aa_l... | [
0,
0
] |
Linux Kernel | security/apparmor/policy.c | struct aa_profile *aa_new_null_profile(struct aa_profile *parent, bool hat,
const char *base, gfp_t gfp) {
struct aa_profile *p, *profile;
const char *bname;
char *name = NULL;
AA_BUG(!parent);
if (base) {
name = kmalloc(strlen(parent->base.hname) + 8 + strlen(base... | [
1,
0
] |
Linux Kernel | security/apparmor/policy.c | static int replacement_allowed(struct aa_profile *profile, int noreplace,
const char **info) {
if (profile) {
if (profile->label.flags & FLAG_IMMUTIBLE) {
*info = "cannot replace immutable profile";
return -EPERM;
} else if (noreplace) {
*info = "profile alread... | [
0,
0
] |
Linux Kernel | security/apparmor/policy.c | static void audit_cb(struct audit_buffer *ab, void *va) {
struct common_audit_data *sa = va;
if (aad(sa)->iface.ns) {
audit_log_format(ab, " ns=");
audit_log_untrustedstring(ab, aad(sa)->iface.ns);
}
} | [
0,
0
] |
Linux Kernel | security/apparmor/policy.c |
bool aa_current_policy_view_capable(struct aa_ns *ns) {
struct aa_label *label;
bool res;
label = __begin_current_label_crit_section();
res = aa_policy_view_capable(label, ns);
__end_current_label_crit_section(label);
return res;
} | [
0,
0
] |
Linux Kernel | security/apparmor/policy.c | int aa_may_manage_policy(struct aa_label *label, struct aa_ns *ns, u32 mask) {
const char *op;
if (mask & AA_MAY_REMOVE_POLICY)
op = OP_PROF_RM;
else if (mask & AA_MAY_REPLACE_POLICY)
op = OP_PROF_REPL;
else
op = OP_PROF_LOAD;
if (aa_g_lock_policy)
return audit_policy(label, op, NULL, NULL, ... | [
0,
1
] |
Linux Kernel | security/apparmor/policy.c | static struct aa_profile *__list_lookup_parent(struct list_head *lh,
struct aa_profile *profile) {
const char *base = basename(profile->base.hname);
long len = base - profile->base.hname;
struct aa_load_ent *ent;
if (len <= 2)
return NULL;
len -= 2;
list_... | [
1,
0
] |
Linux Kernel | security/apparmor/policy.c | static int __lookup_replace(struct aa_ns *ns, const char *hname, bool noreplace,
struct aa_profile **p, const char **info) {
*p = aa_get_profile(__lookup_profile(&ns->base, hname));
if (*p) {
int error = replacement_allowed(*p, noreplace, info);
if (error) {
*info = "profil... | [
0,
0
] |
Linux Kernel | security/apparmor/policy_ns.c | bool aa_ns_visible(struct aa_ns *curr, struct aa_ns *view, bool subns) {
if (curr == view)
return true;
if (!subns)
return false;
for (; view; view = view->parent) {
if (view->parent == curr)
return true;
}
return false;
} | [
0,
0
] |
Linux Kernel | security/apparmor/policy_ns.c | struct aa_ns *aa_findn_ns(struct aa_ns *root, const char *name, size_t n) {
struct aa_ns *ns = NULL;
rcu_read_lock();
ns = aa_get_ns(__aa_findn_ns(&root->sub_ns, name, n));
rcu_read_unlock();
return ns;
} | [
0,
0
] |
Linux Kernel | security/apparmor/policy_ns.c | struct aa_ns *__aa_lookupn_ns(struct aa_ns *view, const char *hname, size_t n) {
struct aa_ns *ns = view;
const char *split;
for (split = strnstr(hname, "
split = strnstr(hname, "//", n)) {
ns = __aa_findn_ns(&ns->sub_ns, hname, split - hname);
if (!ns)
return NULL;
n -= split + 2 ... | [
1,
0
] |
Linux Kernel | security/apparmor/policy_unpack.c | static void audit_cb(struct audit_buffer *ab, void *va) {
struct common_audit_data *sa = va;
if (aad(sa)->iface.ns) {
audit_log_format(ab, " ns=");
audit_log_untrustedstring(ab, aad(sa)->iface.ns);
}
if (aad(sa)->name) {
audit_log_format(ab, " name=");
audit_log_untrustedstring(ab, aad(sa)->nam... | [
0,
0
] |
Linux Kernel | security/apparmor/policy_unpack.c | static void do_loaddata_free(struct work_struct *work) {
struct aa_loaddata *d = container_of(work, struct aa_loaddata, work);
struct aa_ns *ns = aa_get_ns(d->ns);
if (ns) {
mutex_lock_nested(&ns->lock, ns->level);
__aa_fs_remove_rawdata(d);
mutex_unlock(&ns->lock);
aa_put_ns(ns);
}
kfree_se... | [
0,
0
] |
Linux Kernel | security/apparmor/policy_unpack.c | VISIBLE_IF_KUNIT bool aa_inbounds(struct aa_ext *e, size_t size) {
return (size <= e->end - e->pos);
} | [
0,
0
] |
Linux Kernel | security/apparmor/policy_unpack.c | VISIBLE_IF_KUNIT bool aa_unpack_X(struct aa_ext *e, enum aa_code code) {
if (!aa_inbounds(e, 1))
return false;
if (*(u8 *)e->pos != code)
return false;
e->pos++;
return true;
} | [
0,
0
] |
Linux Kernel | security/apparmor/policy_unpack.c |
VISIBLE_IF_KUNIT bool aa_unpack_u64(struct aa_ext *e, u64 *data,
const char *name) {
void *pos = e->pos;
if (aa_unpack_nameX(e, AA_U64, name)) {
if (!aa_inbounds(e, sizeof(u64)))
goto fail;
if (data)
*data = le64_to_cpu(get_unaligned((__le64 *)e->pos));
... | [
1,
0
] |
Linux Kernel | security/apparmor/policy_unpack.c |
VISIBLE_IF_KUNIT size_t aa_unpack_array(struct aa_ext *e, const char *name) {
void *pos = e->pos;
if (aa_unpack_nameX(e, AA_ARRAY, name)) {
int size;
if (!aa_inbounds(e, sizeof(u16)))
goto fail;
size = (int)le16_to_cpu(get_unaligned((__le16 *)e->pos));
e->pos += sizeof(u16);
return size;... | [
1,
0
] |
Linux Kernel | security/apparmor/policy_unpack.c | static bool unpack_trans_table(struct aa_ext *e, struct aa_profile *profile) {
void *saved_pos = e->pos;
if (aa_unpack_nameX(e, AA_STRUCT, "xtable")) {
int i, size;
size = aa_unpack_array(e, NULL);
/* currently 4 exec bits and entries 0-3 are reserved iupcx */
if (size > 16 - 4)
goto fail;
... | [
1,
0
] |
Linux Kernel | security/apparmor/policy_unpack.c | static bool unpack_rlimits(struct aa_ext *e, struct aa_profile *profile) {
void *pos = e->pos;
if (aa_unpack_nameX(e, AA_STRUCT, "rlimits")) {
int i, size;
u32 tmp = 0;
if (!aa_unpack_u32(e, &tmp, NULL))
goto fail;
profile->rlimits.mask = tmp;
size = aa_unpack_array(e, NULL);
if (siz... | [
0,
0
] |
Linux Kernel | security/apparmor/policy_unpack.c |
static int datacmp(struct rhashtable_compare_arg *arg, const void *obj) {
const struct aa_data *data = obj;
const char *const *key = arg->key;
return strcmp(data->key, *key);
} | [
0,
0
] |
Linux Kernel | security/apparmor/policy_unpack.c | static bool verify_dfa_xindex(struct aa_dfa *dfa, int table_size) {
int i;
for (i = 0; i < dfa->tables[YYTD_ID_ACCEPT]->td_lolen; i++) {
if (!verify_xindex(dfa_user_xindex(dfa, i), table_size))
return false;
if (!verify_xindex(dfa_other_xindex(dfa, i), table_size))
return false;
}
return tru... | [
1,
0
] |
Linux Kernel | security/apparmor/policy_unpack.c | static int verify_profile(struct aa_profile *profile) {
if (profile->file.dfa &&
!verify_dfa_xindex(profile->file.dfa, profile->file.trans.size)) {
audit_iface(profile, NULL, NULL, "Invalid named transition", NULL, -EPROTO);
return -EPROTO;
}
return 0;
} | [
0,
0
] |
Linux Kernel | security/apparmor/policy_unpack.c |
struct aa_load_ent *aa_load_ent_alloc(void) {
struct aa_load_ent *ent = kzalloc(sizeof(*ent), GFP_KERNEL);
if (ent)
INIT_LIST_HEAD(&ent->list);
return ent;
} | [
0,
0
] |
Linux Kernel | security/apparmor/policy_unpack.c | static int deflate_compress(const char *src, size_t slen, char **dst,
size_t *dlen) {
#ifdef CONFIG_SECURITY_APPARMOR_EXPORT_BINARY
int error;
struct z_stream_s strm;
void *stgbuf, *dstbuf;
size_t stglen = deflateBound(slen);
memset(&strm, 0, sizeof(strm));
if (stglen < slen)
... | [
1,
0
] |
Linux Kernel | security/apparmor/policy_unpack_test.c |
static void
policy_unpack_test_unpack_strdup_with_null_name(struct kunit *test) {
struct policy_unpack_fixture *puf = test->priv;
char *string = NULL;
size_t size;
puf->e->pos += TEST_STRING_BUF_OFFSET;
size = aa_unpack_strdup(puf->e, &string, NULL);
KUNIT_EXPECT_EQ(test, size, strlen(TEST_STRING_DATA) +... | [
1,
0
] |
Linux Kernel | security/apparmor/policy_unpack_test.c |
static void policy_unpack_test_unpack_strdup_with_name(struct kunit *test) {
struct policy_unpack_fixture *puf = test->priv;
char *string = NULL;
size_t size;
size = aa_unpack_strdup(puf->e, &string, TEST_STRING_NAME);
KUNIT_EXPECT_EQ(test, size, strlen(TEST_STRING_DATA) + 1);
KUNIT_EXPECT_FALSE(test, ((... | [
1,
0
] |
Linux Kernel | security/apparmor/policy_unpack_test.c |
static void policy_unpack_test_unpack_strdup_out_of_bounds(struct kunit *test) {
struct policy_unpack_fixture *puf = test->priv;
void *start = puf->e->pos;
char *string = NULL;
int size;
puf->e->end =
puf->e->pos + TEST_STRING_BUF_OFFSET + strlen(TEST_STRING_DATA) - 1;
size = aa_unpack_strdup(puf->... | [
1,
0
] |
Linux Kernel | security/apparmor/policy_unpack_test.c |
static void policy_unpack_test_unpack_nameX_with_null_name(struct kunit *test) {
struct policy_unpack_fixture *puf = test->priv;
bool success;
puf->e->pos += TEST_U32_BUF_OFFSET;
success = aa_unpack_nameX(puf->e, AA_U32, NULL);
KUNIT_EXPECT_TRUE(test, success);
KUNIT_EXPECT_PTR_EQ(test, puf->e->pos,
... | [
1,
0
] |
Linux Kernel | security/apparmor/policy_unpack_test.c | static void policy_unpack_test_unpack_u16_chunk_basic(struct kunit *test) {
struct policy_unpack_fixture *puf = test->priv;
char *chunk = NULL;
size_t size;
puf->e->pos += TEST_U16_OFFSET;
puf->e->end += TEST_U16_DATA;
size = aa_unpack_u16_chunk(puf->e, &chunk);
KUNIT_EXPECT_PTR_EQ(test, chunk, puf->e... | [
1,
0
] |
Linux Kernel | security/apparmor/policy_unpack_test.c |
static void
policy_unpack_test_unpack_u16_chunk_out_of_bounds_1(struct kunit *test) {
struct policy_unpack_fixture *puf = test->priv;
char *chunk = NULL;
size_t size;
puf->e->pos = puf->e->end - 1;
size = aa_unpack_u16_chunk(puf->e, &chunk);
KUNIT_EXPECT_EQ(test, size, 0);
KUNIT_EXPECT_NULL(test, chun... | [
1,
0
] |
Linux Kernel | security/apparmor/policy_unpack_test.c | static void
policy_unpack_test_unpack_u16_chunk_out_of_bounds_2(struct kunit *test) {
struct policy_unpack_fixture *puf = test->priv;
char *chunk = NULL;
size_t size;
puf->e->pos += TEST_U16_OFFSET;
puf->e->end = puf->e->pos + TEST_U16_DATA - 1;
size = aa_unpack_u16_chunk(puf->e, &chunk);
KUNIT_EXPECT... | [
1,
0
] |
Linux Kernel | security/apparmor/policy_unpack_test.c |
static void policy_unpack_test_unpack_u32_with_name(struct kunit *test) {
struct policy_unpack_fixture *puf = test->priv;
const char name[] = TEST_U32_NAME;
bool success;
u32 data = 0;
puf->e->pos += TEST_NAMED_U32_BUF_OFFSET;
success = aa_unpack_u32(puf->e, &data, name);
KUNIT_EXPECT_TRUE(test, succe... | [
1,
0
] |
Linux Kernel | security/apparmor/policy_unpack_test.c |
static void policy_unpack_test_unpack_u32_out_of_bounds(struct kunit *test) {
struct policy_unpack_fixture *puf = test->priv;
const char name[] = TEST_U32_NAME;
bool success;
u32 data = 0;
puf->e->pos += TEST_NAMED_U32_BUF_OFFSET;
puf->e->end = puf->e->start + TEST_U32_BUF_OFFSET + sizeof(u32);
success... | [
1,
0
] |
Linux Kernel | security/apparmor/policy_unpack_test.c |
static void policy_unpack_test_unpack_u64_with_null_name(struct kunit *test) {
struct policy_unpack_fixture *puf = test->priv;
bool success;
u64 data = 0;
puf->e->pos += TEST_U64_BUF_OFFSET;
success = aa_unpack_u64(puf->e, &data, NULL);
KUNIT_EXPECT_TRUE(test, success);
KUNIT_EXPECT_EQ(test, data, TES... | [
1,
0
] |
Linux Kernel | security/apparmor/policy_unpack_test.c |
static void policy_unpack_test_unpack_u64_out_of_bounds(struct kunit *test) {
struct policy_unpack_fixture *puf = test->priv;
const char name[] = TEST_U64_NAME;
bool success;
u64 data = 0;
puf->e->pos += TEST_NAMED_U64_BUF_OFFSET;
puf->e->end = puf->e->start + TEST_U64_BUF_OFFSET + sizeof(u64);
success... | [
1,
0
] |
Linux Kernel | security/apparmor/resource.c | /**
* aa_task_setrlimit - test permission to set an rlimit
* @label - label confining the task (NOT NULL)
* @task - task the resource is being set on
* @resource - the resource being set
* @new_rlim - the new resource limit (NOT NULL)
*
* Control raising the processes hard limit.
*
* Returns: 0 or error code... | [
1,
1
] |
Linux Kernel | security/apparmor/resource.c | void __aa_transition_rlimits(struct aa_label *old_l, struct aa_label *new_l) {
unsigned int mask = 0;
struct rlimit *rlim, *initrlim;
struct aa_profile *old, *new;
struct label_it i;
old = labels_profile(old_l);
new = labels_profile(new_l);
label_for_each_confined(i, old_l, old) {
if (old->rlimits.m... | [
1,
0
] |
Linux Kernel | security/apparmor/secid.c |
int apparmor_secctx_to_secid(const char *secdata, u32 seclen, u32 *secid) {
struct aa_label *label;
label = aa_label_strn_parse(&root_ns->unconfined->label, secdata, seclen,
GFP_KERNEL, false, false);
if (IS_ERR(label))
return PTR_ERR(label);
*secid = label->secid;
return ... | [
0,
0
] |
Linux Kernel | security/apparmor/secid.c |
void apparmor_release_secctx(char *secdata, u32 seclen) { kfree(secdata); } | [
0,
0
] |
Linux Kernel | security/apparmor/secid.c | void aa_free_secid(u32 secid) {
unsigned long flags;
xa_lock_irqsave(&aa_secids, flags);
__xa_erase(&aa_secids, secid);
xa_unlock_irqrestore(&aa_secids, flags);
} | [
0,
0
] |
Linux Kernel | security/apparmor/task.c | int aa_set_current_onexec(struct aa_label *label, bool stack) {
struct aa_task_ctx *ctx = task_ctx(current);
aa_get_label(label);
aa_put_label(ctx->onexec);
ctx->onexec = label;
ctx->token = stack;
return 0;
} | [
0,
0
] |
Linux Kernel | security/apparmor/task.c | int aa_restore_previous_label(u64 token) {
struct aa_task_ctx *ctx = task_ctx(current);
struct cred *new;
if (ctx->token != token)
return -EACCES;
if (!ctx->previous)
return 0;
new = prepare_creds();
if (!new)
return -ENOMEM;
aa_put_label(cred_label(new));
set_cred_label(new, aa_get_newe... | [
0,
0
] |
Linux Kernel | security/apparmor/task.c | static const char *audit_ptrace_mask(u32 mask) {
switch (mask) {
case MAY_READ:
return "read";
case MAY_WRITE:
return "trace";
case AA_MAY_BE_READ:
return "readby";
case AA_MAY_BE_TRACED:
return "tracedby";
}
return "";
} | [
1,
0
] |
Linux Kernel | security/apparmor/task.c |
static int profile_tracee_perm(struct aa_profile *tracee,
struct aa_label *tracer, u32 request,
struct common_audit_data *sa) {
if (profile_unconfined(tracee) || unconfined(tracer) ||
!PROFILE_MEDIATES(tracee, AA_CLASS_PTRACE))
return 0;
retu... | [
0,
0
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.