Projectname
large_stringclasses
15 values
Filepath
large_stringlengths
4
106
⌀
Function
large_stringlengths
11
3.45k
Label
list
Linux Kernel
security/selinux/ss/sidtab.c
static struct sidtab_entry *sidtab_do_lookup(struct sidtab *s, u32 index, int alloc) { union sidtab_entry_inner *entry; u32 level, capacity_shift, leaf_index = index / SIDTAB_LEAF_ENTRIES; level = sidtab_level_from_count(index + 1); capacity_shift = level * SIDTAB_I...
[ 1, 0 ]
Linux Kernel
security/selinux/ss/sidtab.c
void sidtab_sid2str_put(struct sidtab *s, struct sidtab_entry *entry, const char *str, u32 str_len) { struct sidtab_str_cache *cache, *victim = NULL; unsigned long flags; if (entry->context.len) return; spin_lock_irqsave(&s->cache_lock, flags); cache = rcu_dereference_prot...
[ 1, 0 ]
Linux Kernel
security/selinux/ss/symtab.c
int symtab_insert(struct symtab *s, char *name, void *datum) { return hashtab_insert(&s->table, name, datum, symtab_key_params); }
[ 0, 0 ]
Linux Kernel
security/selinux/ss/symtab.c
void *symtab_search(struct symtab *s, const char *name) { return hashtab_search(&s->table, name, symtab_key_params); }
[ 0, 0 ]
Linux Kernel
security/selinux/status.c
void selinux_status_update_policyload(struct selinux_state *state, int seqno) { struct selinux_kernel_status *status; mutex_lock(&state->status_lock); if (state->status_page) { status = page_address(state->status_page); status->sequence++; smp_wmb(); status->policyload = seqno; status->deny...
[ 0, 0 ]
Linux Kernel
security/selinux/xfrm.c
static inline int selinux_authorizable_ctx(struct xfrm_sec_ctx *ctx) { return (ctx && (ctx->ctx_doi == XFRM_SC_DOI_LSM) && (ctx->ctx_alg == XFRM_SC_ALG_SELINUX)); }
[ 0, 0 ]
Linux Kernel
security/selinux/xfrm.c
static int selinux_xfrm_alloc_user(struct xfrm_sec_ctx **ctxp, struct xfrm_user_sec_ctx *uctx, gfp_t gfp) { int rc; const struct task_security_struct *tsec = selinux_cred(current_cred()); struct xfrm_sec_ctx *ctx = NULL; u32 str_len; if (ctxp == NULL || uctx == NULL || uctx...
[ 1, 0 ]
Linux Kernel
security/selinux/xfrm.c
int selinux_xfrm_policy_alloc(struct xfrm_sec_ctx **ctxp, struct xfrm_user_sec_ctx *uctx, gfp_t gfp) { return selinux_xfrm_alloc_user(ctxp, uctx, gfp); }
[ 0, 0 ]
Linux Kernel
security/selinux/xfrm.c
int selinux_xfrm_state_delete(struct xfrm_state *x) { return selinux_xfrm_delete(x->security); }
[ 0, 0 ]
Linux Kernel
security/smack/smack.h
static inline struct task_smack *smack_cred(const struct cred *cred) { return cred->security + smack_blob_sizes.lbs_cred; }
[ 0, 0 ]
Linux Kernel
security/smack/smack.h
static inline struct smack_known **smack_file(const struct file *file) { return (struct smack_known **)(file->f_security + smack_blob_sizes.lbs_file); }
[ 0, 0 ]
Linux Kernel
security/smack/smack.h
static inline struct smack_known **smack_ipc(const struct kern_ipc_perm *ipc) { return ipc->security + smack_blob_sizes.lbs_ipc; }
[ 0, 0 ]
Linux Kernel
security/smack/smack.h
static inline struct smack_known *smk_of_inode(const struct inode *isp) { struct inode_smack *sip = smack_inode(isp); return sip->smk_inode; }
[ 0, 0 ]
Linux Kernel
security/smack/smack.h
static inline struct smack_known *smk_of_current(void) { return smk_of_task(smack_cred(current_cred())); }
[ 0, 0 ]
Linux Kernel
security/smack/smack.h
static inline void smk_ad_setfield_u_fs_inode(struct smk_audit_info *a, struct inode *i) { a->a.u.inode = i; }
[ 0, 0 ]
Linux Kernel
security/smack/smack.h
static inline void smk_ad_setfield_u_fs_path(struct smk_audit_info *a, struct path p) {}
[ 0, 0 ]
Linux Kernel
security/smack/smackfs.c
static inline void smack_catset_bit(unsigned int cat, char *catsetp) { if (cat == 0 || cat > (SMK_CIPSOLEN * 8)) return; catsetp[(cat - 1) / 8] |= 0x80 >> ((cat - 1) % 8); }
[ 1, 0 ]
Linux Kernel
security/smack/smackfs.c
static void smk_netlabel_audit_set(struct netlbl_audit *nap) { struct smack_known *skp = smk_of_current(); nap->loginuid = audit_get_loginuid(current); nap->sessionid = audit_get_sessionid(current); nap->secid = skp->smk_secid; }
[ 0, 0 ]
Linux Kernel
security/smack/smackfs.c
static ssize_t smk_parse_long_rule(char *data, struct smack_parsed_rule *rule, int import, int tokens) { ssize_t cnt = 0; char *tok[4]; int rc; int i; for (i = 0; i < tokens; ++i) { while (isspace(data[cnt])) data[cnt++] = '\0'; if (data[cnt] == '\0') /...
[ 0, 0 ]
Linux Kernel
security/smack/smackfs.c
static void *smk_seq_start(struct seq_file *s, loff_t *pos, struct list_head *head) { struct list_head *list; int i = *pos; rcu_read_lock(); for (list = rcu_dereference(list_next_rcu(head)); list != head; list = rcu_dereference(list_next_rcu(list))) { if (i-- == 0) r...
[ 0, 0 ]
Linux Kernel
security/smack/smackfs.c
static void *load2_seq_start(struct seq_file *s, loff_t *pos) { return smk_seq_start(s, pos, &smack_known_list); }
[ 0, 0 ]
Linux Kernel
security/smack/smackfs.c
static int smk_open_net4addr(struct inode *inode, struct file *file) { return seq_open(file, &net4addr_seq_ops); }
[ 0, 0 ]
Linux Kernel
security/smack/smackfs.c
static ssize_t smk_read_doi(struct file *filp, char __user *buf, size_t count, loff_t *ppos) { char temp[80]; ssize_t rc; if (*ppos != 0) return 0; sprintf(temp, "%d", smk_cipso_doi_value); rc = simple_read_from_buffer(buf, count, ppos, temp, strlen(temp)); return rc; }
[ 1, 0 ]
Linux Kernel
security/smack/smackfs.c
static ssize_t smk_read_direct(struct file *filp, char __user *buf, size_t count, loff_t *ppos) { char temp[80]; ssize_t rc; if (*ppos != 0) return 0; sprintf(temp, "%d", smack_cipso_direct); rc = simple_read_from_buffer(buf, count, ppos, temp, strlen(temp)); return rc;...
[ 1, 0 ]
Linux Kernel
security/smack/smackfs.c
static ssize_t smk_read_mapped(struct file *filp, char __user *buf, size_t count, loff_t *ppos) { char temp[80]; ssize_t rc; if (*ppos != 0) return 0; sprintf(temp, "%d", smack_cipso_mapped); rc = simple_read_from_buffer(buf, count, ppos, temp, strlen(temp)); return rc;...
[ 1, 0 ]
Linux Kernel
security/smack/smackfs.c
static ssize_t smk_read_ambient(struct file *filp, char __user *buf, size_t cn, loff_t *ppos) { ssize_t rc; int asize; if (*ppos != 0) return 0; mutex_lock(&smack_ambient_lock); asize = strlen(smack_net_ambient->smk_known) + 1; if (cn >= asize) rc = simple_read_fr...
[ 0, 0 ]
Linux Kernel
security/smack/smackfs.c
static ssize_t smk_write_ambient(struct file *file, const char __user *buf, size_t count, loff_t *ppos) { struct smack_known *skp; char *oldambient; char *data; int rc = count; if (!smack_privileged(CAP_MAC_ADMIN)) return -EPERM; if (count == 0 || count > PAGE_SIZE) ...
[ 0, 0 ]
Linux Kernel
security/smack/smackfs.c
static void *onlycap_seq_start(struct seq_file *s, loff_t *pos) { return smk_seq_start(s, pos, &smack_onlycap_list); }
[ 0, 0 ]
Linux Kernel
security/smack/smackfs.c
static void smk_list_swap_rcu(struct list_head *public, struct list_head *private) { struct list_head *first, *last; if (list_empty(public)) { list_splice_init_rcu(private, public, synchronize_rcu); } else { first = public->next; last = public->prev; /* Publish pri...
[ 0, 0 ]
Linux Kernel
security/smack/smackfs.c
static ssize_t smk_read_logging(struct file *filp, char __user *buf, size_t count, loff_t *ppos) { char temp[32]; ssize_t rc; if (*ppos != 0) return 0; sprintf(temp, "%d\n", log_policy); rc = simple_read_from_buffer(buf, count, ppos, temp, strlen(temp)); return rc; }
[ 1, 0 ]
Linux Kernel
security/smack/smackfs.c
static void *load_self_seq_start(struct seq_file *s, loff_t *pos) { struct task_smack *tsp = smack_cred(current_cred()); return smk_seq_start(s, pos, &tsp->smk_rules); }
[ 0, 0 ]
Linux Kernel
security/smack/smackfs.c
static int smk_open_load_self(struct inode *inode, struct file *file) { return seq_open(file, &load_self_seq_ops); }
[ 0, 0 ]
Linux Kernel
security/smack/smackfs.c
static ssize_t smk_user_access(struct file *file, const char __user *buf, size_t count, loff_t *ppos, int format) { struct smack_parsed_rule rule; char *data; int res; data = simple_transaction_get(file, buf, count); if (IS_ERR(data)) return PTR_ERR(data); if (format == ...
[ 1, 0 ]
Linux Kernel
security/smack/smackfs.c
static ssize_t smk_write_access(struct file *file, const char __user *buf, size_t count, loff_t *ppos) { return smk_user_access(file, buf, count, ppos, SMK_FIXED24_FMT); }
[ 0, 0 ]
Linux Kernel
security/smack/smackfs.c
static int smk_open_load2(struct inode *inode, struct file *file) { return seq_open(file, &load2_seq_ops); }
[ 0, 0 ]
Linux Kernel
security/smack/smackfs.c
static ssize_t smk_write_load2(struct file *file, const char __user *buf, size_t count, loff_t *ppos) { if (!smack_privileged(CAP_MAC_ADMIN)) return -EPERM; return smk_write_rules_list(file, buf, count, ppos, NULL, NULL, SMK_LONG_FMT); }
[ 0, 0 ]
Linux Kernel
security/smack/smackfs.c
static int load_self2_seq_show(struct seq_file *s, void *v) { struct list_head *list = v; struct smack_rule *srp = list_entry_rcu(list, struct smack_rule, list); smk_rule_show(s, srp, SMK_LONGLABEL); return 0; }
[ 0, 0 ]
Linux Kernel
security/smack/smackfs.c
static int smk_open_load_self2(struct inode *inode, struct file *file) { return seq_open(file, &load_self2_seq_ops); }
[ 0, 0 ]
Linux Kernel
security/smack/smackfs.c
static ssize_t smk_write_load_self2(struct file *file, const char __user *buf, size_t count, loff_t *ppos) { struct task_smack *tsp = smack_cred(current_cred()); return smk_write_rules_list(file, buf, count, ppos, &tsp->smk_rules, &tsp->smk_rules_lo...
[ 0, 0 ]
Linux Kernel
security/smack/smackfs.c
static ssize_t smk_read_syslog(struct file *filp, char __user *buf, size_t cn, loff_t *ppos) { struct smack_known *skp; ssize_t rc = -EINVAL; int asize; if (*ppos != 0) return 0; if (smack_syslog_label == NULL) skp = &smack_known_star; else skp = smack_syslog_lab...
[ 0, 0 ]
Linux Kernel
security/smack/smackfs.c
static int smk_init_fs_context(struct fs_context *fc) { fc->ops = &smk_context_ops; return 0; }
[ 0, 0 ]
Linux Kernel
security/smack/smack_access.c
static inline void smack_str_from_perm(char *string, int access) { int i = 0; if (access & MAY_READ) string[i++] = 'r'; if (access & MAY_WRITE) string[i++] = 'w'; if (access & MAY_EXEC) string[i++] = 'x'; if (access & MAY_APPEND) string[i++] = 'a'; if (access & MAY_TRANSMUTE) string[i++...
[ 0, 0 ]
Linux Kernel
security/smack/smack_access.c
void smk_insert_entry(struct smack_known *skp) { unsigned int hash; struct hlist_head *head; hash = full_name_hash(NULL, skp->smk_known, strlen(skp->smk_known)); head = &smack_known_hash[hash & (SMACK_HASH_SLOTS - 1)]; hlist_add_head_rcu(&skp->smk_hashed, head); list_add_rcu(&skp->list, &smack_known_list)...
[ 0, 0 ]
Linux Kernel
security/smack/smack_access.c
char *smk_parse_smack(const char *string, int len) { char *smack; int i; if (len <= 0) len = strlen(string) + 1; if (string[0] == '-') return ERR_PTR(-EINVAL); for (i = 0; i < len; i++) if (string[i] > '~' || string[i] <= ' ' || string[i] == '/' || string[i] == '"' || string[i] == '\\' ...
[ 1, 0 ]
Linux Kernel
security/smack/smack_access.c
struct smack_known *smk_import_entry(const char *string, int len) { struct smack_known *skp; char *smack; int rc; smack = smk_parse_smack(string, len); if (IS_ERR(smack)) return ERR_CAST(smack); mutex_lock(&smack_known_lock); skp = smk_find_entry(smack); if (skp != NULL) goto freeout; skp ...
[ 0, 0 ]
Linux Kernel
security/smack/smack_access.c
struct smack_known *smack_from_secid(const u32 secid) { struct smack_known *skp; rcu_read_lock(); list_for_each_entry_rcu(skp, &smack_known_list, list) { if (skp->smk_secid == secid) { rcu_read_unlock(); return skp; } } rcu_read_unlock(); return &smack_known_huh; }
[ 0, 0 ]
Linux Kernel
security/smack/smack_lsm.c
static int smk_bu_task(struct task_struct *otp, int mode, int rc) { struct task_smack *tsp = smack_cred(current_cred()); struct smack_known *smk_task = smk_of_task_struct_obj(otp); char acc[SMK_NUM_ACCESS_TYPE + 1]; if (rc <= 0) return rc; if (rc > SMACK_UNCONFINED_OBJECT) rc = 0; smk_bu_mode(mode...
[ 0, 0 ]
Linux Kernel
security/smack/smack_lsm.c
static int smk_bu_file(struct file *file, int mode, int rc) { struct task_smack *tsp = smack_cred(current_cred()); struct smack_known *sskp = tsp->smk_task; struct inode *inode = file_inode(file); struct inode_smack *isp = smack_inode(inode); char acc[SMK_NUM_ACCESS_TYPE + 1]; if (isp->smk_flags & SMK_INOD...
[ 1, 0 ]
Linux Kernel
security/smack/smack_lsm.c
static int smk_bu_credfile(const struct cred *cred, struct file *file, int mode, int rc) { struct task_smack *tsp = smack_cred(cred); struct smack_known *sskp = tsp->smk_task; struct inode *inode = file_inode(file); struct inode_smack *isp = smack_inode(inode); char acc[SMK_NUM_ACCE...
[ 1, 0 ]
Linux Kernel
security/smack/smack_lsm.c
static int smack_sb_eat_lsm_opts(char *options, void **mnt_opts) { char *from = options, *to = options; bool first = true; while (1) { char *next = strchr(from, ','); int token, len, rc; char *arg = NULL; if (next) len = next - from; else len = strlen(from); token = match_op...
[ 1, 0 ]
Linux Kernel
security/smack/smack_lsm.c
static int smack_sb_statfs(struct dentry *dentry) { struct superblock_smack *sbp = smack_superblock(dentry->d_sb); int rc; struct smk_audit_info ad; smk_ad_init(&ad, __func__, LSM_AUDIT_DATA_DENTRY); smk_ad_setfield_u_fs_path_dentry(&ad, dentry); rc = smk_curacc(sbp->smk_floor, MAY_READ, &ad); rc = smk_...
[ 0, 0 ]
Linux Kernel
security/smack/smack_lsm.c
static int smack_bprm_creds_for_exec(struct linux_binprm *bprm) { struct inode *inode = file_inode(bprm->file); struct task_smack *bsp = smack_cred(bprm->cred); struct inode_smack *isp; struct superblock_smack *sbsp; int rc; isp = smack_inode(inode); if (isp->smk_task == NULL || isp->smk_task == bsp->smk...
[ 1, 0 ]
Linux Kernel
security/smack/smack_lsm.c
static int smack_inode_unlink(struct inode *dir, struct dentry *dentry) { struct inode *ip = d_backing_inode(dentry); struct smk_audit_info ad; int rc; smk_ad_init(&ad, __func__, LSM_AUDIT_DATA_DENTRY); smk_ad_setfield_u_fs_path_dentry(&ad, dentry); rc = smk_curacc(smk_of_inode(ip), MAY_WRITE, &ad); rc ...
[ 0, 0 ]
Linux Kernel
security/smack/smack_lsm.c
static int smack_inode_rename(struct inode *old_inode, struct dentry *old_dentry, struct inode *new_inode, struct dentry *new_dentry) { int rc; struct smack_known *isp; struct smk_audit_info ad; smk_ad_init(&ad, __func__,...
[ 0, 0 ]
Linux Kernel
security/smack/smack_lsm.c
static int smack_inode_get_acl(struct user_namespace *mnt_userns, struct dentry *dentry, const char *acl_name) { struct smk_audit_info ad; int rc; smk_ad_init(&ad, __func__, LSM_AUDIT_DATA_DENTRY); smk_ad_setfield_u_fs_path_dentry(&ad, dentry); rc = smk_curacc(smk_of_inode(d_b...
[ 0, 0 ]
Linux Kernel
security/smack/smack_lsm.c
static int smack_inode_listsecurity(struct inode *inode, char *buffer, size_t buffer_size) { int len = sizeof(XATTR_NAME_SMACK); if (buffer != NULL && len <= buffer_size) memcpy(buffer, XATTR_NAME_SMACK, len); return len; }
[ 1, 0 ]
Linux Kernel
security/smack/smack_lsm.c
static void smack_file_set_fowner(struct file *file) { struct smack_known **blob = smack_file(file); *blob = smk_of_current(); }
[ 0, 0 ]
Linux Kernel
security/smack/smack_lsm.c
static int smk_curacc_on_task(struct task_struct *p, int access, const char *caller) { struct smk_audit_info ad; struct smack_known *skp = smk_of_task_struct_obj(p); int rc; smk_ad_init(&ad, caller, LSM_AUDIT_DATA_TASK); smk_ad_setfield_u_tsk(&ad, p); rc = smk_curacc(skp, acce...
[ 0, 0 ]
Linux Kernel
security/smack/smack_lsm.c
static int smack_task_getsid(struct task_struct *p) { return smk_curacc_on_task(p, MAY_READ, __func__); }
[ 0, 0 ]
Linux Kernel
security/smack/smack_lsm.c
static void smack_current_getsecid_subj(u32 *secid) { struct smack_known *skp = smk_of_current(); *secid = skp->smk_secid; }
[ 0, 0 ]
Linux Kernel
security/smack/smack_lsm.c
static int smack_task_kill(struct task_struct *p, struct kernel_siginfo *info, int sig, const struct cred *cred) { struct smk_audit_info ad; struct smack_known *skp; struct smack_known *tkp = smk_of_task_struct_obj(p); int rc; if (!sig) return 0; smk_ad_init(&ad, __func__, L...
[ 0, 0 ]
Linux Kernel
security/smack/smack_lsm.c
static void smack_sk_free_security(struct sock *sk) { #ifdef SMACK_IPV6_PORT_LABELING struct smk_port_label *spp; if (sk->sk_family == PF_INET6) { rcu_read_lock(); list_for_each_entry_rcu(spp, &smk_ipv6_port_list, list) { if (spp->smk_sock != sk) continue; spp->smk_can_reuse = 1; ...
[ 0, 0 ]
Linux Kernel
security/smack/smack_lsm.c
static bool smk_ipv6_localhost(struct sockaddr_in6 *sip) { __be16 *be16p = (__be16 *)&sip->sin6_addr; __be32 *be32p = (__be32 *)&sip->sin6_addr; if (be32p[0] == 0 && be32p[1] == 0 && be32p[2] == 0 && be16p[6] == 0 && ntohs(be16p[7]) == 1) return true; return false; }
[ 1, 0 ]
Linux Kernel
security/smack/smack_lsm.c
static int smack_netlbl_add(struct sock *sk) { struct socket_smack *ssp = sk->sk_security; struct smack_known *skp = ssp->smk_out; int rc; local_bh_disable(); bh_lock_sock_nested(sk); rc = netlbl_sock_setattr(sk, sk->sk_family, &skp->smk_netlabel); switch (rc) { case 0: ssp->smk_state = SMK_NETLBL...
[ 1, 0 ]
Linux Kernel
security/smack/smack_lsm.c
static int smk_ipv4_check(struct sock *sk, struct sockaddr_in *sap) { struct smack_known *skp; int rc = 0; struct smack_known *hkp; struct socket_smack *ssp = sk->sk_security; struct smk_audit_info ad; rcu_read_lock(); hkp = smack_ipv4host_label(sap); if (hkp != NULL) { #ifdef CONFIG_AUDIT struct l...
[ 0, 0 ]
Linux Kernel
security/smack/smack_lsm.c
static int smk_ipv6_port_check(struct sock *sk, struct sockaddr_in6 *address, int act) { struct smk_port_label *spp; struct socket_smack *ssp = sk->sk_security; struct smack_known *skp = NULL; unsigned short port; struct smack_known *object; if (act == SMK_RECEIVING) { sk...
[ 1, 0 ]
Linux Kernel
security/smack/smack_lsm.c
static int smack_msg_msg_alloc_security(struct msg_msg *msg) { struct smack_known **blob = smack_msg_msg(msg); *blob = smk_of_current(); return 0; }
[ 0, 0 ]
Linux Kernel
security/smack/smack_lsm.c
static int smack_ipc_alloc_security(struct kern_ipc_perm *isp) { struct smack_known **blob = smack_ipc(isp); *blob = smk_of_current(); return 0; }
[ 0, 0 ]
Linux Kernel
security/smack/smack_lsm.c
static int smack_shm_shmat(struct kern_ipc_perm *isp, char __user *shmaddr, int shmflg) { int may; may = smack_flags_to_may(shmflg); return smk_curacc_shm(isp, may); }
[ 0, 0 ]
Linux Kernel
security/smack/smack_lsm.c
static int smack_sem_semop(struct kern_ipc_perm *isp, struct sembuf *sops, unsigned nsops, int alter) { return smk_curacc_sem(isp, MAY_READWRITE); }
[ 0, 0 ]
Linux Kernel
security/smack/smack_lsm.c
static int smack_msg_queue_associate(struct kern_ipc_perm *isp, int msqflg) { int may; may = smack_flags_to_may(msqflg); return smk_curacc_msq(isp, may); }
[ 0, 0 ]
Linux Kernel
security/smack/smack_lsm.c
static int smack_msg_queue_msgsnd(struct kern_ipc_perm *isp, struct msg_msg *msg, int msqflg) { int may; may = smack_flags_to_may(msqflg); return smk_curacc_msq(isp, may); }
[ 0, 0 ]
Linux Kernel
security/smack/smack_lsm.c
static int smack_setprocattr(const char *name, void *value, size_t size) { struct task_smack *tsp = smack_cred(current_cred()); struct cred *new; struct smack_known *skp; struct smack_known_list_elem *sklep; int rc; if (!smack_privileged(CAP_MAC_ADMIN) && list_empty(&tsp->smk_relabel)) return -EPERM; ...
[ 1, 0 ]
Linux Kernel
security/smack/smack_lsm.c
static int smack_unix_stream_connect(struct sock *sock, struct sock *other, struct sock *newsk) { struct smack_known *skp; struct smack_known *okp; struct socket_smack *ssp = sock->sk_security; struct socket_smack *osp = other->sk_security; struct socket_smack *nsp = newsk...
[ 0, 0 ]
Linux Kernel
security/smack/smack_lsm.c
static int smack_socket_sendmsg(struct socket *sock, struct msghdr *msg, int size) { struct sockaddr_in *sip = (struct sockaddr_in *)msg->msg_name; #if IS_ENABLED(CONFIG_IPV6) struct sockaddr_in6 *sap = (struct sockaddr_in6 *)msg->msg_name; #endif #ifdef SMACK_IPV6_SECMARK_LABELING ...
[ 1, 0 ]
Linux Kernel
security/smack/smack_lsm.c
static int smk_skb_to_addr_ipv6(struct sk_buff *skb, struct sockaddr_in6 *sip) { u8 nexthdr; int offset; int proto = -EINVAL; struct ipv6hdr _ipv6h; struct ipv6hdr *ip6; __be16 frag_off; struct tcphdr _tcph, *th; struct udphdr _udph, *uh; struct dccp_hdr _dccph, *dh; sip->sin6_port = 0; offset =...
[ 1, 0 ]
Linux Kernel
security/smack/smack_lsm.c
static int smack_socket_getpeersec_stream(struct socket *sock, sockptr_t optval, sockptr_t optlen, unsigned int len) { struct socket_smack *ssp; char *rcp = ""; u32 slen = 1; int rc = 0; ssp = sock->sk->sk_security; if (ssp->smk_packet != NULL) { rcp = ssp->smk...
[ 1, 0 ]
Linux Kernel
security/smack/smack_lsm.c
static int smack_socket_getpeersec_dgram(struct socket *sock, struct sk_buff *skb, u32 *secid) { struct socket_smack *ssp = NULL; struct smack_known *skp; struct sock *sk = NULL; int family = PF_UNSPEC; u32 s = 0; if (skb != NULL) { if (skb->protocol == htons(E...
[ 1, 0 ]
Linux Kernel
security/smack/smack_lsm.c
static void smack_sock_graft(struct sock *sk, struct socket *parent) { struct socket_smack *ssp; struct smack_known *skp = smk_of_current(); if (sk == NULL || (sk->sk_family != PF_INET && sk->sk_family != PF_INET6)) return; ssp = sk->sk_security; ssp->smk_in = skp; ssp->smk_out = skp; }
[ 1, 0 ]
Linux Kernel
security/smack/smack_lsm.c
static void smack_inet_csk_clone(struct sock *sk, const struct request_sock *req) { struct socket_smack *ssp = sk->sk_security; struct smack_known *skp; if (req->peer_secid != 0) { skp = smack_from_secid(req->peer_secid); ssp->smk_packet = skp; } else ssp->smk_packe...
[ 0, 0 ]
Linux Kernel
security/smack/smack_lsm.c
static int smack_audit_rule_match(u32 secid, u32 field, u32 op, void *vrule) { struct smack_known *skp; char *rule = vrule; if (unlikely(!rule)) { WARN_ONCE(1, "Smack: missing rule\n"); return -ENOENT; } if (field != AUDIT_SUBJ_USER && field != AUDIT_OBJ_USER) return 0; skp = smack_from_secid...
[ 1, 0 ]
Linux Kernel
security/smack/smack_lsm.c
static int smack_secid_to_secctx(u32 secid, char **secdata, u32 *seclen) { struct smack_known *skp = smack_from_secid(secid); if (secdata) *secdata = skp->smk_known; *seclen = strlen(skp->smk_known); return 0; }
[ 0, 0 ]
Linux Kernel
security/smack/smack_lsm.c
static int smack_secctx_to_secid(const char *secdata, u32 seclen, u32 *secid) { struct smack_known *skp = smk_find_entry(secdata); if (skp) *secid = skp->smk_secid; else *secid = 0; return 0; }
[ 0, 0 ]
Linux Kernel
security/smack/smack_lsm.c
static int smack_inode_notifysecctx(struct inode *inode, void *ctx, u32 ctxlen) { return smack_inode_setsecurity(inode, XATTR_SMACK_SUFFIX, ctx, ctxlen, 0); }
[ 0, 0 ]
Linux Kernel
security/smack/smack_lsm.c
static int smack_dentry_create_files_as(struct dentry *dentry, int mode, struct qstr *name, const struct cred *old, struct cred *new) { struct task_smack *otsp = smack_cred(old); struct task_smack...
[ 1, 0 ]
Linux Kernel
security/smack/smack_netfilter.c
static unsigned int smack_ip_output(void *priv, struct sk_buff *skb, const struct nf_hook_state *state) { struct sock *sk = skb_to_full_sk(skb); struct socket_smack *ssp; struct smack_known *skp; if (sk && sk->sk_security) { ssp = sk->sk_security; skp = ssp->smk_out...
[ 1, 0 ]
Linux Kernel
security/tomoyo/audit.c
void tomoyo_write_log2(struct tomoyo_request_info *r, int len, const char *fmt, va_list args) { char *buf; struct tomoyo_log *entry; bool quota_exceeded = false; if (!tomoyo_get_audit(r->domain->ns, r->profile, r->type, r->matched_acl, r->granted)) goto out; ...
[ 1, 0 ]
Linux Kernel
security/tomoyo/audit.c
__poll_t tomoyo_poll_log(struct file *file, poll_table *wait) { if (tomoyo_log_count) return EPOLLIN | EPOLLRDNORM; poll_wait(file, &tomoyo_log_wait, wait); if (tomoyo_log_count) return EPOLLIN | EPOLLRDNORM; return 0; }
[ 0, 0 ]
Linux Kernel
security/tomoyo/common.c
static void tomoyo_addprintf(char *buffer, int len, const char *fmt, ...) { va_list args; const int pos = strlen(buffer); va_start(args, fmt); vsnprintf(buffer + pos, len - pos - 1, fmt, args); va_end(args); }
[ 1, 0 ]
Linux Kernel
security/tomoyo/common.c
static bool tomoyo_flush(struct tomoyo_io_buffer *head) { while (head->r.w_pos) { const char *w = head->r.w[0]; size_t len = strlen(w); if (len) { if (len > head->read_user_buf_avail) len = head->read_user_buf_avail; if (!len) return false; if (copy_to_user(head->read_us...
[ 1, 0 ]
Linux Kernel
security/tomoyo/common.c
static void tomoyo_set_space(struct tomoyo_io_buffer *head) { tomoyo_set_string(head, " "); }
[ 0, 0 ]
Linux Kernel
security/tomoyo/common.c
static void tomoyo_print_namespace(struct tomoyo_io_buffer *head) { if (!tomoyo_namespace_enabled) return; tomoyo_set_string( head, container_of(head->r.ns, struct tomoyo_policy_namespace, namespace_list) ->name); tomoyo_set_space(head); }
[ 0, 0 ]
Linux Kernel
security/tomoyo/common.c
static void tomoyo_print_name_union_quoted(struct tomoyo_io_buffer *head, const struct tomoyo_name_union *ptr) { if (ptr->group) { tomoyo_set_string(head, "@"); tomoyo_set_string(head, ptr->group->group_name->name); } else { tomoyo_set_string(head, "\""); tomoyo_set_st...
[ 0, 0 ]
Linux Kernel
security/tomoyo/common.c
static void tomoyo_print_number_union(struct tomoyo_io_buffer *head, const struct tomoyo_number_union *ptr) { tomoyo_set_space(head); tomoyo_print_number_union_nospace(head, ptr); }
[ 0, 0 ]
Linux Kernel
security/tomoyo/common.c
struct tomoyo_profile *tomoyo_profile(const struct tomoyo_policy_namespace *ns, const u8 profile) { static struct tomoyo_profile tomoyo_null_profile; struct tomoyo_profile *ptr = ns->profile_ptr[profile]; if (!ptr) ptr = &tomoyo_null_profile; return ptr; }
[ 0, 0 ]
Linux Kernel
security/tomoyo/common.c
static void tomoyo_set_uint(unsigned int *i, const char *string, const char *find) { const char *cp = strstr(string, find); if (cp) sscanf(cp + strlen(find), "=%u", i); }
[ 1, 0 ]
Linux Kernel
security/tomoyo/common.c
static int tomoyo_write_profile(struct tomoyo_io_buffer *head) { char *data = head->write_buf; unsigned int i; char *cp; struct tomoyo_profile *profile; if (sscanf(data, "PROFILE_VERSION=%u", &head->w.ns->profile_version) == 1) return 0; i = simple_strtoul(data, &cp, 10); if (*cp != '-') return -...
[ 0, 0 ]
Linux Kernel
security/tomoyo/common.c
static bool tomoyo_select_domain(struct tomoyo_io_buffer *head, const char *data) { unsigned int pid; struct tomoyo_domain_info *domain = NULL; bool global_pid = false; if (strncmp(data, "select ", 7)) return false; data += 7; if (sscanf(data, "pid=%u", &pid) == 1 || ...
[ 1, 0 ]
Linux Kernel
security/tomoyo/common.c
static bool tomoyo_same_task_acl(const struct tomoyo_acl_info *a, const struct tomoyo_acl_info *b) { const struct tomoyo_task_acl *p1 = container_of(a, typeof(*p1), head); const struct tomoyo_task_acl *p2 = container_of(b, typeof(*p2), head); return p1->domainname == p2->domainna...
[ 0, 0 ]
Linux Kernel
security/tomoyo/common.c
static int tomoyo_write_domain(struct tomoyo_io_buffer *head) { char *data = head->write_buf; struct tomoyo_policy_namespace *ns; struct tomoyo_domain_info *domain = head->w.domain; const bool is_delete = head->w.is_delete; bool is_select = !is_delete && tomoyo_str_starts(&data, "select "); unsigned int idx...
[ 1, 0 ]