From: Joshua Brindle <method@manicmethod.com>
To: Stephen Smalley <sds@tycho.nsa.gov>
Cc: selinux@tycho.nsa.gov,
Karl MacMillan <kmacmillan@mentalrootkit.com>,
John Ramsdell <ramsdell@mitre.org>
Subject: Re: [patch] libselinux: fix getfilecon handling of zero-length context
Date: Mon, 09 Jul 2007 13:39:55 -0400 [thread overview]
Message-ID: <469272EB.9050602@manicmethod.com> (raw)
In-Reply-To: <1183999843.12430.96.camel@moss-spartans.epoch.ncsc.mil>
Stephen Smalley wrote:
> On Mon, 2007-07-09 at 12:48 -0400, Joshua Brindle wrote:
>
>> Stephen Smalley wrote:
>>
>>> As observed by John Ramsdell, *getfilecon() on a /proc/sys inode on
>>> returns garbage and can lead to memory corruption upon later freecon.
>>> This happens on 2.6.21 and later due to the proc sysctl rewrite in the
>>> kernel. The *getfilecon_raw() functions correctly return zero in this
>>> case, but the non-raw functions are not handling that result properly.
>>> Initialize *context on entry to *getfilecon() so that it has a
>>> well-defined value even if *getfilecon_raw() returns zero.
>>>
>>> Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
>>>
>>>
>>>
>> Acked-By: Joshua Brindle <jbrindle@manicmethod.com>
>>
>> This should go into stable/1_0 and trunk, right?
>>
>
> Yes.
>
>
Thanks, merged into 1.34.11 and 2.0.24
>>> ---
>>>
>>> libselinux/src/fgetfilecon.c | 2 ++
>>> libselinux/src/getfilecon.c | 2 ++
>>> libselinux/src/lgetfilecon.c | 2 ++
>>> 3 files changed, 6 insertions(+)
>>>
>>> Index: trunk/libselinux/src/fgetfilecon.c
>>> ===================================================================
>>> --- trunk/libselinux/src/fgetfilecon.c (revision 2490)
>>> +++ trunk/libselinux/src/fgetfilecon.c (working copy)
>>> @@ -51,6 +51,8 @@
>>> security_context_t rcontext;
>>> int ret;
>>>
>>> + *context = NULL;
>>> +
>>> ret = fgetfilecon_raw(fd, &rcontext);
>>>
>>> if (ret > 0) {
>>> Index: trunk/libselinux/src/lgetfilecon.c
>>> ===================================================================
>>> --- trunk/libselinux/src/lgetfilecon.c (revision 2490)
>>> +++ trunk/libselinux/src/lgetfilecon.c (working copy)
>>> @@ -51,6 +51,8 @@
>>> int ret;
>>> security_context_t rcontext;
>>>
>>> + *context = NULL;
>>> +
>>> ret = lgetfilecon_raw(path, &rcontext);
>>>
>>> if (ret > 0) {
>>> Index: trunk/libselinux/src/getfilecon.c
>>> ===================================================================
>>> --- trunk/libselinux/src/getfilecon.c (revision 2490)
>>> +++ trunk/libselinux/src/getfilecon.c (working copy)
>>> @@ -51,6 +51,8 @@
>>> int ret;
>>> security_context_t rcontext;
>>>
>>> + *context = NULL;
>>> +
>>> ret = getfilecon_raw(path, &rcontext);
>>>
>>> if (ret > 0) {
>>>
>>>
>>>
>>>
--
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.
next prev parent reply other threads:[~2007-07-09 17:39 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-07-09 16:45 [patch] libselinux: fix getfilecon handling of zero-length context Stephen Smalley
2007-07-09 16:48 ` Joshua Brindle
2007-07-09 16:50 ` Stephen Smalley
2007-07-09 17:39 ` Joshua Brindle [this message]
2007-07-09 18:07 ` getfilecon return code John D. Ramsdell
2007-07-09 18:30 ` Stephen Smalley
2007-07-09 18:42 ` Stephen Smalley
2007-07-09 19:13 ` Joshua Brindle
2007-07-10 12:41 ` Stephen Smalley
2007-07-10 17:49 ` Joshua Brindle
2007-09-12 15:43 ` Stephen Smalley
2007-07-09 20:01 ` John D. Ramsdell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=469272EB.9050602@manicmethod.com \
--to=method@manicmethod.com \
--cc=kmacmillan@mentalrootkit.com \
--cc=ramsdell@mitre.org \
--cc=sds@tycho.nsa.gov \
--cc=selinux@tycho.nsa.gov \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.