Subject: Re: [PATCH 1/1] libselinux: helpful message when /selinux won't mount From: Karl MacMillan To: Stephen Smalley Cc: Dax Kelson , selinux@tycho.nsa.gov, Joshua Brindle In-Reply-To: <1177688730.3357.41.camel@moss-spartans.epoch.ncsc.mil> References: <1177618067.26931.13.camel@mentorng.gurulabs.com> <1177688730.3357.41.camel@moss-spartans.epoch.ncsc.mil> Content-Type: text/plain Date: Fri, 27 Apr 2007 12:06:07 -0400 Message-Id: <1177689967.15215.38.camel@localhost.localdomain> Mime-Version: 1.0 Sender: owner-selinux@tycho.nsa.gov List-Id: selinux@tycho.nsa.gov On Fri, 2007-04-27 at 11:45 -0400, Stephen Smalley wrote: > On Thu, 2007-04-26 at 14:07 -0600, Dax Kelson wrote: > > Last night a co-worker was trying to do a Phyical-2-Virtual (P2V) > > migration of a RHEL5 box. > > > > During bootup, the following not-so-helpful message was seen: > > > > "Unable to load SELinux Policy. Machine is in enforcing mode. Halting > > now." > > > > I ran it down to the /selinux mount point not existing on the root > > filesystem, but the troubleshooting was more difficult than it should > > have been (it didn't help that it was a 3am). > > > > Please consider the following trivial patch for inclusion into > > libselinux so that others may have an easier time if they happen into > > the same situation. > > > > Signed-off-by: Dax Kelson > > > > =================================================================== > > --- libselinux-2.0.8-org/src/load_policy.c 2007-03-08 12:44:37.000000000 -0700 > > +++ libselinux-2.0.8/src/load_policy.c 2007-04-26 13:54:18.000000000 -0600 > > @@ -226,6 +226,7 @@ > > */ > > *enforce = 0; > > } > > + printf("Mount failed for selinuxfs on /selinux\n"); > > goto noload; > > } > > set_selinuxmnt(SELINUXMNT); > > I'm fine with merging this for now, but I think we also likely want to > introduce a similar error reporting facility into libselinux to match > what we have in libsemanage and libsepol (e.g. see > libsepol/include/sepol/debug.h and libsepol/src/debug.[hc]) to allow > such messages to be handled in various ways by the caller. What do > others think? One difference is that libselinux presently has no notion > of handles. > I'm not a huge fan of the handle thing - we don't really use it for much at the moment. I think just a global error reporting mechanism would be fine. That would give us the ERR, WARN, etc., macros and a way to change the level of output globally without having to rework the entire libselinux api to pass handles. Karl -- This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to majordomo@tycho.nsa.gov with the words "unsubscribe selinux" without quotes as the message.