Skip to content

Commit a7ae364

Browse files
committed
apparmor: add the ability to get a task's secid
Signed-off-by: John Johansen <john.johansen@canonical.com>
1 parent c092921 commit a7ae364

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

‎security/apparmor/lsm.c‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -711,6 +711,13 @@ static void apparmor_bprm_committed_creds(struct linux_binprm *bprm)
711711
return;
712712
}
713713

714+
static void apparmor_task_getsecid(struct task_struct *p, u32 *secid)
715+
{
716+
struct aa_label *label = aa_get_task_label(p);
717+
*secid = label->secid;
718+
aa_put_label(label);
719+
}
720+
714721
static int apparmor_task_setrlimit(struct task_struct *task,
715722
unsigned int resource, struct rlimit *new_rlim)
716723
{
@@ -1187,6 +1194,7 @@ static struct security_hook_list apparmor_hooks[] __lsm_ro_after_init = {
11871194

11881195
LSM_HOOK_INIT(task_free, apparmor_task_free),
11891196
LSM_HOOK_INIT(task_alloc, apparmor_task_alloc),
1197+
LSM_HOOK_INIT(task_getsecid, apparmor_task_getsecid),
11901198
LSM_HOOK_INIT(task_setrlimit, apparmor_task_setrlimit),
11911199
LSM_HOOK_INIT(task_kill, apparmor_task_kill),
11921200

0 commit comments

Comments
 (0)