diff options
| author | Stephen Smalley <stephen.smalley.work@gmail.com> | 2026-05-13 14:05:06 -0400 |
|---|---|---|
| committer | Paul Moore <paul@paul-moore.com> | 2026-05-14 16:47:59 -0400 |
| commit | 4a9b16541ad3faf8bccb398532bf3f8b6bbf1188 (patch) | |
| tree | c8f110c5cb7f1e0acaba821b9fe23b4d50a84e16 /security | |
| parent | 254f49634ee16a731174d2ae34bc50bd5f45e731 (diff) | |
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: stable@vger.kernel.org
Signed-off-by: Stephen Smalley <stephen.smalley.work@gmail.com>
Acked-by: Casey Schaufler <casey@schaufler-ca.com>
Signed-off-by: Paul Moore <paul@paul-moore.com>
Diffstat (limited to 'security')
| -rw-r--r-- | security/lsm_syscalls.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/security/lsm_syscalls.c b/security/lsm_syscalls.c index 5648b1f0ce9c..08a017669c02 100644 --- a/security/lsm_syscalls.c +++ b/security/lsm_syscalls.c @@ -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; } /** |
