apparmor: fix regression in fs based unix sockets when using old abi
authorJohn Johansen <john.johansen@canonical.com>
Wed, 4 Jun 2025 08:45:05 +0000 (01:45 -0700)
committerJohn Johansen <john.johansen@canonical.com>
Wed, 16 Jul 2025 05:39:43 +0000 (22:39 -0700)
commit6456ccbd2ff72814b3c1b2e2a3a2145a2ced858d
tree535c472fed51977ec1c610e00d361f72c03f7ba6
parent50d56a1a366a3a5e7e41d9efff1a5e4ee7bf98a7
apparmor: fix regression in fs based unix sockets when using old abi

Policy loaded using abi 7 socket mediation was not being applied
correctly in all cases. In some cases with fs based unix sockets a
subset of permissions where allowed when they should have been denied.

This was happening because the check for if the socket was an fs based
unix socket came before the abi check. But the abi check is where the
correct path is selected, so having the fs unix socket check occur
early would cause the wrong code path to be used.

Fix this by pushing the fs unix to be done after the abi check.

Fixes: dcd7a559411e ("apparmor: gate make fine grained unix mediation behind v9 abi")
Signed-off-by: John Johansen <john.johansen@canonical.com>
security/apparmor/af_unix.c
security/apparmor/include/af_unix.h