[neon/neon/livecd-rootfs/Neon/release] live-build: fix: bind correct apparmor feature for validating snap seed
Jess Jang
null at kde.org
Thu Aug 31 06:27:09 BST 2023
Git commit 6b54faa6be6286017eb2dc701534cf780ae462ce by Jess Jang.
Committed on 03/08/2023 at 05:37.
Pushed by carlosdem into branch 'Neon/release'.
fix: bind correct apparmor feature for validating snap seed
During Realtime kernel image build, there was an error during
validating snap seed which derivative images copied 5.19
apparmor feature and can't validate when Realtime kernel (5.15)
installed [0].
To prevent this, bind correct apparmor feature with kernel
version.
[0] https://bugs.launchpad.net/ubuntu/+source/livecd-rootfs/+bug/2024639
A +1 -0 live-build/apparmor/5.19/capability
A +1 -0 live-build/apparmor/5.19/caps/mask
A +1 -0 live-build/apparmor/5.19/dbus/mask
A +1 -0 live-build/apparmor/5.19/domain/attach_conditions/xattr
A +1 -0 live-build/apparmor/5.19/domain/change_hat
A +1 -0 live-build/apparmor/5.19/domain/change_hatv
A +1 -0 live-build/apparmor/5.19/domain/change_onexec
A +1 -0 live-build/apparmor/5.19/domain/change_profile
A +1 -0 live-build/apparmor/5.19/domain/computed_longest_left
A +1 -0 live-build/apparmor/5.19/domain/fix_binfmt_elf_mmap
A +1 -0 live-build/apparmor/5.19/domain/post_nnp_subset
A +1 -0 live-build/apparmor/5.19/domain/stack
A +1 -0 live-build/apparmor/5.19/domain/version
A +1 -0 live-build/apparmor/5.19/file/mask
A +1 -0 live-build/apparmor/5.19/mount/mask
A +1 -0 live-build/apparmor/5.19/namespaces/pivot_root
A +1 -0 live-build/apparmor/5.19/namespaces/profile
A +1 -0 live-build/apparmor/5.19/network/af_mask
A +1 -0 live-build/apparmor/5.19/network/af_unix
A +1 -0 live-build/apparmor/5.19/network_v8/af_mask
A +1 -0 live-build/apparmor/5.19/policy/set_load
A +1 -0 live-build/apparmor/5.19/policy/versions/v5
A +1 -0 live-build/apparmor/5.19/policy/versions/v6
A +1 -0 live-build/apparmor/5.19/policy/versions/v7
A +1 -0 live-build/apparmor/5.19/policy/versions/v8
A +1 -0 live-build/apparmor/5.19/ptrace/mask
A +1 -0 live-build/apparmor/5.19/query/label/data
A +1 -0 live-build/apparmor/5.19/query/label/multi_transaction
A +1 -0 live-build/apparmor/5.19/query/label/perms
A +1 -0 live-build/apparmor/5.19/rlimit/mask
A +1 -0 live-build/apparmor/5.19/signal/mask
M +12 -1 live-build/functions
https://invent.kde.org/neon/neon/livecd-rootfs/-/commit/6b54faa6be6286017eb2dc701534cf780ae462ce
diff --git a/live-build/apparmor/5.19/capability b/live-build/apparmor/5.19/capability
new file mode 100644
index 00000000..96a10b97
--- /dev/null
+++ b/live-build/apparmor/5.19/capability
@@ -0,0 +1 @@
+0xffffff
diff --git a/live-build/apparmor/5.19/caps/mask b/live-build/apparmor/5.19/caps/mask
new file mode 100644
index 00000000..1a8d13ec
--- /dev/null
+++ b/live-build/apparmor/5.19/caps/mask
@@ -0,0 +1 @@
+chown dac_override dac_read_search fowner fsetid kill setgid setuid setpcap linux_immutable net_bind_service net_broadcast net_admin net_raw ipc_lock ipc_owner sys_module sys_rawio sys_chroot sys_ptrace sys_pacct sys_admin sys_boot sys_nice sys_resource sys_time sys_tty_config mknod lease audit_write audit_control setfcap mac_override mac_admin syslog wake_alarm block_suspend audit_read
diff --git a/live-build/apparmor/5.19/dbus/mask b/live-build/apparmor/5.19/dbus/mask
new file mode 100644
index 00000000..1248078e
--- /dev/null
+++ b/live-build/apparmor/5.19/dbus/mask
@@ -0,0 +1 @@
+acquire send receive
diff --git a/live-build/apparmor/5.19/domain/attach_conditions/xattr b/live-build/apparmor/5.19/domain/attach_conditions/xattr
new file mode 100644
index 00000000..7cfab5b0
--- /dev/null
+++ b/live-build/apparmor/5.19/domain/attach_conditions/xattr
@@ -0,0 +1 @@
+yes
diff --git a/live-build/apparmor/5.19/domain/change_hat b/live-build/apparmor/5.19/domain/change_hat
new file mode 100644
index 00000000..7cfab5b0
--- /dev/null
+++ b/live-build/apparmor/5.19/domain/change_hat
@@ -0,0 +1 @@
+yes
diff --git a/live-build/apparmor/5.19/domain/change_hatv b/live-build/apparmor/5.19/domain/change_hatv
new file mode 100644
index 00000000..7cfab5b0
--- /dev/null
+++ b/live-build/apparmor/5.19/domain/change_hatv
@@ -0,0 +1 @@
+yes
diff --git a/live-build/apparmor/5.19/domain/change_onexec b/live-build/apparmor/5.19/domain/change_onexec
new file mode 100644
index 00000000..7cfab5b0
--- /dev/null
+++ b/live-build/apparmor/5.19/domain/change_onexec
@@ -0,0 +1 @@
+yes
diff --git a/live-build/apparmor/5.19/domain/change_profile b/live-build/apparmor/5.19/domain/change_profile
new file mode 100644
index 00000000..7cfab5b0
--- /dev/null
+++ b/live-build/apparmor/5.19/domain/change_profile
@@ -0,0 +1 @@
+yes
diff --git a/live-build/apparmor/5.19/domain/computed_longest_left b/live-build/apparmor/5.19/domain/computed_longest_left
new file mode 100644
index 00000000..7cfab5b0
--- /dev/null
+++ b/live-build/apparmor/5.19/domain/computed_longest_left
@@ -0,0 +1 @@
+yes
diff --git a/live-build/apparmor/5.19/domain/fix_binfmt_elf_mmap b/live-build/apparmor/5.19/domain/fix_binfmt_elf_mmap
new file mode 100644
index 00000000..7cfab5b0
--- /dev/null
+++ b/live-build/apparmor/5.19/domain/fix_binfmt_elf_mmap
@@ -0,0 +1 @@
+yes
diff --git a/live-build/apparmor/5.19/domain/post_nnp_subset b/live-build/apparmor/5.19/domain/post_nnp_subset
new file mode 100644
index 00000000..7cfab5b0
--- /dev/null
+++ b/live-build/apparmor/5.19/domain/post_nnp_subset
@@ -0,0 +1 @@
+yes
diff --git a/live-build/apparmor/5.19/domain/stack b/live-build/apparmor/5.19/domain/stack
new file mode 100644
index 00000000..7cfab5b0
--- /dev/null
+++ b/live-build/apparmor/5.19/domain/stack
@@ -0,0 +1 @@
+yes
diff --git a/live-build/apparmor/5.19/domain/version b/live-build/apparmor/5.19/domain/version
new file mode 100644
index 00000000..5625e59d
--- /dev/null
+++ b/live-build/apparmor/5.19/domain/version
@@ -0,0 +1 @@
+1.2
diff --git a/live-build/apparmor/5.19/file/mask b/live-build/apparmor/5.19/file/mask
new file mode 100644
index 00000000..087b6771
--- /dev/null
+++ b/live-build/apparmor/5.19/file/mask
@@ -0,0 +1 @@
+create read write exec append mmap_exec link lock
diff --git a/live-build/apparmor/5.19/mount/mask b/live-build/apparmor/5.19/mount/mask
new file mode 100644
index 00000000..652c8796
--- /dev/null
+++ b/live-build/apparmor/5.19/mount/mask
@@ -0,0 +1 @@
+mount umount pivot_root
diff --git a/live-build/apparmor/5.19/namespaces/pivot_root b/live-build/apparmor/5.19/namespaces/pivot_root
new file mode 100644
index 00000000..7ecb56eb
--- /dev/null
+++ b/live-build/apparmor/5.19/namespaces/pivot_root
@@ -0,0 +1 @@
+no
diff --git a/live-build/apparmor/5.19/namespaces/profile b/live-build/apparmor/5.19/namespaces/profile
new file mode 100644
index 00000000..7cfab5b0
--- /dev/null
+++ b/live-build/apparmor/5.19/namespaces/profile
@@ -0,0 +1 @@
+yes
diff --git a/live-build/apparmor/5.19/network/af_mask b/live-build/apparmor/5.19/network/af_mask
new file mode 100644
index 00000000..503289e7
--- /dev/null
+++ b/live-build/apparmor/5.19/network/af_mask
@@ -0,0 +1 @@
+unspec unix inet ax25 ipx appletalk netrom bridge atmpvc x25 inet6 rose netbeui security key netlink packet ash econet atmsvc rds sna irda pppox wanpipe llc ib mpls can tipc bluetooth iucv rxrpc isdn phonet ieee802154 caif alg nfc vsock kcm qipcrtr smc xdp
diff --git a/live-build/apparmor/5.19/network/af_unix b/live-build/apparmor/5.19/network/af_unix
new file mode 100644
index 00000000..7cfab5b0
--- /dev/null
+++ b/live-build/apparmor/5.19/network/af_unix
@@ -0,0 +1 @@
+yes
diff --git a/live-build/apparmor/5.19/network_v8/af_mask b/live-build/apparmor/5.19/network_v8/af_mask
new file mode 100644
index 00000000..503289e7
--- /dev/null
+++ b/live-build/apparmor/5.19/network_v8/af_mask
@@ -0,0 +1 @@
+unspec unix inet ax25 ipx appletalk netrom bridge atmpvc x25 inet6 rose netbeui security key netlink packet ash econet atmsvc rds sna irda pppox wanpipe llc ib mpls can tipc bluetooth iucv rxrpc isdn phonet ieee802154 caif alg nfc vsock kcm qipcrtr smc xdp
diff --git a/live-build/apparmor/5.19/policy/set_load b/live-build/apparmor/5.19/policy/set_load
new file mode 100644
index 00000000..7cfab5b0
--- /dev/null
+++ b/live-build/apparmor/5.19/policy/set_load
@@ -0,0 +1 @@
+yes
diff --git a/live-build/apparmor/5.19/policy/versions/v5 b/live-build/apparmor/5.19/policy/versions/v5
new file mode 100644
index 00000000..7cfab5b0
--- /dev/null
+++ b/live-build/apparmor/5.19/policy/versions/v5
@@ -0,0 +1 @@
+yes
diff --git a/live-build/apparmor/5.19/policy/versions/v6 b/live-build/apparmor/5.19/policy/versions/v6
new file mode 100644
index 00000000..7cfab5b0
--- /dev/null
+++ b/live-build/apparmor/5.19/policy/versions/v6
@@ -0,0 +1 @@
+yes
diff --git a/live-build/apparmor/5.19/policy/versions/v7 b/live-build/apparmor/5.19/policy/versions/v7
new file mode 100644
index 00000000..7cfab5b0
--- /dev/null
+++ b/live-build/apparmor/5.19/policy/versions/v7
@@ -0,0 +1 @@
+yes
diff --git a/live-build/apparmor/5.19/policy/versions/v8 b/live-build/apparmor/5.19/policy/versions/v8
new file mode 100644
index 00000000..7cfab5b0
--- /dev/null
+++ b/live-build/apparmor/5.19/policy/versions/v8
@@ -0,0 +1 @@
+yes
diff --git a/live-build/apparmor/5.19/ptrace/mask b/live-build/apparmor/5.19/ptrace/mask
new file mode 100644
index 00000000..10fc201a
--- /dev/null
+++ b/live-build/apparmor/5.19/ptrace/mask
@@ -0,0 +1 @@
+read trace
diff --git a/live-build/apparmor/5.19/query/label/data b/live-build/apparmor/5.19/query/label/data
new file mode 100644
index 00000000..7cfab5b0
--- /dev/null
+++ b/live-build/apparmor/5.19/query/label/data
@@ -0,0 +1 @@
+yes
diff --git a/live-build/apparmor/5.19/query/label/multi_transaction b/live-build/apparmor/5.19/query/label/multi_transaction
new file mode 100644
index 00000000..7cfab5b0
--- /dev/null
+++ b/live-build/apparmor/5.19/query/label/multi_transaction
@@ -0,0 +1 @@
+yes
diff --git a/live-build/apparmor/5.19/query/label/perms b/live-build/apparmor/5.19/query/label/perms
new file mode 100644
index 00000000..71685cbf
--- /dev/null
+++ b/live-build/apparmor/5.19/query/label/perms
@@ -0,0 +1 @@
+allow deny audit quiet
diff --git a/live-build/apparmor/5.19/rlimit/mask b/live-build/apparmor/5.19/rlimit/mask
new file mode 100644
index 00000000..c305a7d2
--- /dev/null
+++ b/live-build/apparmor/5.19/rlimit/mask
@@ -0,0 +1 @@
+cpu fsize data stack core rss nproc nofile memlock as locks sigpending msgqueue nice rtprio rttime
diff --git a/live-build/apparmor/5.19/signal/mask b/live-build/apparmor/5.19/signal/mask
new file mode 100644
index 00000000..9eb55a04
--- /dev/null
+++ b/live-build/apparmor/5.19/signal/mask
@@ -0,0 +1 @@
+hup int quit ill trap abrt bus fpe kill usr1 segv usr2 pipe alrm term stkflt chld cont stop stp ttin ttou urg xcpu xfsz vtalrm prof winch io pwr sys emt lost
diff --git a/live-build/functions b/live-build/functions
index 17f2b075..18229e32 100644
--- a/live-build/functions
+++ b/live-build/functions
@@ -767,7 +767,10 @@ snap_validate_seed() {
# a snap pre-seeding issue can occur, where the incorrect apparmor features are reported
# basic copy of a directory structure overriding the "generic" feature set
# which is tied to the LTS kernel
- cp -R --verbose /usr/share/livecd-rootfs/live-build/apparmor/${kern_major_min}/* /usr/share/livecd-rootfs/live-build/apparmor/generic/
+
+ # Bind kernel apparmor directory to feature directory for snap preseeding
+ umount "${CHROOT_ROOT}/sys/kernel/security/apparmor/features/"
+ mount --bind /usr/share/livecd-rootfs/live-build/apparmor/${kern_major_min} "${CHROOT_ROOT}/sys/kernel/security/apparmor/features/"
fi
fi
@@ -777,6 +780,14 @@ snap_validate_seed() {
/usr/lib/snapd/snap-preseed $(realpath "${CHROOT_ROOT}")
chroot "${CHROOT_ROOT}" apparmor_parser --skip-read-cache --write-cache --skip-kernel-load --verbose -j `nproc` /etc/apparmor.d
fi
+
+ # Unmount kernel specific apparmor feature
+ # mount generic apparmor feature again (cleanup)
+ if [ -d /build/config/hooks.d/extra/apparmor/${kern_major_min} ]; then
+ umount "${CHROOT_ROOT}/sys/kernel/security/apparmor/features/"
+ mount -o bind /usr/share/livecd-rootfs/live-build/apparmor/generic "${CHROOT_ROOT}/sys/kernel/security/apparmor/features/"
+ fi
+
}
snap_from_seed() {
More information about the Neon-commits
mailing list