From: Jim Meyering <jim@meyering.net>
To: "Ondřej Vašík" <ovasik@redhat.com>, yaneti@declera.com
Cc: CoreutilsBugs <bug-coreutils@gnu.org>, SE Linux <selinux@tycho.nsa.gov>
Subject: Re: [PATCH]: chcon: no longer abort on SELinux disabled kernel
Date: Mon, 05 Oct 2009 20:44:01 +0200 [thread overview]
Message-ID: <87zl85bs0e.fsf@meyering.net> (raw)
In-Reply-To: <1254727932.3849.8.camel@dhcp-lab-219.englab.brq.redhat.com> ("Ondřej Vašík"'s message of "Mon, 05 Oct 2009 09:32:12 +0200")
Ondřej Vašík wrote:
> as reported in https://bugzilla.redhat.com/show_bug.cgi?id=527142 by
> Yanko Kaneti, chcon aborts on SELinux disabled kernel due to missing
> check for SELinux enabled kernel. Attached patch is fixing the issue.
>
> Additionally - for consistency - error message of this check in runcon
> was changed to not hardcode "runcon" program name.
[Cc'ing the SELinux list for the question at the end
Summary: chcon(1) aborts when a successful getfilecon
result is passed to context_new and makes it return NULL. ]
Thanks, Ondřej.
At first, I planned to use that patch, mostly as-is, but
moving the chcon paragraph in NEWS "up" so that it's alphabetized.
chcon no longer aborts on SELinux disabled system.
[the bug dates back to the initial implementation]
However, since I have so far been unable to reproduce the failure,
(neither in mock, nor on bare-metal x86_64 with SELinux disabled)
and know that merely running chcon with SELinux disabled is not
enough to trigger the abort, what's written above is misleading.
What if the only way to trigger the abort is with a strangely-
or improperly-configured system?
In fact, until I understand how/why the offending code is being
reached, I hesitate to call this a bug or say where it originated.
If the getfilecon call succeeds, then why would context_new fail?
Right after I wrote the line above, it clicked.
Some versions of getfilecon can succeed (and return >= 0)
yet set the context string to "unlabeled". *That* is what
causes trouble if you pass it to context_new.
This makes me want to write a getfilecon wrapper
that would convert that surprising result into a return
value of -1 with errno of ENOTSUP. A wrapper would also
protect us from the small risk of folks using the older
libselinux versions that can return 0 and a NULL context.
Can the SELinux folks tell us under what circumstances
getfilecon will return 10 and set *context to "unlabeled"?
Thanks,
Jim
--
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 parent reply other threads:[~2009-10-05 18:44 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1254727932.3849.8.camel@dhcp-lab-219.englab.brq.redhat.com>
2009-10-05 18:44 ` Jim Meyering [this message]
2009-10-05 19:17 ` [PATCH]: chcon: no longer abort on SELinux disabled kernel Stephen Smalley
2009-10-05 20:02 ` Jim Meyering
2009-10-06 8:14 ` Jim Meyering
2009-10-07 12:37 ` Stephen Smalley
2009-10-07 12:48 ` Jim Meyering
2009-10-07 12:54 ` Stephen Smalley
2009-10-07 13:34 ` Jim Meyering
2009-10-07 15:30 ` Stephen Smalley
2009-10-10 9:59 ` Jim Meyering
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=87zl85bs0e.fsf@meyering.net \
--to=jim@meyering.net \
--cc=bug-coreutils@gnu.org \
--cc=ovasik@redhat.com \
--cc=selinux@tycho.nsa.gov \
--cc=yaneti@declera.com \
/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.