Bug 184067

Summary: losetup has permission problems
Product: [Fedora] Fedora Reporter: Mike Coffin <mhcoffin>
Component: util-linuxAssignee: Karel Zak <kzak>
Status: CLOSED RAWHIDE QA Contact: Ben Levenson <benl>
Severity: medium Docs Contact:
Priority: medium    
Version: 5CC: dwalsh, prarit
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2006-03-12 16:42:52 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Mike Coffin 2006-03-05 20:57:13 UTC
Description of problem:
/sbin/losetup /sbin/losetup /dev/loop0 /usr/local/zoo/.jdk1.4.2.tmp
fails with "/usr/local/zoo/.jdk1.4.2.tmp: Permission denied".  This occurs even
though the file has permissions wr permissions for all, and the losetup command
is run as root.

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


How reproducible:


Steps to Reproduce:
1. sudo /sbin/losetup /dev/loop0 <some file>
2.
3.
  
Actual results:


Expected results:


Additional info:

Comment 1 Karel Zak 2006-03-09 17:33:15 UTC
This a problem with selinux file labels. The losetup command is able to use
files with fsadm_tmp_t or swapfile_t labels only. It means you have to change it.

# dd if=/dev/zero of=/root/testfile bs=1024 count=65536
# ls -Z /root/testfile
-rw-r--r--  root     root     root:object_r:user_home_t        /root/testfile

# chcon -t fsadm_tmp_t /root/testfile
# ls -Z /root/testfile
-rw-r--r--  root     root     root:object_r:fsadm_tmp_t        /root/testfile

# losetup /dev/loop0 /root/testfile
# losetup -a
/dev/loop0: [fd00]:17350081 (/root/testfile)

Danie, can you check if "fsadm_tmp_t" is a good way or there should be any extra
type or permission for any other type (like user_home_t)? Thanks.

Comment 2 Karel Zak 2006-03-09 17:39:30 UTC
Sorry: s/Danie/Dan/ :-)

Comment 3 Daniel Walsh 2006-03-09 18:36:06 UTC
This should be fixes with updated policy in latest rawhide.  We no longer
transition unconfined_t to mount or fsadm.

Comment 4 Karel Zak 2006-03-12 16:43:53 UTC
*** Bug 185083 has been marked as a duplicate of this bug. ***