Note: This is a public test instance of Red Hat Bugzilla. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback at bugzilla.redhat.com.
Bug 1379044 - Selinux is preventing mdadm from updating metadata on shutdown. Software raid is broken
Summary: Selinux is preventing mdadm from updating metadata on shutdown. Software raid...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: selinux-policy
Version: 27
Hardware: Unspecified
OS: Unspecified
unspecified
high
Target Milestone: ---
Assignee: Lukas Vrabec
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-09-24 09:16 UTC by Oleg Samarin
Modified: 2018-02-27 17:22 UTC (History)
11 users (show)

Fixed In Version: selinux-policy-3.13.1-283.26.fc27
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2018-02-27 17:22:23 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)
This module solves the problem (deleted)
2016-10-01 09:57 UTC, Oleg Samarin
no flags Details


Links
System ID Private Priority Status Summary Last Updated
Red Hat Bugzilla 1371991 0 unspecified CLOSED Software RAID broken! "Kernel not configured for semaphores (System V IPC). Not using udev synchronisation code. mdadm:... 2021-02-22 00:41:40 UTC
Red Hat Bugzilla 1375002 0 unspecified CLOSED Intel IMSM raid starts resync after each reboot 2021-02-22 00:41:40 UTC

Internal Links: 1375002

Description Oleg Samarin 2016-09-24 09:16:00 UTC
Description of problem:

In a selinux-enabled system a mdadm raid1 array starts resynching after each reboot, because they are marked as not clean.

If I run 'setenforce 0' before reboot, the array is successfully marked as clean and does not start being resynching after reboot.


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

systemd-229-13.fc24.x86_64
selinux-policy-targeted-3.13.1-191.16.fc24.noarch
selinux-policy-devel-3.13.1-191.16.fc24.noarch
dracut-044-20.fc24.x86_64
mdadm-3.4-2.fc24.x86_64


How reproducible:
Always

Steps to Reproduce:
1. Install F24 with an intel imsm raid1
2. Reboot


Actual results:
raid1 starts resync


Expected results:
raid1 is clean

Additional info:
with setenforce0 I see in dmesg:

--------------------------------------------------------------------------
[  973.085764] audit: type=1400 audit(1474658067.814:485): avc:  denied  { write } for  pid=25632 comm="mdadm" name="md127.sock" dev="tmpfs" ino=74281 scontext=system_u:system_r:init_t:s0 tcontext=system_u:object_r:mdadm_var_run_t:s0 tclass=sock_file permissive=1
...
[  973.174343] audit: type=1400 audit(1474658067.903:486): avc:  denied  { rename } for  pid=25634 comm="mdadm" name="map.new" dev="tmpfs" ino=79403 scontext=system_u:system_r:init_t:s0 tcontext=system_u:object_r:mdadm_var_run_t:s0 tclass=file permissive=1
--------------------------------------------------------------------------

md127.sock is the socket used for communication with mdmon process tat updates the metadata. If mdadm can not write to it, mdadm does not update metadata on that the array is clean

The filename of .sock file may be different, so it shouldn't ba hardcoded in the policy.

Comment 1 Oleg Samarin 2016-09-25 19:16:42 UTC
This bug has been raised by the change https://github.com/fedora-selinux/selinux-policy/commit/015047e1d962173e3789af3fad86198a3b5e3ac2

Since this, the domain init_t does not more have rights to files in other domains.

I don't know how to fix the security domain of mdadm: it is run by dracut from initramfs. Dracut is not ready now to support selinux labels for initramfs contents, so the context of mdadm does not trnsit from init_t to mdadm_t.

But as a workaround adding these rules solved the problem for me:

-----------------------------------------------------------------
allow init_t mdadm_var_run_t:file rename;
allow init_t mdadm_var_run_t:sock_file { relabelto write };
-----------------------------------------------------------------

May they be added to raid.te of fedora-selinux/selinux-policy ?

Comment 2 Fedora Admin XMLRPC Client 2016-09-27 15:13:44 UTC
This package has changed ownership in the Fedora Package Database.  Reassigning to the new owner of this component.

Comment 3 Oleg Samarin 2016-10-01 09:57:39 UTC
Created attachment 1206498 [details]
This module solves the problem

The rules in the previous comment are not sufficient. Use ones from the file attached

Comment 4 robert.shteynfeld 2016-10-06 14:48:12 UTC
Oleg, thanks for the fix.  It seems to work.

Comment 5 Rudd-O DragonFear 2016-10-17 02:10:09 UTC
The bug is not limited to only mdadm.  LUKS and even the umount command fail:

https://bugzilla.redhat.com/show_bug.cgi?id=1385432

Comment 6 Fedora End Of Life 2017-07-25 23:13:52 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 7 Fedora End Of Life 2017-08-08 17:37:16 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.

Comment 8 Harald Hoyer 2018-01-23 12:20:21 UTC
Was this fixed?

Comment 9 R P Herrold 2018-01-23 15:04:26 UTC
The 'time based' close of this bug, without applying the patch, seems to block:

https://github.com/dracutdevs/dracut/issues/342

it looks as though it may be an EASYFIX as there is a patch in hand

Comment 10 Fedora Update System 2018-02-20 11:16:16 UTC
selinux-policy-3.13.1-283.26.fc27 has been submitted as an update to Fedora 27. https://bodhi.fedoraproject.org/updates/FEDORA-2018-a9711c96b2

Comment 11 Fedora Update System 2018-02-20 18:19:56 UTC
selinux-policy-3.13.1-283.26.fc27 has been pushed to the Fedora 27 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2018-a9711c96b2

Comment 12 Fedora Update System 2018-02-27 17:22:23 UTC
selinux-policy-3.13.1-283.26.fc27 has been pushed to the Fedora 27 stable repository. If problems still persist, please make note of it in this bug report.


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