]> Gentwo Git Trees - linux/.git/commit
smack: fix bug: unprivileged task can create labels
authorKonstantin Andreev <andreev@swemel.ru>
Mon, 16 Jun 2025 21:32:16 +0000 (00:32 +0300)
committerCasey Schaufler <casey@schaufler-ca.com>
Tue, 24 Jun 2025 23:30:24 +0000 (16:30 -0700)
commitc147e13ea7fe9f118f8c9ba5e96cbd644b00d6b3
tree7aa1a47693dda41f17209284a5bd56ab6def1152
parent78fc6a94be252b27bb73e4926eed70b5e302a8e0
smack: fix bug: unprivileged task can create labels

If an unprivileged task is allowed to relabel itself
(/smack/relabel-self is not empty),
it can freely create new labels by writing their
names into own /proc/PID/attr/smack/current

This occurs because do_setattr() imports
the provided label in advance,
before checking "relabel-self" list.

This change ensures that the "relabel-self" list
is checked before importing the label.

Fixes: 38416e53936e ("Smack: limited capability for changing process label")
Signed-off-by: Konstantin Andreev <andreev@swemel.ru>
Signed-off-by: Casey Schaufler <casey@schaufler-ca.com>
security/smack/smack_lsm.c