-
Notifications
You must be signed in to change notification settings - Fork 582
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
sandbox/apparmor: do not skip ABI 4.0 from host parser #14167
sandbox/apparmor: do not skip ABI 4.0 from host parser #14167
Conversation
6853098
to
ddfcb2d
Compare
ddfcb2d
to
82d73c9
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks
Consider for 2.64 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR #14150 already introduced support for ABI 4.0 when using the internal copy of the apparmor_parser. It looks appropriate to the same when using the host parser.
LGTM, thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM - thanks for this @zyga!
The state of AppArmor 4 in Ubuntu 24.04 and 24.10 is now sufficient for using in snapd. The recently-added version-aware feature check guarantee that features such as mqueue are not used when the parser is not sufficiently up-to-date. Signed-off-by: Zygmunt Krynicki <[email protected]>
82d73c9
to
0cf5d26
Compare
I've rebased on master to give tests a chance to pass. |
The state of AppArmor 4 in Ubuntu 24.04 and 24.10 is now sufficient for using in snapd. The recently-added version-aware feature check guarantee that features such as mqueue are not used when the parser is not sufficiently up-to-date. Signed-off-by: Zygmunt Krynicki <[email protected]>
…ical#14167)" This reverts commit fa03549. We cannot use host AppArmor with 4.0 ABI as there's no control mechanism to shield us from broken implementation of mqueue mediation class. We look for the right version of apparmor parser and correctly not emit the mqueue permission but since the host parser (4.0.0~beta3) looks at host's ABI file which contains: ipc {posix_mqueue {create read write open delete setattr getattr} And similarly the kernel supports posix_mqueue, then the parser (with the bug or without the bug) will correctly not emit anything related to mqueue mediation class, causing the kernel to rightfully deny operations: [Mon Jul 22 12:43:40 2024] audit: type=1400 audit(1721652220.385:212): apparmor="DENIED" operation="unlink" class="posix_mqueue" profile="snap.docker.dockerd" name="/" pid=35290 comm="runc:[2:INIT]" requested="getattr" denied="getattr"class="posix_mqueue" fsuid=0 ouid=0 As such we need to do one of two things to allow host apparmor to be used in a world with re-executing snapd: - Create our own ABI feature files that understand broken features and mask them, so that from the point of view of the kernel mqueue is _not_ mediated by the binary profile. - Detect presence of 4.0 ABI but ignore it on known-broken parser versions, effectively doing the same thing as the earlier approach but without creating a new ABI file that only snapd uses (possibly experiencing fewer bugs). Signed-off-by: Zygmunt Krynicki <[email protected]>
…ical#14167)" This reverts commit fa03549. We cannot use host AppArmor with 4.0 ABI as there's no control mechanism to shield us from broken implementation of mqueue mediation class. We look for the right version of apparmor parser and correctly not emit the mqueue permission but since the host parser (4.0.0~beta3) looks at host's ABI file which contains: ipc {posix_mqueue {create read write open delete setattr getattr} And similarly the kernel supports posix_mqueue, then the parser (with the bug or without the bug) will correctly not emit any permissions related to mqueue mediation class, while emitting the mediation class root element, causing the kernel to rightfully deny operations: [Mon Jul 22 12:43:40 2024] audit: type=1400 audit(1721652220.385:212): apparmor="DENIED" operation="unlink" class="posix_mqueue" profile="snap.docker.dockerd" name="/" pid=35290 comm="runc:[2:INIT]" requested="getattr" denied="getattr"class="posix_mqueue" fsuid=0 ouid=0 As such we need to do one of two things to allow host apparmor to be used in a world with re-executing snapd: - Create our own ABI feature files that understand broken features and mask them, so that from the point of view of the kernel mqueue is _not_ mediated by the binary profile. - Detect presence of 4.0 ABI but ignore it on known-broken parser versions, effectively doing the same thing as the earlier approach but without creating a new ABI file that only snapd uses (possibly experiencing fewer bugs). Signed-off-by: Zygmunt Krynicki <[email protected]>
This was reverted, there are issues: #14223 |
…" (#14223) This reverts commit fa03549. We cannot use host AppArmor with 4.0 ABI as there's no control mechanism to shield us from broken implementation of mqueue mediation class. We look for the right version of apparmor parser and correctly not emit the mqueue permission but since the host parser (4.0.0~beta3) looks at host's ABI file which contains: ipc {posix_mqueue {create read write open delete setattr getattr} And similarly the kernel supports posix_mqueue, then the parser (with the bug or without the bug) will correctly not emit any permissions related to mqueue mediation class, while emitting the mediation class root element, causing the kernel to rightfully deny operations: [Mon Jul 22 12:43:40 2024] audit: type=1400 audit(1721652220.385:212): apparmor="DENIED" operation="unlink" class="posix_mqueue" profile="snap.docker.dockerd" name="/" pid=35290 comm="runc:[2:INIT]" requested="getattr" denied="getattr"class="posix_mqueue" fsuid=0 ouid=0 As such we need to do one of two things to allow host apparmor to be used in a world with re-executing snapd: - Create our own ABI feature files that understand broken features and mask them, so that from the point of view of the kernel mqueue is _not_ mediated by the binary profile. - Detect presence of 4.0 ABI but ignore it on known-broken parser versions, effectively doing the same thing as the earlier approach but without creating a new ABI file that only snapd uses (possibly experiencing fewer bugs). Signed-off-by: Zygmunt Krynicki <[email protected]>
The state of AppArmor 4 in Ubuntu 24.04 and 24.10 is now sufficient for
using in snapd. The recently-added version-aware feature check guarantee
that features such as mqueue are not used when the parser is not
sufficiently up-to-date.