]> git.baikalelectronics.ru Git - kernel.git/commit
apparmor: fix absroot causing audited secids to begin with =
authorJohn Johansen <john.johansen@canonical.com>
Tue, 14 Dec 2021 10:59:28 +0000 (02:59 -0800)
committerJohn Johansen <john.johansen@canonical.com>
Sat, 9 Jul 2022 22:13:58 +0000 (15:13 -0700)
commitc823f720f5eca96a3e97f3b53b9b3408453892f4
treec1cd6fe111e410c1ccaef997c748074a1c87becf
parentf040cca4b0da0180bf9de9141ef5c95f60f85182
apparmor: fix absroot causing audited secids to begin with =

AppArmor is prefixing secids that are converted to secctx with the =
to indicate the secctx should only be parsed from an absolute root
POV. This allows catching errors where secctx are reparsed back into
internal labels.

Unfortunately because audit is using secid to secctx conversion this
means that subject and object labels can result in a very unfortunate
== that can break audit parsing.

eg. the subj==unconfined term in the below audit message

type=USER_LOGIN msg=audit(1639443365.233:160): pid=1633 uid=0 auid=1000
ses=3 subj==unconfined msg='op=login id=1000 exe="/usr/sbin/sshd"
hostname=192.168.122.1 addr=192.168.122.1 terminal=/dev/pts/1 res=success'

Fix this by switch the prepending of = to a _. This still works as a
special character to flag this case without breaking audit. Also move
this check behind debug as it should not be needed during normal
operqation.

Fixes: d2e43ca03cb5 ("apparmor: add support for absolute root view based labels")
Reported-by: Casey Schaufler <casey@schaufler-ca.com>
Signed-off-by: John Johansen <john.johansen@canonical.com>
security/apparmor/include/lib.h
security/apparmor/label.c