Projectname large_stringclasses 15
values | Filepath large_stringlengths 4 106 ⌀ | Function large_stringlengths 11 3.45k | Label list |
|---|---|---|---|
Linux Kernel | security/bpf/hooks.c |
static int __init bpf_lsm_init(void) {
security_add_hooks(bpf_lsm_hooks, ARRAY_SIZE(bpf_lsm_hooks), "bpf");
pr_info("LSM support for eBPF active\n");
return 0;
} | [
0,
0
] |
Linux Kernel | security/commoncap.c | int cap_capget(struct task_struct *target, kernel_cap_t *effective,
kernel_cap_t *inheritable, kernel_cap_t *permitted) {
const struct cred *cred;
rcu_read_lock();
cred = __task_cred(target);
*effective = cred->cap_effective;
*inheritable = cred->cap_inheritable;
*permitted = cred->cap_permi... | [
0,
0
] |
Linux Kernel | security/commoncap.c | int cap_inode_need_killpriv(struct dentry *dentry) {
struct inode *inode = d_backing_inode(dentry);
int error;
error = __vfs_getxattr(dentry, inode, XATTR_NAME_CAPS, NULL, 0);
return error > 0;
} | [
0,
0
] |
Linux Kernel | security/commoncap.c | static inline int bprm_caps_from_vfs_caps(struct cpu_vfs_cap_data *caps,
struct linux_binprm *bprm,
bool *effective, bool *has_fcap) {
struct cred *new = bprm->cred;
unsigned i;
int ret = 0;
if (caps->magic_etc & VFS_CAP_FLAGS_... | [
0,
0
] |
Linux Kernel | security/commoncap.c | int cap_inode_removexattr(struct user_namespace *mnt_userns,
struct dentry *dentry, const char *name) {
struct user_namespace *user_ns = dentry->d_sb->s_user_ns;
if (strncmp(name, XATTR_SECURITY_PREFIX, XATTR_SECURITY_PREFIX_LEN) != 0)
return 0;
if (strcmp(name, XATTR_NAME_CAPS) ==... | [
1,
0
] |
Linux Kernel | security/commoncap.c | static inline void cap_emulate_setxuid(struct cred *new,
const struct cred *old) {
kuid_t root_uid = make_kuid(old->user_ns, 0);
if ((uid_eq(old->uid, root_uid) || uid_eq(old->euid, root_uid) ||
uid_eq(old->suid, root_uid)) &&
(!uid_eq(new->uid, root_uid) && !uid... | [
0,
0
] |
Linux Kernel | security/commoncap.c | int cap_task_fix_setuid(struct cred *new, const struct cred *old, int flags) {
switch (flags) {
case LSM_SETID_RE:
case LSM_SETID_ID:
case LSM_SETID_RES:
if (!issecure(SECURE_NO_SETUID_FIXUP))
cap_emulate_setxuid(new, old);
break;
case LSM_SETID_FS:
/* juggle the capabilties to follow FSUI... | [
0,
1
] |
Linux Kernel | security/commoncap.c | static int cap_safe_nice(struct task_struct *p) {
int is_subset, ret = 0;
rcu_read_lock();
is_subset = cap_issubset(__task_cred(p)->cap_permitted,
current_cred()->cap_permitted);
if (!is_subset && !ns_capable(__task_cred(p)->user_ns, CAP_SYS_NICE))
ret = -EPERM;
rcu_read_unlock... | [
0,
0
] |
Linux Kernel | security/commoncap.c |
static int __init capability_init(void) {
security_add_hooks(capability_hooks, ARRAY_SIZE(capability_hooks),
"capability");
return 0;
} | [
0,
0
] |
Linux Kernel | security/device_cgroup.c | static int dev_exceptions_copy(struct list_head *dest, struct list_head *orig) {
struct dev_exception_item *ex, *tmp, *new;
lockdep_assert_held(&devcgroup_mutex);
list_for_each_entry(ex, orig, list) {
new = kmemdup(ex, sizeof(*ex), GFP_KERNEL);
if (!new)
goto free_and_exit;
list_add_tail(&new-... | [
1,
0
] |
Linux Kernel | security/device_cgroup.c | static int dev_exception_add(struct dev_cgroup *dev_cgroup,
struct dev_exception_item *ex) {
struct dev_exception_item *excopy, *walk;
lockdep_assert_held(&devcgroup_mutex);
excopy = kmemdup(ex, sizeof(*ex), GFP_KERNEL);
if (!excopy)
return -ENOMEM;
list_for_each_entry(walk... | [
1,
0
] |
Linux Kernel | security/device_cgroup.c | static int devcgroup_online(struct cgroup_subsys_state *css) {
struct dev_cgroup *dev_cgroup = css_to_devcgroup(css);
struct dev_cgroup *parent_dev_cgroup = css_to_devcgroup(css->parent);
int ret = 0;
mutex_lock(&devcgroup_mutex);
if (parent_dev_cgroup == NULL)
dev_cgroup->behavior = DEVCG_DEFAULT_ALLOW... | [
0,
0
] |
Linux Kernel | security/device_cgroup.c |
static void devcgroup_css_free(struct cgroup_subsys_state *css) {
struct dev_cgroup *dev_cgroup = css_to_devcgroup(css);
__dev_exception_clean(dev_cgroup);
kfree(dev_cgroup);
} | [
0,
0
] |
Linux Kernel | security/device_cgroup.c | static bool match_exception(struct list_head *exceptions, short type, u32 major,
u32 minor, short access) {
struct dev_exception_item *ex;
list_for_each_entry_rcu(ex, exceptions, list) {
if ((type & DEVCG_DEV_BLOCK) && !(ex->type & DEVCG_DEV_BLOCK))
continue;
if ((type & D... | [
1,
0
] |
Linux Kernel | security/device_cgroup.c | static void revalidate_active_exceptions(struct dev_cgroup *devcg) {
struct dev_exception_item *ex;
struct list_head *this, *tmp;
list_for_each_safe(this, tmp, &devcg->exceptions) {
ex = container_of(this, struct dev_exception_item, list);
if (!parent_has_perm(devcg, ex))
dev_exception_rm(devcg, ex... | [
0,
0
] |
Linux Kernel | security/device_cgroup.c |
static ssize_t devcgroup_access_write(struct kernfs_open_file *of, char *buf,
size_t nbytes, loff_t off) {
int retval;
mutex_lock(&devcgroup_mutex);
retval = devcgroup_update_access(css_to_devcgroup(of_css(of)),
of_cft(of)->private, strstr... | [
0,
0
] |
Linux Kernel | security/inode.c |
static void securityfs_free_inode(struct inode *inode) {
if (S_ISLNK(inode->i_mode))
kfree(inode->i_link);
free_inode_nonrcu(inode);
} | [
0,
0
] |
Linux Kernel | security/inode.c |
static int securityfs_get_tree(struct fs_context *fc) {
return get_tree_single(fc, securityfs_fill_super);
} | [
0,
0
] |
Linux Kernel | security/inode.c |
static int securityfs_init_fs_context(struct fs_context *fc) {
fc->ops = &securityfs_context_ops;
return 0;
} | [
0,
0
] |
Linux Kernel | security/inode.c | struct dentry *securityfs_create_file(const char *name, umode_t mode,
struct dentry *parent, void *data,
const struct file_operations *fops) {
return securityfs_create_dentry(name, mode, parent, data, fops, NULL);
} | [
0,
0
] |
Linux Kernel | security/inode.c | struct dentry *securityfs_create_dir(const char *name, struct dentry *parent) {
return securityfs_create_file(name, S_IFDIR | 0755, parent, NULL, NULL);
} | [
0,
0
] |
Linux Kernel | security/inode.c | static ssize_t lsm_read(struct file *filp, char __user *buf, size_t count,
loff_t *ppos) {
return simple_read_from_buffer(buf, count, ppos, lsm_names,
strlen(lsm_names));
} | [
0,
0
] |
Linux Kernel | security/inode.c |
static int __init securityfs_init(void) {
int retval;
retval = sysfs_create_mount_point(kernel_kobj, "security");
if (retval)
return retval;
retval = register_filesystem(&fs_type);
if (retval) {
sysfs_remove_mount_point(kernel_kobj, "security");
return retval;
}
#ifdef CONFIG_SECURITY
lsm_d... | [
0,
0
] |
Linux Kernel | security/integrity/digsig.c | int __init integrity_init_keyring(const unsigned int id) {
struct key_restriction *restriction;
key_perm_t perm;
int ret;
perm = (KEY_POS_ALL & ~KEY_POS_SETATTR) | KEY_USR_VIEW | KEY_USR_READ |
KEY_USR_SEARCH;
if (id == INTEGRITY_KEYRING_PLATFORM || id == INTEGRITY_KEYRING_MACHINE) {
restrictio... | [
0,
0
] |
Linux Kernel | security/integrity/digsig.c |
int __init integrity_load_x509(const unsigned int id, const char *path) {
void *data = NULL;
size_t size;
int rc;
key_perm_t perm;
rc = kernel_read_file_from_path(path, 0, &data, INT_MAX, NULL,
READING_X509_CERTIFICATE);
if (rc < 0) {
pr_err("Unable to open file: %s (... | [
0,
0
] |
Linux Kernel | security/integrity/digsig_asymmetric.c | static struct key *request_asymmetric_key(struct key *keyring, uint32_t keyid) {
struct key *key;
char name[12];
sprintf(name, "id:%08x", keyid);
pr_debug("key search: \"%s\"\n", name);
key = get_ima_blacklist_keyring();
if (key) {
key_ref_t kref;
kref =
keyring_search(make_key_ref(key, ... | [
1,
0
] |
Linux Kernel | security/integrity/digsig_asymmetric.c | int asymmetric_verify(struct key *keyring, const char *sig, int siglen,
const char *data, int datalen) {
struct public_key_signature pks;
struct signature_v2_hdr *hdr = (struct signature_v2_hdr *)sig;
const struct public_key *pk;
struct key *key;
int ret;
if (siglen <= sizeof(*hdr))
... | [
1,
0
] |
Linux Kernel | security/integrity/digsig_asymmetric.c | int integrity_kernel_module_request(char *kmod_name) {
if (strncmp(kmod_name, "crypto-pkcs1pad(rsa,", 20) == 0)
return -EINVAL;
return 0;
} | [
1,
0
] |
Linux Kernel | security/integrity/evm/evm_crypto.c | static void hmac_add_misc(struct shash_desc *desc, struct inode *inode,
char type, char *digest) {
struct h_misc {
unsigned long ino;
__u32 generation;
uid_t uid;
gid_t gid;
umode_t mode;
} hmac_misc;
memset(&hmac_misc, 0, sizeof(hmac_misc));
if (type != EVM_XATTR... | [
1,
0
] |
Linux Kernel | security/integrity/evm/evm_crypto.c | static int evm_is_immutable(struct dentry *dentry, struct inode *inode) {
const struct evm_ima_xattr_data *xattr_data = NULL;
struct integrity_iint_cache *iint;
int rc = 0;
iint = integrity_iint_find(inode);
if (iint && (iint->flags & EVM_IMMUTABLE_DIGSIG))
return 1;
rc = vfs_getxattr_alloc(&init_user... | [
1,
0
] |
Linux Kernel | security/integrity/evm/evm_crypto.c | int evm_update_evmxattr(struct dentry *dentry, const char *xattr_name,
const char *xattr_value, size_t xattr_value_len) {
struct inode *inode = d_backing_inode(dentry);
struct evm_digest data;
int rc = 0;
rc = evm_is_immutable(dentry, inode);
if (rc < 0)
return rc;
if (rc)
r... | [
1,
0
] |
Linux Kernel | security/integrity/evm/evm_crypto.c | int evm_init_key(void) {
struct key *evm_key;
struct encrypted_key_payload *ekp;
int rc;
evm_key = request_key(&key_type_encrypted, EVMKEY, NULL);
if (IS_ERR(evm_key))
return -ENOENT;
down_read(&evm_key->sem);
ekp = evm_key->payload.data[0];
rc = evm_set_key(ekp->decrypted_data, ekp->decrypted_da... | [
1,
0
] |
Linux Kernel | security/integrity/evm/evm_main.c | static int __init evm_set_fixmode(char *str) {
if (strncmp(str, "fix", 3) == 0)
evm_fixmode = 1;
else
pr_err("invalid \"%s\" mode", str);
return 1;
} | [
0,
0
] |
Linux Kernel | security/integrity/evm/evm_main.c |
static void __init evm_init_config(void) {
int i, xattrs;
xattrs = ARRAY_SIZE(evm_config_default_xattrnames);
pr_info("Initialising EVM extended attributes:\n");
for (i = 0; i < xattrs; i++) {
pr_info("%s%s\n", evm_config_default_xattrnames[i].name,
!evm_config_default_xattrnames[i].enabled ?... | [
0,
0
] |
Linux Kernel | security/integrity/evm/evm_main.c |
static bool evm_key_loaded(void) {
return (bool)(evm_initialized & EVM_KEY_MASK);
} | [
0,
0
] |
Linux Kernel | security/integrity/evm/evm_main.c | static bool evm_hmac_disabled(void) {
if (evm_initialized & EVM_INIT_HMAC)
return false;
if (!(evm_initialized & EVM_SETUP_COMPLETE))
return false;
return true;
} | [
0,
0
] |
Linux Kernel | security/integrity/evm/evm_main.c | int evm_read_protected_xattrs(struct dentry *dentry, u8 *buffer,
int buffer_size, char type, bool canonical_fmt) {
struct xattr_list *xattr;
int rc, size, total_size = 0;
list_for_each_entry_lockless(xattr, &evm_config_xattrnames, list) {
rc = __vfs_getxattr(dentry, d_backing_in... | [
1,
0
] |
Linux Kernel | security/integrity/evm/evm_main.c | static int evm_xattr_change(struct user_namespace *mnt_userns,
struct dentry *dentry, const char *xattr_name,
const void *xattr_value, size_t xattr_value_len) {
char *xattr_data = NULL;
int rc = 0;
rc = vfs_getxattr_alloc(&init_user_ns, dentry, xattr_name, ... | [
0,
0
] |
Linux Kernel | security/integrity/evm/evm_main.c | bool evm_revalidate_status(const char *xattr_name) {
if (!evm_key_loaded())
return false;
if (!xattr_name)
return true;
if (!evm_protected_xattr(xattr_name) && !posix_xattr_acl(xattr_name) &&
strcmp(xattr_name, XATTR_NAME_EVM))
return false;
return true;
} | [
0,
0
] |
Linux Kernel | security/integrity/evm/evm_main.c |
static int __init init_evm(void) {
int error;
struct list_head *pos, *q;
evm_init_config();
error = integrity_init_keyring(INTEGRITY_KEYRING_EVM);
if (error)
goto error;
error = evm_init_secfs();
if (error < 0) {
pr_info("Error registering secfs\n");
goto error;
}
error:
if (error != ... | [
0,
0
] |
Linux Kernel | security/integrity/evm/evm_secfs.c | static ssize_t evm_read_xattrs(struct file *filp, char __user *buf,
size_t count, loff_t *ppos) {
char *temp;
int offset = 0;
ssize_t rc, size = 0;
struct xattr_list *xattr;
if (*ppos != 0)
return 0;
rc = mutex_lock_interruptible(&xattr_list_mutex);
if (rc)
return ... | [
1,
0
] |
Linux Kernel | security/integrity/evm/evm_secfs.c |
static int evm_init_xattrs(void) {
evm_xattrs =
securityfs_create_file("evm_xattrs", 0660, evm_dir, NULL, &evm_xattr_ops);
if (!evm_xattrs || IS_ERR(evm_xattrs))
return -EFAULT;
return 0;
}
#else | [
0,
0
] |
Linux Kernel | security/integrity/evm/evm_secfs.c | static int evm_init_xattrs(void) { return 0; }
#endif | [
0,
0
] |
Linux Kernel | security/integrity/iint.c |
static void iint_free(struct integrity_iint_cache *iint) {
kfree(iint->ima_hash);
iint->ima_hash = NULL;
iint->version = 0;
iint->flags = 0UL;
iint->atomic_flags = 0UL;
iint->ima_file_status = INTEGRITY_UNKNOWN;
iint->ima_mmap_status = INTEGRITY_UNKNOWN;
iint->ima_bprm_status = INTEGRITY_UNKNOWN;
iin... | [
0,
0
] |
Linux Kernel | security/integrity/iint.c |
static int __init integrity_iintcache_init(void) {
iint_cache =
kmem_cache_create("iint_cache", sizeof(struct integrity_iint_cache), 0,
SLAB_PANIC, init_once);
return 0;
} | [
1,
0
] |
Linux Kernel | security/integrity/iint.c | int integrity_kernel_read(struct file *file, loff_t offset, void *addr,
unsigned long count) {
return __kernel_read(file, addr, count, &offset);
} | [
0,
0
] |
Linux Kernel | security/integrity/ima/ima.h | static inline void ima_process_queued_keys(void) {}
#endif | [
0,
0
] |
Linux Kernel | security/integrity/ima/ima.h |
static inline void ima_update_xattr(struct integrity_iint_cache *iint,
struct file *file) {} | [
0,
0
] |
Linux Kernel | security/integrity/ima/ima.h |
static inline enum integrity_status
ima_get_cache_status(struct integrity_iint_cache *iint, enum ima_hooks func) {
return INTEGRITY_UNKNOWN;
} | [
0,
0
] |
Linux Kernel | security/integrity/ima/ima.h | static inline int ima_read_modsig(enum ima_hooks func, const void *buf,
loff_t buf_len, struct modsig **modsig) {
return -EOPNOTSUPP;
} | [
0,
0
] |
Linux Kernel | security/integrity/ima/ima.h |
static inline void ima_collect_modsig(struct modsig *modsig, const void *buf,
loff_t size) {} | [
0,
0
] |
Linux Kernel | security/integrity/ima/ima_api.c | void ima_free_template_entry(struct ima_template_entry *entry) {
int i;
for (i = 0; i < entry->template_desc->num_fields; i++)
kfree(entry->template_data[i].data);
kfree(entry->digests);
kfree(entry);
} | [
1,
0
] |
Linux Kernel | security/integrity/ima/ima_api.c | int ima_store_template(struct ima_template_entry *entry, int violation,
struct inode *inode, const unsigned char *filename,
int pcr) {
static const char op[] = "add_template_measure";
static const char audit_cause[] = "hashing_error";
char *template_name = entry->temp... | [
0,
0
] |
Linux Kernel | security/integrity/ima/ima_api.c | static int ima_get_verity_digest(struct integrity_iint_cache *iint,
struct ima_max_digest_data *hash) {
enum hash_algo verity_alg;
int ret;
ret = fsverity_get_digest(iint->inode, hash->digest, &verity_alg);
if (ret)
return ret;
/*
* Unlike in the case of actually calc... | [
0,
0
] |
Linux Kernel | security/integrity/ima/ima_appraise.c | bool is_ima_appraise_enabled(void) {
return ima_appraise & IMA_APPRAISE_ENFORCE;
} | [
0,
0
] |
Linux Kernel | security/integrity/ima/ima_appraise.c | enum integrity_status ima_get_cache_status(struct integrity_iint_cache *iint,
enum ima_hooks func) {
switch (func) {
case MMAP_CHECK:
return iint->ima_mmap_status;
case BPRM_CHECK:
return iint->ima_bprm_status;
case CREDS_CHECK:
return iint->ima_creds_statu... | [
0,
0
] |
Linux Kernel | security/integrity/ima/ima_appraise.c | enum hash_algo ima_get_hash_algo(const struct evm_ima_xattr_data *xattr_value,
int xattr_len) {
struct signature_v2_hdr *sig;
enum hash_algo ret;
if (!xattr_value || xattr_len < 2)
return ima_hash_algo;
switch (xattr_value->type) {
case IMA_VERITY_DIGSIG:
sig = (typ... | [
1,
0
] |
Linux Kernel | security/integrity/ima/ima_appraise.c | void ima_inode_post_setattr(struct user_namespace *mnt_userns,
struct dentry *dentry) {
struct inode *inode = d_backing_inode(dentry);
struct integrity_iint_cache *iint;
int action;
if (!(ima_policy_flag & IMA_APPRAISE) || !S_ISREG(inode->i_mode) ||
!(inode->i_opflags & IOP_XA... | [
1,
0
] |
Linux Kernel | security/integrity/ima/ima_appraise.c |
int ima_inode_set_acl(struct user_namespace *mnt_userns, struct dentry *dentry,
const char *acl_name, struct posix_acl *kacl) {
if (evm_revalidate_status(acl_name))
ima_reset_appraise_flags(d_backing_inode(dentry), 0);
return 0;
} | [
0,
0
] |
Linux Kernel | security/integrity/ima/ima_crypto.c | static void ima_free_pages(void *ptr, size_t size) {
if (!ptr)
return;
free_pages((unsigned long)ptr, get_order(size));
} | [
0,
0
] |
Linux Kernel | security/integrity/ima/ima_crypto.c | static int ima_calc_file_hash_tfm(struct file *file,
struct ima_digest_data *hash,
struct crypto_shash *tfm) {
loff_t i_size, offset = 0;
char *rbuf;
int rc;
SHASH_DESC_ON_STACK(shash, tfm);
shash->tfm = tfm;
hash->length = crypto_shash_d... | [
0,
0
] |
Linux Kernel | security/integrity/ima/ima_crypto.c | static int calc_buffer_ahash_atfm(const void *buf, loff_t len,
struct ima_digest_data *hash,
struct crypto_ahash *tfm) {
struct ahash_request *req;
struct scatterlist sg;
struct crypto_wait wait;
int rc, ahash_rc = 0;
hash->length = crypto_a... | [
0,
0
] |
Linux Kernel | security/integrity/ima/ima_crypto.c |
int ima_calc_buffer_hash(const void *buf, loff_t len,
struct ima_digest_data *hash) {
int rc;
if (ima_ahash_minsize && len >= ima_ahash_minsize) {
rc = calc_buffer_ahash(buf, len, hash);
if (!rc)
return 0;
}
return calc_buffer_shash(buf, len, hash);
} | [
0,
0
] |
Linux Kernel | security/integrity/ima/ima_fs.c |
static void ima_measurements_stop(struct seq_file *m, void *v) {} | [
0,
0
] |
Linux Kernel | security/integrity/ima/ima_fs.c |
void ima_putc(struct seq_file *m, void *data, int datalen) {
while (datalen--)
seq_putc(m, *(char *)data++);
} | [
0,
0
] |
Linux Kernel | security/integrity/ima/ima_fs.c |
static int ima_measurements_open(struct inode *inode, struct file *file) {
return seq_open(file, &ima_measurments_seqops);
} | [
0,
0
] |
Linux Kernel | security/integrity/ima/ima_fs.c | static int ima_release_policy(struct inode *inode, struct file *file) {
const char *cause = valid_policy ? "completed" : "failed";
if ((file->f_flags & O_ACCMODE) == O_RDONLY)
return seq_release(inode, file);
if (valid_policy && ima_check_policy() < 0) {
cause = "failed";
valid_policy = 0;
}
pr... | [
0,
0
] |
Linux Kernel | security/integrity/ima/ima_fs.c |
int __init ima_fs_init(void) {
int ret;
ima_dir = securityfs_create_dir("ima", integrity_dir);
if (IS_ERR(ima_dir))
return PTR_ERR(ima_dir);
ima_symlink = securityfs_create_symlink("ima", NULL, "integrity/ima", NULL);
if (IS_ERR(ima_symlink)) {
ret = PTR_ERR(ima_symlink);
goto out;
}
binar... | [
0,
0
] |
Linux Kernel | security/integrity/ima/ima_main.c | void ima_post_create_tmpfile(struct user_namespace *mnt_userns,
struct inode *inode) {
struct integrity_iint_cache *iint;
int must_appraise;
if (!ima_policy_flag || !S_ISREG(inode->i_mode))
return;
must_appraise = ima_must_appraise(mnt_userns, inode, MAY_ACCESS, FILE_CHECK);
... | [
0,
0
] |
Linux Kernel | security/integrity/ima/ima_main.c | void ima_post_path_mknod(struct user_namespace *mnt_userns,
struct dentry *dentry) {
struct integrity_iint_cache *iint;
struct inode *inode = dentry->d_inode;
int must_appraise;
if (!ima_policy_flag || !S_ISREG(inode->i_mode))
return;
must_appraise = ima_must_appraise(mnt_userns... | [
0,
0
] |
Linux Kernel | security/integrity/ima/ima_main.c | int ima_post_read_file(struct file *file, void *buf, loff_t size,
enum kernel_read_file_id read_id) {
enum ima_hooks func;
u32 secid;
if (!file && read_id == READING_X509_CERTIFICATE)
return 0;
if (!file || !buf || size == 0) { /* should never happen */
if (ima_appraise & IMA_AP... | [
1,
0
] |
Linux Kernel | security/integrity/ima/ima_main.c | int ima_post_load_data(char *buf, loff_t size, enum kernel_load_data_id load_id,
char *description) {
if (load_id == LOADING_FIRMWARE) {
if ((ima_appraise & IMA_APPRAISE_FIRMWARE) &&
(ima_appraise & IMA_APPRAISE_ENFORCE)) {
pr_err("Prevent firmware loading_store.\n");
re... | [
0,
0
] |
Linux Kernel | security/integrity/ima/ima_main.c | void ima_kexec_cmdline(int kernel_fd, const void *buf, int size) {
struct fd f;
if (!buf || !size)
return;
f = fdget(kernel_fd);
if (!f.file)
return;
process_buffer_measurement(file_mnt_user_ns(f.file), file_inode(f.file), buf,
size, "kexec-cmdline", KEXEC_CMDLINE, 0, N... | [
0,
0
] |
Linux Kernel | security/integrity/ima/ima_main.c | int ima_measure_critical_data(const char *event_label, const char *event_name,
const void *buf, size_t buf_len, bool hash,
u8 *digest, size_t digest_len) {
if (!event_name || !event_label || !buf || !buf_len)
return -ENOPARAM;
return process_buffer_me... | [
0,
0
] |
Linux Kernel | security/integrity/ima/ima_modsig.c |
void ima_free_modsig(struct modsig *modsig) {
if (!modsig)
return;
pkcs7_free_message(modsig->pkcs7_msg);
kfree(modsig);
} | [
0,
0
] |
Linux Kernel | security/integrity/ima/ima_policy.c |
static int __init default_measure_policy_setup(char *str) {
if (ima_policy)
return 1;
ima_policy = ORIGINAL_TCB;
return 1;
} | [
0,
0
] |
Linux Kernel | security/integrity/ima/ima_policy.c | static struct ima_rule_opt_list *
ima_alloc_rule_opt_list(const substring_t *src) {
struct ima_rule_opt_list *opt_list;
size_t count = 0;
char *src_copy;
char *cur, *next;
size_t i;
src_copy = match_strdup(src);
if (!src_copy)
return ERR_PTR(-ENOMEM);
next = src_copy;
while ((cur = strsep(&next,... | [
0,
0
] |
Linux Kernel | security/integrity/ima/ima_policy.c | static int ima_lsm_update_rule(struct ima_rule_entry *entry) {
int i;
struct ima_rule_entry *nentry;
nentry = ima_lsm_copy_rule(entry);
if (!nentry)
return -ENOMEM;
list_replace_rcu(&entry->list, &nentry->list);
synchronize_rcu();
for (i = 0; i < MAX_LSM_RULES; i++)
ima_filter_rule_free(entry->... | [
0,
0
] |
Linux Kernel | security/integrity/ima/ima_policy.c | static void ima_lsm_update_rules(void) {
struct ima_rule_entry *entry, *e;
int result;
list_for_each_entry_safe(entry, e, &ima_policy_rules, list) {
if (!ima_rule_contains_lsm_cond(entry))
continue;
result = ima_lsm_update_rule(entry);
if (result) {
pr_err("lsm rule update error %d\n", r... | [
0,
0
] |
Linux Kernel | security/integrity/ima/ima_policy.c | static bool ima_match_rule_data(struct ima_rule_entry *rule,
const char *func_data,
const struct cred *cred) {
const struct ima_rule_opt_list *opt_list = NULL;
bool matched = false;
size_t i;
if ((rule->flags & IMA_UID) && !rule->uid_op(cred->uid,... | [
0,
0
] |
Linux Kernel | security/integrity/ima/ima_policy.c |
static void add_rules(struct ima_rule_entry *entries, int count,
enum policy_rule_list policy_rule) {
int i = 0;
for (i = 0; i < count; i++) {
struct ima_rule_entry *entry;
if (policy_rule & IMA_DEFAULT_POLICY)
list_add_tail(&entries[i].list, &ima_default_rules);
if (poli... | [
1,
0
] |
Linux Kernel | security/integrity/ima/ima_policy.c | int ima_check_policy(void) {
if (list_empty(&ima_temp_rules))
return -EINVAL;
return 0;
} | [
0,
0
] |
Linux Kernel | security/integrity/ima/ima_policy.c |
static int ima_lsm_rule_init(struct ima_rule_entry *entry, substring_t *args,
int lsm_rule, int audit_type) {
int result;
if (entry->lsm[lsm_rule].rule)
return -EINVAL;
entry->lsm[lsm_rule].args_p = match_strdup(args);
if (!entry->lsm[lsm_rule].args_p)
return -ENOMEM;
... | [
0,
0
] |
Linux Kernel | security/integrity/ima/ima_policy.c | static void check_template_field(const struct ima_template_desc *template,
const char *field, const char *msg) {
int i;
for (i = 0; i < template->num_fields; i++)
if (!strcmp(template->fields[i]->field_id, field))
return;
pr_notice_once("%s", msg);
} | [
0,
0
] |
Linux Kernel | security/integrity/ima/ima_policy.c |
void *ima_policy_start(struct seq_file *m, loff_t *pos) {
loff_t l = *pos;
struct ima_rule_entry *entry;
struct list_head *ima_rules_tmp;
rcu_read_lock();
ima_rules_tmp = rcu_dereference(ima_rules);
list_for_each_entry_rcu(entry, ima_rules_tmp, list) {
if (!l--) {
rcu_read_unlock();
return... | [
0,
0
] |
Linux Kernel | security/integrity/ima/ima_policy.c |
void *ima_policy_next(struct seq_file *m, void *v, loff_t *pos) {
struct ima_rule_entry *entry = v;
rcu_read_lock();
entry = list_entry_rcu(entry->list.next, struct ima_rule_entry, list);
rcu_read_unlock();
(*pos)++;
return (&entry->list == &ima_default_rules ||
&entry->list == &ima_policy_rule... | [
0,
0
] |
Linux Kernel | security/integrity/ima/ima_policy.c | static void policy_func_show(struct seq_file *m, enum ima_hooks func) {
if (func > 0 && func < MAX_CHECK)
seq_printf(m, "func=%s ", func_tokens[func]);
else
seq_printf(m, "func=%d ", func);
} | [
1,
0
] |
Linux Kernel | security/integrity/ima/ima_policy.c |
static void ima_show_rule_opt_list(struct seq_file *m,
const struct ima_rule_opt_list *opt_list) {
size_t i;
for (i = 0; i < opt_list->count; i++)
seq_printf(m, "%s%s", i ? "|" : "", opt_list->items[i]);
} | [
1,
0
] |
Linux Kernel | security/integrity/ima/ima_policy.c | static void ima_policy_show_appraise_algos(struct seq_file *m,
unsigned int allowed_hashes) {
int idx, list_size = 0;
for (idx = 0; idx < HASH_ALGO__LAST; idx++) {
if (!(allowed_hashes & (1U << idx)))
continue;
if (list_size++)
seq_puts(m, ",");
... | [
0,
0
] |
Linux Kernel | security/integrity/ima/ima_policy.c | bool ima_appraise_signature(enum kernel_read_file_id id) {
struct ima_rule_entry *entry;
bool found = false;
enum ima_hooks func;
struct list_head *ima_rules_tmp;
if (id >= READING_MAX_ID)
return false;
if (id == READING_KEXEC_IMAGE && !(ima_appraise & IMA_APPRAISE_ENFORCE) &&
security_locked_do... | [
1,
0
] |
Linux Kernel | security/integrity/ima/ima_queue.c | static int ima_add_digest_entry(struct ima_template_entry *entry,
bool update_htable) {
struct ima_queue_entry *qe;
unsigned int key;
qe = kmalloc(sizeof(*qe), GFP_KERNEL);
if (qe == NULL) {
pr_err("OUT OF MEMORY ERROR creating queue entry\n");
return -ENOMEM;
}
qe->... | [
0,
0
] |
Linux Kernel | security/integrity/ima/ima_queue.c |
int ima_restore_measurement_entry(struct ima_template_entry *entry) {
int result = 0;
mutex_lock(&ima_extend_list_mutex);
result = ima_add_digest_entry(entry, 0);
mutex_unlock(&ima_extend_list_mutex);
return result;
} | [
0,
0
] |
Linux Kernel | security/integrity/ima/ima_queue_keys.c | static void ima_keys_handler(struct work_struct *work) {
timer_expired = true;
ima_process_queued_keys();
} | [
0,
0
] |
Linux Kernel | security/integrity/ima/ima_queue_keys.c |
static void ima_free_key_entry(struct ima_key_entry *entry) {
if (entry) {
kfree(entry->payload);
kfree(entry->keyring_name);
kfree(entry);
}
} | [
0,
0
] |
Linux Kernel | security/integrity/ima/ima_queue_keys.c |
inline bool ima_should_queue_key(void) { return !ima_process_keys; } | [
0,
0
] |
Linux Kernel | security/integrity/ima/ima_template.c |
struct ima_template_desc *lookup_template_desc(const char *name) {
struct ima_template_desc *template_desc;
int found = 0;
rcu_read_lock();
list_for_each_entry_rcu(template_desc, &defined_templates, list) {
if ((strcmp(template_desc->name, name) == 0) ||
(strcmp(template_desc->fmt, name) == 0)) {
... | [
0,
0
] |
Linux Kernel | security/integrity/ima/ima_template.c |
struct ima_template_desc *ima_template_desc_current(void) {
if (!ima_template) {
ima_init_template_list();
ima_template = lookup_template_desc(CONFIG_IMA_DEFAULT_TEMPLATE);
}
return ima_template;
} | [
0,
0
] |
Linux Kernel | security/integrity/ima/ima_template.c |
int __init ima_init_template(void) {
struct ima_template_desc *template = ima_template_desc_current();
int result;
result = template_desc_init_fields(template->fmt, &(template->fields),
&(template->num_fields));
if (result < 0) {
pr_err("template %s init failed, result... | [
0,
0
] |
Linux Kernel | security/integrity/ima/ima_template.c |
static int ima_restore_template_data(struct ima_template_desc *template_desc,
void *template_data,
int template_data_size,
struct ima_template_entry **entry) {
struct tpm_digest *digests;
int ret = 0;
i... | [
1,
0
] |
Linux Kernel | security/integrity/ima/ima_template_lib.c |
void ima_show_template_sig(struct seq_file *m, enum ima_show_type show,
struct ima_field_data *field_data) {
ima_show_template_field_data(m, show, DATA_FMT_HEX, field_data);
} | [
0,
0
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.