Bug 299181 - -o context=wrong_t can get blanked before passed to kernel
-o context=wrong_t can get blanked before passed to kernel
Status: CLOSED WONTFIX
Product: Fedora
Classification: Fedora
Component: mcstrans (Show other bugs)
12
All Linux
low Severity low
: ---
: ---
Assigned To: Daniel Walsh
Fedora Extras Quality Assurance
: Triaged
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2007-09-20 16:09 EDT by Eric Paris
Modified: 2010-12-05 02:14 EST (History)
4 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2010-12-05 02:14:57 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Eric Paris 2007-09-20 16:09:53 EDT
Description of problem:

[root@dhcp59-192 ~]# strace -o /tmp/mount.strace -s 1024 -- mount -t ext3 -o
loop,context=wrong_t /tmp/filesystem /import
(return -EINVAL which is good)

mount("/dev/loop0", "/import", "ext3", MS_MGC_VAL, "context=\"\"") = -1 EINVAL
(Invalid argument)

but look at the strace!  the context options got shortened to just ""

This was noticed because the kernel didn't expect to get just a blank, it
expected there to be something there, even if it not valid.  Most kernels return
EINVAL (good) but some older ones can get more angry.

This could be a bug in mount/libselinux/mcstransd or or maybe even something
else I couldn't think of, but it is a bug.  If mount finds out that a context is
illegal it needs to either bail right then or it needs to pass along the wrong
context to the kernel.  It should not be truncating it to nothing.

Just a point of information, if you use -o context=wrong_t:wrong_t:wrong_t (so
actually a full user:role:type entry, even if there is a typo, mount send the
context line to the kernel just fine.  The only problem is when you don't have
at least 2 ':'

There is actually a security risk involved here.  Because of the way NFS is
handled by truncating the (wrong) context the kernel ends up believing you never
specified a context at all.  Thus we mount as if the option had never been given
rather than failing with EINVAL.
Comment 1 Eric Paris 2007-09-24 17:28:37 EDT
wow, i got this assigned to the wrong component somehow....
Comment 2 Eric Paris 2007-09-24 17:30:03 EDT
reasigning to kzak, since i accidentally got the wrong component when i opened
the BZ
Comment 3 Eric Paris 2007-09-24 19:04:13 EDT
relevant code in mount(8) (according to kzak)

       if (selinux_trans_to_raw_context(
                         (security_context_t) data, &raw)==-1 ||
                         raw==NULL)
                 return -1;

and there is some debugging in mount which shows:

mount: translated context= 'wrong_t' to ''

so apparently selinux_trans_to_raw_context is returning a non-null string which
is empty.  In my opinion libselinux needs to be returning -EINVAL.  Not just
returning a blank string.

Dan, sounds like this is being moved into your court....
Comment 4 Daniel Walsh 2007-10-04 10:37:56 EDT
This is a mcstrans bug, if you stop the service, the translation works correctly.
Comment 6 Bug Zapper 2008-05-13 23:15:41 EDT
Changing version to '9' as part of upcoming Fedora 9 GA.
More information and reason for this action is here:
http://fedoraproject.org/wiki/BugZappers/HouseKeeping
Comment 7 Bug Zapper 2009-06-09 18:51:27 EDT
This message is a reminder that Fedora 9 is nearing its end of life.
Approximately 30 (thirty) days from now Fedora will stop maintaining
and issuing updates for Fedora 9.  It is Fedora's policy to close all
bug reports from releases that are no longer maintained.  At that time
this bug will be closed as WONTFIX if it remains open with a Fedora 
'version' of '9'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version prior to Fedora 9's end of life.

Bug Reporter: Thank you for reporting this issue and we are sorry that 
we may not be able to fix it before Fedora 9 is end of life.  If you 
would still like to see this bug fixed and are able to reproduce it 
against a later version of Fedora please change the 'version' of this 
bug to the applicable version.  If you are unable to change the version, 
please add a comment here and someone will do it for you.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events.  Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

The process we are following is described here: 
http://fedoraproject.org/wiki/BugZappers/HouseKeeping
Comment 9 Bug Zapper 2009-11-16 02:57:46 EST
This bug appears to have been reported against 'rawhide' during the Fedora 12 development cycle.
Changing version to '12'.

More information and reason for this action is here:
http://fedoraproject.org/wiki/BugZappers/HouseKeeping
Comment 10 Bug Zapper 2010-11-04 08:06:59 EDT
This message is a reminder that Fedora 12 is nearing its end of life.
Approximately 30 (thirty) days from now Fedora will stop maintaining
and issuing updates for Fedora 12.  It is Fedora's policy to close all
bug reports from releases that are no longer maintained.  At that time
this bug will be closed as WONTFIX if it remains open with a Fedora 
'version' of '12'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version prior to Fedora 12's end of life.

Bug Reporter: Thank you for reporting this issue and we are sorry that 
we may not be able to fix it before Fedora 12 is end of life.  If you 
would still like to see this bug fixed and are able to reproduce it 
against a later version of Fedora please change the 'version' of this 
bug to the applicable version.  If you are unable to change the version, 
please add a comment here and someone will do it for you.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events.  Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

The process we are following is described here: 
http://fedoraproject.org/wiki/BugZappers/HouseKeeping
Comment 11 Bug Zapper 2010-12-05 02:14:57 EST
Fedora 12 changed to end-of-life (EOL) status on 2010-12-02. Fedora 12 is 
no longer maintained, which means that it will not receive any further 
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of 
Fedora please feel free to reopen this bug against that version.

Thank you for reporting this bug and we are sorry it could not be fixed.

Note You need to log in before you can comment on or make changes to this bug.