mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/xiang/erofs.git
synced 2026-10-28 04:45:43 +01:00
lsm: hold cred_guard_mutex for lsm_set_self_attr()
Just as proc_pid_attr_write() already does before calling the LSM hook. This only matters for SELinux and AppArmor which check whether the process is being ptraced and if so, whether to allow the transition. Cc: [email protected] Signed-off-by: Stephen Smalley <[email protected]> Acked-by: Casey Schaufler <[email protected]> Signed-off-by: Paul Moore <[email protected]>
This commit is contained in:
1 parent
254f49634e
commit
4a9b16541a
1 file changed
+8
-1
@@ -57,7 +57,14 @@ u64 lsm_name_to_attr(const char *name)
|
||||
SYSCALL_DEFINE4(lsm_set_self_attr, unsigned int, attr, struct lsm_ctx __user *,
|
||||
ctx, u32, size, u32, flags)
|
||||
{
|
||||
return security_setselfattr(attr, ctx, size, flags);
|
||||
int rc;
|
||||
|
||||
rc = mutex_lock_interruptible(¤t->signal->cred_guard_mutex);
|
||||
if (rc < 0)
|
||||
return rc;
|
||||
rc = security_setselfattr(attr, ctx, size, flags);
|
||||
mutex_unlock(¤t->signal->cred_guard_mutex);
|
||||
return rc;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in new issue
Block a user