]> git.ipfire.org Git - thirdparty/kernel/stable.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)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 18 Dec 2025 12:54:39 +0000 (13:54 +0100)
commitac9fce2efabad37c338aac86fbe100f77a080e59
tree10ba58e831cb674878328c963f1ff5ae268d9baa
parentb68902daf099433ad1034b4a0eb9eefa00b2ffa9
smack: fix bug: unprivileged task can create labels

[ Upstream commit c147e13ea7fe9f118f8c9ba5e96cbd644b00d6b3 ]

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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
security/smack/smack_lsm.c