Research
.
Skip Search Box

SELinux Mailing List

Re: getfilecon return code

From: John D. Ramsdell <ramsdell_at_mitre.org>
Date: 09 Jul 2007 16:01:44 -0400


Steve,

Thanks for your quick reply.

Stephen Smalley <sds@tycho.nsa.gov> writes:

> On Mon, 2007-07-09 at 14:07 -0400, John D. Ramsdell wrote:
> > ... In fact, I wrote code that freecon'd a context whenever the
> > return value was not -1.
>
> freecon(NULL) is perfectly legal and harmless, like free(NULL), so
> that part is ok.

There is also the case of printing a security context. The getfilecon program that is part of the libselinux package thinks one can print a security context if the return code is non-negative, and thus prints:

/proc/sys/kernel/pid_max (null)

If some other program tried to use the second field of this output as a security context, it could spell trouble.

John

--
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.
Received on Mon 9 Jul 2007 - 16:01:48 EDT
 

Date Posted: Jan 15, 2009 | Last Modified: Jan 15, 2009 | Last Reviewed: Jan 15, 2009

 
bottom

National Security Agency / Central Security Service