Mounting /sys within libselinux?
Hi guys,
Since selinux_init_load_policy tries to mount the selinuxfs on /sys/fs/selinux, it of course fails when /sys is not available yet. It currently falls back to /selinux then, but what about just mounting /sys there?
Something akin to the following?
Wkr,
Sven Vermeulen
src/load_policy.c +10 -2
@@ -370,8 +370,16 @@* mount it if present for use in the calls below. */ 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 ) {
--
This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.