Description of problem:
system-config-selinux shows file labeling for /media(/[^/]*)? file type
directory as system_u:object_r:mnt_t, not system_u:object_r:removable_t.
This prevents modifications to removable ext3 media
Version-Release number of selected component (if applicable):
Steps to Reproduce:
1. In KDE, plug in an external ext3 media
2. Click the primary mouse button on the storage media applet, drive/partition
icon and select 'Mount'.
3. The partition is mounted as a directory under the '/media/ directory.
4. chdir to a folder under the mount directory.
5. try to create a file, e.g. 'touch test.txt'
The setroubleshoot applet appears on the KDE panel indicating 'AVC denial'.
Clicking on the icon displays the setroubleshoot browser.
Category: File Label
Summary: SELinux is preventing touch from creating a file with a context of
unlabeled_t on a filesystem
The file should be created
1. There isn't a bug section for system-config-selinux. I tried to change the
selinux type from mnt_t to removable_t and got cryptic errors.
2. It's unclear how to prevent Fedora from using security contexts on removable
media in general or for a specific media.
This is really a hal bug. Hal needs to either always mount these file systems
as removable_t. Which would be a problem for file system like dosfs_t. And
file systems with actual labels.
I guess in the ideal situation, hal would somehow figure out if the file system
is a file system that supports labels. If yes then check to see if it has
labels on the root /? If not then mount it removable_t if yes then just mount it.
Surely it would be nicer to make mount(8) do this... right? (hal just invokes
mount(8) as uid 0). Alternatively we can teach hal to do this...
(In reply to comment #1)
> I guess in the ideal situation, hal would somehow figure out if the file system
> is a file system that supports labels. If yes then check to see if it has
> labels on the root /? If not then mount it removable_t if yes then just mount it.
I don't know about any generic way how read xattr from non-mounted FS. It's
unsupported by libvolume_id or libblkid. It means we need to mount it without
any context, call getfilecon() and possibly *remount* it with context=removable_t.
Does it make sense?
I'm not sure if I good understand a relation between this request and bug
#390691 where you ask for a warning message when a mounted FS is unlabeled. Or
do you expect a different behaviour for the /media directory?
Shouldn't be better to mount all unlabeled / non-xattr filesystems with
We could simply always make hal mount file systems with xattr support as
removable_t, but this would eliminate me being able to use labels on a removable
Another option would be for hal or mount to check as you described above. Check
the file context on mount, if it returns file_t, remount as removable_t.
The mount command can give a warning that is described in the other bug, but hal
What about a kernel based solution? I mean a new mount(2) option -- something
like a conditional context= for unlabeled / non-xattr filesystems.
# mount /dev/flashdisk /media/foo -o condcontext=removable_t
if the /dev/flashdisk is labeled the option is ignored otherwise it's mounted
It looks like these are implementation questions, so it's not something I can
My two cents worth is that removable media shouldn't be labeled at all, it's the
mount point that needs a label.
Would it be useful to mount a device in different places to provide different
I use rewritable media to back up and restore data.
Steve and Eric your thoughts?
(this kind of question likely belongs on selinux list)
I would say that the default should be to mount removable media with a fixed
label via a context mount, i.e. don't trust the attributes on the media even if
present. Think of it being analogous to nosuid nodev.
With suitable privileges, user may be able to mount removable media and use
xattrs on it (if supported by the filesystem type).
There is already a removable_context config file that contains the default
context for such media, and libselinux exports its path via a function. Not
sure who calls it at present - hal or mount?
Ok since hal is the one mounting the removable media, it should probably just
call the mount command with the correct mount option. And if you want to
support removable media with file context you will need to override this behaviour.
It looks like hal did this at one time in the past - I see mention of selinux
removable context in the ChangeLog. But not in the current code?
Reassigning to HAL.
(for more details see comments #9, #10 -- most especially: "i.e. don't trust
the attributes on the media even if present. Think of it being analogous to
So, is the outcome that hal should call mount with -o context=removable_t, always ?
Yes well it should really use the contents of
Function call selinux_removable_context_path
extern const char *selinux_removable_context_path(void);
selinux_removable_context_path() - filesystem context for removable
This bug appears to have been reported against 'rawhide' during the Fedora 10 development cycle.
Changing version to '10'.
More information and reason for this action is here:
This message is a reminder that Fedora 10 is nearing its end of life.
Approximately 30 (thirty) days from now Fedora will stop maintaining
and issuing updates for Fedora 10. 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 '10'.
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 10'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 10 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:
Fedora 10 changed to end-of-life (EOL) status on 2009-12-17. Fedora 10 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.