Skip to contentSkip to conversation

selinux-image: fix labeling on non-seclabel mounts

PATCH New George McCollister 1 participant 1 message May 22, 2018

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 selinux-image: fix labeling on non-seclabel mounts

Use -m to prevent non-seclabel mounts from being excluded from labeling. After the following commit setfiles will no longer label files on a mount other than / if it doesn't have seclabel listed in /proc/mounts:
https://github.com/SELinuxProject/selinux/commit/f2e77865e144ab2e1313aa78d99b969f8f48695e#diff-2de9aefdd8fc5bc6a8740533e5d1cc2e

---
 classes/selinux-image.bbclass | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
classes/selinux-image.bbclass +1 -1
index 90ead2f..5174dc5 100644
@@ -1,6 +1,6 @@
 selinux_set_labels () {
     POL_TYPE=$(sed -n -e "s&^SELINUXTYPE[[:space:]]*=[[:space:]]*\([0-9A-Za-z_]\+\)&\1&p" ${IMAGE_ROOTFS}/${sysconfdir}/selinux/config)
-    if ! setfiles -r ${IMAGE_ROOTFS} ${IMAGE_ROOTFS}/${sysconfdir}/selinux/${POL_TYPE}/contexts/files/file_contexts ${IMAGE_ROOTFS}
+    if ! setfiles -m -r ${IMAGE_ROOTFS} ${IMAGE_ROOTFS}/${sysconfdir}/selinux/${POL_TYPE}/contexts/files/file_contexts ${IMAGE_ROOTFS}
     then
         echo WARNING: Unable to set filesystem context, setfiles / restorecon must be run on the live image.
         touch ${IMAGE_ROOTFS}/.autorelabel
Signature · 1 line
2.16.0