Bug 442327 - setfscreatecon-w/invalid-context can mistakenly succeed
setfscreatecon-w/invalid-context can mistakenly succeed
Status: CLOSED RAWHIDE
Product: Fedora
Classification: Fedora
Component: mcstrans (Show other bugs)
rawhide
All Linux
low Severity low
: ---
: ---
Assigned To: Daniel Walsh
Fedora Extras Quality Assurance
http://thread.gmane.org/gmane.comp.se...
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2008-04-14 08:42 EDT by Jim Meyering
Modified: 2013-03-13 16:40 EDT (History)
3 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2008-04-14 17:18:37 EDT
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 Jim Meyering 2008-04-14 08:42:18 EDT
Description of problem: setfscreatecon-w/invalid-context can mistakenly succeed

Version-Release number of selected component (if applicable):
mcstrans-0.2.7-2.fc9.x86_64

How reproducible: consistently

Steps to Reproduce:
with mcstransd started and selinux=enforcing, run this:

  while :;do mkdir d -Z xxx 2>/dev/null&&{t=X;rmdir d;}||t=.;printf $t;done
  
Actual results:
..............................................................................\
..............................................................................\
..............................................................................\
..............................................................................\
..............................................................................\
.........................................................XX.XXX.XXXX.XXXXXXX.X\
XX.................................................XXXX.......................\
.............X.XXXX.XXX.XXX.XXX...XX.XXXXXXX.XXX.XXXX.XXX.XXX......XX..XX..XX.\
.XX..XX..XX...XX..XX..XX......................................................\
.................................................................X.XXX.XXX.XXX\
XXXX.XXX.XXXXXXXXXXXXX.XXXXXX.XXXXXXXXXXXX.XXXXXXXXX.XXXX.XXX.XXXXXX.XXXX.XX.X\
XX.XXXXXXXXXXXX.XXXX.XXX.XXX.XXX.XXXXXXX.XXX.XXX.XXXXXX.X.XXXXXX.XXX.XXXXXXX.X\
XX.XXX.XXX.XXX.XXX.XXX.XXX.XXXXXX.XXX.XXXXXXX.XX.XXXXXXXXXXXXXXXX.XXXX.XXX.XXX\
.XXXXXXX.XXX.XXXXXXX.XXXX......................................XXXXXXXXX.XXX.X\
XX.XXXXXX.XXX.XXXXXX.XXXXXXXXXXXX.XXXXXX.XXXX.XXX.XXX.XXX.XXX.XXX.XXXX.XXX.XXX\
XXXX.XXX.XXX.XXXXXXXXXXXXXXXXXX.....XXXX........X.X..XXXXXXXXXXXXXXXXX.XXX....\
.X............................................................................\
..............................................................................\
.................................^C

Expected results:
all '.'s

Additional info:
> Each X represents a mkdir command that has mistakenly succeeded, which
> includes a setfscreatecon call that is expected to fail due to the
> invalid "xxx" context.  Normally it fails, corresponding to "."s above:
> 
>     $ mkdir d -Z xxx
>     /bin/mkdir: failed to set default file creation context to `xxx': \
>     Invalid argument
>     [Exit 1]
Comment 1 Jim Meyering 2008-04-14 08:43:20 EDT
BTW, when I disable mcstransd, I do get all "."s
Comment 2 Joe Nall 2008-04-14 12:37:24 EDT
[root@rawhide ~]#   while :;do mkdir d -Z xxx 2>/dev/null&&{t=X;rmdir d;}||t=.;printf $t;done
bash: syntax error near unexpected token `}'

What am I missing?
Comment 3 Jim Meyering 2008-04-14 13:02:22 EDT
bash requires extra spaces near braces (I use zsh, which doesn't).
This works even with bash:
while :;do mkdir d -Z xxx 2>/dev/null&&{ t=X;rmdir d; }||t=.;printf $t;done
Comment 4 Daniel Walsh 2008-04-14 17:18:37 EDT
Fixed in mcstrans-0.2.8-1.fc9

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