Bug 442327 - setfscreatecon-w/invalid-context can mistakenly succeed
Summary: setfscreatecon-w/invalid-context can mistakenly succeed
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: mcstrans   
(Show other bugs)
Version: rawhide
Hardware: All Linux
low
low
Target Milestone: ---
Assignee: Daniel Walsh
QA Contact: Fedora Extras Quality Assurance
URL: http://thread.gmane.org/gmane.comp.se...
Whiteboard:
Keywords:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2008-04-14 12:42 UTC by Jim Meyering
Modified: 2013-03-13 20:40 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2008-04-14 21:18:37 UTC
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

Description Jim Meyering 2008-04-14 12:42:18 UTC
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 12:43:20 UTC
BTW, when I disable mcstransd, I do get all "."s

Comment 2 Joe Nall 2008-04-14 16:37:24 UTC
[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 17:02:22 UTC
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 21:18:37 UTC
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.