build: add stacked-dbus builder

Resolve peer label variable in dbus rules. It create a full dbus rule by item in a variable when it is used a peer label.

For ubuntu with apparmor 4.1+

See https://gitlab.com/apparmor/apparmor/-/issues/537#note_2699570190
This commit is contained in:
Alexandre Pujol 2025-08-24 23:30:54 +02:00
parent 107820975d
commit 7aae9f0dd7
No known key found for this signature in database
GPG key ID: C5469996F0DF68EC
2 changed files with 116 additions and 7 deletions

View file

@ -108,16 +108,20 @@ func Configure() {
case 3:
builder.Register("abi3") // Convert all profiles from abi 4.0 to abi 3.0
case 4:
// Re-attach disconnected path, ignored on ubuntu 25.04+ due to a memory leak
// that fully prevent profiles compilation with re-attached paths.
// See https://bugs.launchpad.net/ubuntu/+source/linux/+bug/2098730
if prebuild.Distribution != "ubuntu" {
builder.Register("attach")
prepare.Register("attach")
} else if prebuild.Release["VERSION_CODENAME"] == "noble" {
// Re-attach disconnected path
if prebuild.Distribution == "ubuntu" && prebuild.Version >= 4.1 {
// Ignored on ubuntu 25.04+ due to a memory leak that fully prevent
// profiles compilation with re-attached paths.
// See https://bugs.launchpad.net/ubuntu/+source/linux/+bug/2098730
// Use stacked-dbus builder to resolve dbus rules
builder.Register("stacked-dbus")
} else {
builder.Register("attach")
prepare.Register("attach")
}
default:
logging.Fatal("Invalid ABI version: %d", prebuild.ABI)
}