Bug 1928539

Summary: SELinux prevents hibernation (preventing systemd-sleep from getaddr access to swap partition)
Product: [Fedora] Fedora Reporter: ryan <ryan>
Component: selinux-policyAssignee: Zdenek Pytela <zpytela>
Status: CLOSED CURRENTRELEASE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: medium    
Version: 34CC: dwalsh, filhomfilho, grepl.miroslav, lvrabec, mmalik, omosnace, plautrba, vmojzis, zpytela
Target Milestone: ---Keywords: Triaged
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: selinux-policy-3.14.7-25 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1931460 (view as bug list) Environment:
Last Closed: 2021-03-26 10:25:31 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1931460    

Description ryan@testtoast.com 2021-02-14 19:36:45 UTC
Description of problem:

SELinux prevents hibernation (and therefore hybrid-sleep) on FC34 due to denying systemd-sleep access to the swap partition


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

FC34

How reproducible:

100%

Steps to Reproduce:
1. Upgrade to FC34
2. Enable hibernation by creating a swap partition and setting resume=<partition> in kernel boot params
3. Execute systemctl hibernate

Actual results:

Hibernation fails. This is a regression from FC33.

Expected results:

Hibernation succeeds.

Additional info:

Logs:Feb 15 08:24:08 firebert setroubleshoot[10858]: SELinux is preventing systemd-sleep from getattr access on the blk_file /dev/dm-2. For complete SELinux messages run: sealert -l 2e75eafb-e816-4902-89e7>
Feb 15 08:24:08 firebert setroubleshoot[10858]: SELinux is preventing systemd-sleep from getattr access on the blk_file /dev/dm-2.

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

                                                If you believe that systemd-sleep should be allowed getattr access on the dm-2 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 'systemd-sleep' --raw | audit2allow -M my-systemdsleep
                                                # semodule -X 300 -i my-systemdsleep.pp



Possibly similar to #1797543

Using the workaround logged by setroubleshoot allows hibernation to succeed.

Comment 1 Zdenek Pytela 2021-02-19 20:13:29 UTC
Fixed in rawhide:
https://github.com/fedora-selinux/selinux-policy/pull/602

Comment 2 Zdenek Pytela 2021-02-22 13:21:19 UTC
*** Bug 1912385 has been marked as a duplicate of this bug. ***