Bug 1381468 - SELinux is preventing worker from write access on the blk_file /dev/dm-18
Summary: SELinux is preventing worker from write access on the blk_file /dev/dm-18
Keywords:
Status: CLOSED EOL
Alias: None
Product: Fedora
Classification: Fedora
Component: selinux-policy-targeted
Version: 24
Hardware: x86_64
OS: Linux
unspecified
high
Target Milestone: ---
Assignee: Lukas Vrabec
QA Contact: Ben Levenson
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-10-04 08:20 UTC by Edgar Hoch
Modified: 2017-08-08 19:18 UTC (History)
2 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2017-08-08 19:18:43 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Edgar Hoch 2016-10-04 08:20:25 UTC
Description of problem:

Since an update last night to selinux-policy-3.13.1-191.17.fc24.noarch and qemu-2.6.2-1.fc24.x86_64 our kvm virtual machine was broken since it count not write to /dev/vdb any more.

I had added a LVM partition as a second disk to a kvm machine. I is available as /dev/vdb in that machine. Since the time of the update on the kvm host I got messages like this on the kvm machine:

kernel: blk_update_request: I/O error, dev vdb, sector 189268992
kernel: EXT4-fs warning (device vdb): ext4_end_bio:315: I/O error -5 writing to inode 2097154 (offset 0 size 249856 starting block 23658685)
kernel: Buffer I/O error on device vdb, logical block 23658624
...
kernel: Aborting journal on device vdb-8.
kernel: Buffer I/O error on dev vdb, logical block 39354368, lost sync page write
kernel: JBD2: Error -5 detected when updating journal superblock for vdb-8.
kernel: blk_update_request: I/O error, dev vdb, sector 0
kernel: Buffer I/O error on dev vdb, logical block 0, lost sync page write
kernel: EXT4-fs error (device vdb): ext4_journal_check_start:56: Detected aborted journal
kernel: EXT4-fs (vdb): Remounting filesystem read-only


On the kvm server I got message like this:


# LANG=C sealert -l ff4b6abf-e9bd-4990-83eb-2040df85b97d
SELinux is preventing worker from write access on the blk_file /dev/dm-18.

*****  Plugin catchall (100. confidence) suggests   **************************

If you believe that worker should be allowed write access on the dm-18 blk_file by default.
Then you should report this as a bug.
You can generate a local policy module to allow this access.
Do
allow this access for now by executing:
# ausearch -c 'worker' --raw | audit2allow -M my-worker
# semodule -X 300 -i my-worker.pp


Additional Information:
Source Context                system_u:system_r:svirt_t:s0:c338,c965
Target Context                system_u:object_r:fixed_disk_device_t:s0
Target Objects                /dev/dm-18 [ blk_file ]
Source                        worker
Source Path                   worker
Port                          <Unknown>
Host                          myvirtserver.example.com
Source RPM Packages           
Target RPM Packages           
Policy RPM                    selinux-policy-3.13.1-191.17.fc24.noarch
Selinux Enabled               True
Policy Type                   targeted
Enforcing Mode                Enforcing
Host Name                     myvirtserver.example.com
Platform                      Linux myvirtserver.example.com
                              4.6.6-300.fc24.x86_64 #1 SMP Wed Aug 10 21:07:35
                              UTC 2016 x86_64 x86_64
Alert Count                   8
First Seen                    2016-10-04 01:40:16 CEST
Last Seen                     2016-10-04 09:26:36 CEST
Local ID                      ff4b6abf-e9bd-4990-83eb-2040df85b97d

Raw Audit Messages
type=AVC msg=audit(1475565996.397:163980): avc:  denied  { write } for  pid=3789 comm="worker" path="/dev/dm-18" dev="devtmpfs" ino=28889 scontext=system_u:system_r:svirt_t:s0:c338,c965 tcontext=system_u:object_r:fixed_disk_device_t:s0 tclass=blk_file permissive=0


Hash: worker,svirt_t,fixed_disk_device_t,blk_file,write



I have created a my-worker.pp module like suggested by the command, and applied it on the server. After reboot of the kvm machine it works again.

But why did someone change the policy that disallows importing raw disk space as block device to a kvm machine? Why did you break our kvm machine?

Here the contents of the selinux module:

# cat my-worker.te

module my-worker 1.0;

require {
	type fixed_disk_device_t;
	type svirt_t;
	class blk_file { read write };
}

#============= svirt_t ==============
allow svirt_t fixed_disk_device_t:blk_file { read write };




Version-Release number of selected component (if applicable):
selinux-policy-3.13.1-191.17.fc24.noarch
qemu-2.6.2-1.fc24.x86_64
kernel-4.6.6-300.fc24.x86_64

(I didn't boot newer kernel on this server because of running processes.)

How reproducible:
Always

Comment 1 Edgar Hoch 2016-10-10 08:37:04 UTC
Does anyone have an idea what the reason for this bad behavior may be?

Should this bug report moved to another component - for example, something with nfs? I don't know which component are right.

It seems that sometimes our users cannot login, possibly because of this error.

Thanks in advance!

Comment 2 Fedora End Of Life 2017-07-25 23:20:48 UTC
This message is a reminder that Fedora 24 is nearing its end of life.
Approximately 2 (two) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 24. 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 EOL if it remains open with a Fedora  'version'
of '24'.

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.

Thank you for reporting this issue and we are sorry that we were not
able to fix it before Fedora 24 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, you are encouraged  change the 'version' to a later Fedora
version prior this bug is closed as described in the policy above.

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.

Comment 3 Fedora End Of Life 2017-08-08 19:18:43 UTC
Fedora 24 changed to end-of-life (EOL) status on 2017-08-08. Fedora 24 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. If you
are unable to reopen this bug, please file a new report against the
current release. If you experience problems, please add a comment to this
bug.

Thank you for reporting this bug and we are sorry it could not be fixed.


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