Bug 110384 - mv breaks up if selinux not supported by kernel but selinux support enabled in coreutils
mv breaks up if selinux not supported by kernel but selinux support enabled i...
Status: CLOSED RAWHIDE
Product: Fedora
Classification: Fedora
Component: coreutils (Show other bugs)
rawhide
All Linux
medium Severity medium
: ---
: ---
Assigned To: Daniel Walsh
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2003-11-18 18:15 EST by Need Real Name
Modified: 2007-11-30 17:10 EST (History)
1 user (show)

See Also:
Fixed In Version: 5.0-32-sel
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2003-12-02 06:10:55 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:


Attachments (Terms of Use)

  None (edit)
Description Need Real Name 2003-11-18 18:15:21 EST
Description of problem:
coreutils-5.0-30.sel.src.rpm enables SELINUX by default, but if kernel
does not support it, this kind of things happen:

touch /tmp/empty
mv /tmp/empty /usr
mv: cannot lgetfilecon `/tmp/empty': Operation not supported


Version-Release number of selected component (if applicable):


How reproducible:
every time you run mv without SELINUX-support with conditions defined
below.

Steps to Reproduce:
1. run kernel with SELINUX disabled
2. touch /tmp/empty
3. mv /tmp/empty /usr
   (assumption: tmp and usr are on different partitions)
  
Actual results:
mv fails to check if SELINUX is enabled when moving files
across devices

also, cp.c does not check if WITH_SELINUX is defined in function
decode_preserve_arg
when accessing preserve_security_context, resulting in compilation
failure when you set WITH_SELINUX to 0 in coreutils.spec.

Expected results:
check if SELINUX is enabled and do not try to copy the context if
SELINUX is not enabled

it could warn about it like copy -Z


Additional info:

"make check" for coreutils / mv

make[3]: Entering directory `/var/rpmbuild/BUILD/coreutils-5.0/tests/mv'
PASS: hard-3
PASS: hard-2
PASS: perm-1
PASS: i-link-no
PASS: part-fail
PASS: dup-source
PASS: childproof
PASS: i-4
PASS: update
mv: cannot lgetfilecon `mv-null': Operation not supported
mv: cannot lgetfilecon `mv-dir': Operation not supported
ls: /home/rpmbuild/df-10853/mv-null: No such file or directory
out2 exp differ: char 5, line 1
FAIL: mv-special-1
PASS: into-self
mv: cannot lgetfilecon `/home/rpmbuild/df-10906/file': Operation not
supported
FAIL: into-self-2
PASS: into-self-3
PASS: into-self-4
PASS: backup-is-src
PASS: i-1
mv: cannot lgetfilecon `hlink': Operation not supported
ls: /home/rpmbuild/df-10999/hlink: No such file or directory
FAIL: hard-link-1
PASS: force
mv: cannot lgetfilecon `file': Operation not supported
ls: /home/rpmbuild/df-11043/file: No such file or directory
FAIL: partition-perm
mv: cannot lgetfilecon `to-sym-11075': Operation not supported
FAIL: to-symlink
PASS: dir-file
PASS: diag
*** expected-11133      Wed Nov 19 00:34:41 2003
--- actual-11133        Wed Nov 19 00:34:41 2003
***************
*** 30,44 ****
  0 cp -bd rem_reg loc_sl (loc_sl loc_sl~ -> rem_reg) (rem_reg)
  1 cp -d rem_reg loc_sl [cp: `rem_reg' and `loc_sl' are the same file
](loc_sl -> rem_reg) (rem_reg)

! 0 mv loc_reg rem_sl () (rem_sl)
! 0 mv -b loc_reg rem_sl () (rem_sl rem_sl~ -> dir/loc_reg)

  1 mv rem_sl loc_reg [mv: `rem_sl' and `loc_reg' are the same file
](loc_reg) (rem_sl -> dir/loc_reg)
! 0 mv -b rem_sl loc_reg (loc_reg -> dir/loc_reg loc_reg~) ()

  1 mv loc_sl rem_reg [mv: `loc_sl' and `rem_reg' are the same file
](loc_sl -> rem_reg) (rem_reg)
! 0 mv -b loc_sl rem_reg () (rem_reg -> rem_reg rem_reg~)

! 0 mv rem_reg loc_sl (loc_sl) ()
! 0 mv -b rem_reg loc_sl (loc_sl loc_sl~ -> rem_reg) ()

--- 30,45 ----
  0 cp -bd rem_reg loc_sl (loc_sl loc_sl~ -> rem_reg) (rem_reg)
  1 cp -d rem_reg loc_sl [cp: `rem_reg' and `loc_sl' are the same file
](loc_sl -> rem_reg) (rem_reg)

! 1 mv loc_reg rem_sl [mv: cannot lgetfilecon `loc_reg': Operation not
supported ](loc_reg) () mv FAILED but removed
/home/rpmbuild/df-11133/rem_sl
! 1 mv -b loc_reg rem_sl [mv: cannot lgetfilecon `loc_reg': Operation
not supported ](loc_reg) (rem_sl~ -> dir/loc_reg) mv FAILED but
removed /home/rpmbuild/df-11133/rem_sl

  1 mv rem_sl loc_reg [mv: `rem_sl' and `loc_reg' are the same file
](loc_reg) (rem_sl -> dir/loc_reg)
! 1 mv -b rem_sl loc_reg [mv: cannot lgetfilecon `rem_sl': Operation
not supported ](loc_reg~) (rem_sl -> dir/loc_reg) mv FAILED but
removed /home/rpmbuild/df-11133/rem_sl mv FAILED but removed loc_reg

  1 mv loc_sl rem_reg [mv: `loc_sl' and `rem_reg' are the same file
](loc_sl -> rem_reg) (rem_reg)
! 1 mv -b loc_sl rem_reg [mv: cannot lgetfilecon `loc_sl': Operation
not supported ](loc_sl -> rem_reg) (rem_reg~) mv FAILED but removed
loc_sl mv FAILED but removed /home/rpmbuild/df-11133/rem_reg

! 1 mv rem_reg loc_sl [mv: cannot lgetfilecon `rem_reg': Operation not
supported ]() (rem_reg) mv FAILED but removed loc_sl
! 1 mv -b rem_reg loc_sl [mv: cannot lgetfilecon `rem_reg': Operation
not supported ](loc_sl~ -> rem_reg) (rem_reg) mv FAILED but removed loc_sl

+ expected-11133 actual-11133 differ: char 2441, line 33
FAIL: part-symlink
mv: cannot lgetfilecon `foo/': Operation not supported
FAIL: part-rename
PASS: trailing-slash
======================================
7 of 25 tests failed
Please report to bug-coreutils@gnu.org
======================================
Comment 1 Tim Waugh 2003-11-19 08:22:28 EST
What kernel are you running?
Comment 2 Need Real Name 2003-11-19 08:26:22 EST
2.4.22aa1 (no SELINUX patch)
Comment 3 Tim Waugh 2003-12-02 06:10:55 EST
Think this is fixed in 5.0-32.sel.
Comment 4 Daniel Walsh 2003-12-02 11:44:55 EST
It is fixed in that release.

Thanks

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