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.1.5 -- This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to majordomo@xxxxxxxxxxxxx with the words "unsubscribe selinux" without quotes as the message.