]> 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 13:02:25 +0000 (14:02 +0100)
commit60e8d49989410a7ade60f5dadfcd979c117d05c0
tree292a312b3710d6d8053f08cf6cbc3de319e5681f
parent70c5be42f691fb6b46084bdf42e191cab0e9dde7
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