-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 This patch looks good to me. acked. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.15 (GNU/Linux) Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iEYEARECAAYFAlJpOOUACgkQrlYvE4MpobPL2gCffKt7IyVr1brOg0uc+WVB0+S6 /ewAn0mIvqaX3yHGlZyeCVze/jMmwyH2 =xpz0 -----END PGP SIGNATURE-----
>From 12418a516615463d5b28765d4f229b8c671cec28 Mon Sep 17 00:00:00 2001 From: Sven Vermeulen <sven.vermeulen@xxxxxxxxx> Date: Wed, 25 Sep 2013 17:51:58 +0200 Subject: [PATCH 72/74] Mount sys before trying to mount selinuxfs If /sys is not present, the attempt to mount selinuxfs will of course fail. So we try to mount /sys first (and only if that fails fall back to the /selinux mount point) and then try to mount selinuxfs. Signed-off-by: Sven Vermeulen <sven.vermeulen@xxxxxxxxx> --- libselinux/src/load_policy.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/libselinux/src/load_policy.c b/libselinux/src/load_policy.c index 10e29b9..e419f1a 100644 --- a/libselinux/src/load_policy.c +++ b/libselinux/src/load_policy.c @@ -370,8 +370,16 @@ int selinux_init_load_policy(int *enforce) * mount it if present for use in the calls below. */ const char *mntpoint = NULL; - if (mount(SELINUXFS, SELINUXMNT, SELINUXFS, 0, 0) == 0 || errno == EBUSY) { - mntpoint = SELINUXMNT; + /* First make sure /sys is mounted */ + if (mount("sysfs", "/sys", "sysfs", 0, 0) == 0 || errno == EBUSY) { + if (mount(SELINUXFS, SELINUXMNT, SELINUXFS, 0, 0) == 0 || errno == EBUSY) { + mntpoint = SELINUXMNT; + } else { + /* check old mountpoint */ + if (mount(SELINUXFS, OLDSELINUXMNT, SELINUXFS, 0, 0) == 0 || errno == EBUSY) { + mntpoint = OLDSELINUXMNT; + } + } } else { /* check old mountpoint */ if (mount(SELINUXFS, OLDSELINUXMNT, SELINUXFS, 0, 0) == 0 || errno == EBUSY) { -- 1.8.3.1