Skip to contentSkip to conversation

package/libselinux: fix the selinuxfs mount point

PATCH New Antoine Tenart 3 participants 3 messages Oct 6, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 package/libselinux: fix the selinuxfs mount point

For 9 years the recommended mount point for selinuxfs has been /sys/fs/selinux, as stated in Linux kernel commit 7a627e3b9a2b:

"""
For selinuxfs, this mount point should be in /sys/fs/selinux/ """

As other projects follow this convention, not doing so result in potential issues. One of them is the refpolicy not correctly labelling and supporting the mount point.

Fix this by using /sys/fs/selinux as of now in Buildroot.

---
 package/libselinux/libselinux.mk | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
package/libselinux/libselinux.mk +1 -3
index c96b5a443109..8087af539af0 100644
@@ -70,10 +70,8 @@ define LIBSELINUX_INSTALL_TARGET_CMDS
 	$(TARGET_MAKE_ENV) $(MAKE) -C $(@D) \
 		$(LIBSELINUX_MAKE_OPTS) DESTDIR=$(TARGET_DIR) \
 		$(LIBSELINUX_MAKE_INSTALL_TARGETS)
-	# Create the selinuxfs mount point
-	if [ ! -d "$(TARGET_DIR)/selinux" ]; then mkdir $(TARGET_DIR)/selinux; fi
 	if ! grep -q "selinuxfs" $(TARGET_DIR)/etc/fstab; then \
-		echo "none /selinux selinuxfs noauto 0 0" >> $(TARGET_DIR)/etc/fstab ; fi
+		echo "none /sys/fs/selinux selinuxfs noauto 0 0" >> $(TARGET_DIR)/etc/fstab ; fi
 endef
 
 HOST_LIBSELINUX_DEPENDENCIES = \
Signature · 1 line
2.26.2
#1 lore raw

PATCH 1/1 package/libselinux: fix the selinuxfs mount point

Antoine,

Quoted 8 lines · Antoine Tenart

For 9 years the recommended mount point for selinuxfs has been /sys/fs/selinux, as stated in Linux kernel commit 7a627e3b9a2b:

"""
For selinuxfs, this mount point should be in /sys/fs/selinux/ """

Quoted 7 lines

As other projects follow this convention, not doing so result in potential issues. One of them is the refpolicy not correctly labelling and supporting the mount point.

Fix this by using /sys/fs/selinux as of now in Buildroot.

I just asked Clayton Shotwell why we originally set it to /selinux and our best guess was that we were following the pattern WindRiver had done on their Secure Linux 1.0 (Fedora based?).

#2 lore raw

PATCH 1/1 package/libselinux: fix the selinuxfs mount point

In reply to Antoine Tenart

Antoine, All,

On 2020-10-06 17:44 +0200, Antoine Tenart spake thusly:

Quoted 7 lines

For 9 years the recommended mount point for selinuxfs has been /sys/fs/selinux, as stated in Linux kernel commit 7a627e3b9a2b:

"""
For selinuxfs, this mount point should be in /sys/fs/selinux/ """

Quoted 7 lines

As other projects follow this convention, not doing so result in potential issues. One of them is the refpolicy not correctly labelling and supporting the mount point.

Fix this by using /sys/fs/selinux as of now in Buildroot.

Applied to master, thanks.

Regards,
Yann E. MORIN.

Quoted 27 lines
---
 package/libselinux/libselinux.mk | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
package/libselinux/libselinux.mk +1 -3
index c96b5a443109..8087af539af0 100644
@@ -70,10 +70,8 @@ define LIBSELINUX_INSTALL_TARGET_CMDS
 	$(TARGET_MAKE_ENV) $(MAKE) -C $(@D) \
 		$(LIBSELINUX_MAKE_OPTS) DESTDIR=$(TARGET_DIR) \
 		$(LIBSELINUX_MAKE_INSTALL_TARGETS)
-	# Create the selinuxfs mount point
-	if [ ! -d "$(TARGET_DIR)/selinux" ]; then mkdir $(TARGET_DIR)/selinux; fi
 	if ! grep -q "selinuxfs" $(TARGET_DIR)/etc/fstab; then \
-		echo "none /selinux selinuxfs noauto 0 0" >> $(TARGET_DIR)/etc/fstab ; fi
+		echo "none /sys/fs/selinux selinuxfs noauto 0 0" >> $(TARGET_DIR)/etc/fstab ; fi
 endef
 
 HOST_LIBSELINUX_DEPENDENCIES = \
Signature · 6 lines
2.26.2

_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'