Bug 1982961 - avc: denied { write } for pid=570867 comm="systemd-coredum" name="core_pattern" dev="proc" ino=527591 scontext=system_u:system_r:systemd_coredump_t:s0 tcontext=system_u:object_r:usermodehelper_t:s0 tclass=file permissive=1
Summary: avc: denied { write } for pid=570867 comm="systemd-coredum" name="core_pat...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: selinux-policy
Version: 34
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: ---
Assignee: Zdenek Pytela
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2021-07-16 06:32 UTC by Bruno Goncalves
Modified: 2022-02-05 01:09 UTC (History)
19 users (show)

Fixed In Version: selinux-policy-34.25-1.fc34
Clone Of:
Environment:
Last Closed: 2022-02-05 01:09:46 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Bruno Goncalves 2021-07-16 06:32:12 UTC
Description of problem:
We have seen, sometimes, during CKI xfstests [1] that we hit this avc denial.

SELinux status:                 enabled
SELinuxfs mount:                /sys/fs/selinux
SELinux root directory:         /etc/selinux
Loaded policy name:             targeted
Current mode:                   permissive
Mode from config file:          permissive
Policy MLS status:              enabled
Policy deny_unknown status:     allowed
Memory protection checking:     actual (secure)
Max kernel policy version:      33
selinux-policy-34.13-1.fc34.noarch
----
time->Thu Jul 15 03:11:12 2021
type=AVC msg=audit(1626333072.035:851): avc:  denied  { write } for  pid=570867 comm="systemd-coredum" name="core_pattern" dev="proc" ino=527591 scontext=system_u:system_r:systemd_coredump_t:s0 tcontext=system_u:object_r:usermodehelper_t:s0 tclass=file permissive=1


Version-Release number of selected component (if applicable):
selinux-policy-34.13-1.fc34

How reproducible:
Not frequent

Steps to Reproduce:
1. Run test [1]

Additional info:
[1] https://gitlab.com/cki-project/kernel-tests/-/tree/main/filesystems/xfs/xfstests

Comment 2 Zdenek Pytela 2021-07-16 07:11:37 UTC
I've submitted a Fedora PR to address the issue:
https://github.com/fedora-selinux/selinux-policy/pull/804

Comment 3 Zdenek Pytela 2022-01-05 10:23:26 UTC
Switching the component. As discussed with David, this may turn out to be an unimportant bug in systemd code or a leaked file descriptor, systemd-coredump is only expected to read core_pattern.

Comment 4 Ondrej Mosnacek 2022-01-05 10:39:45 UTC
I recall seeing an AVC like this in the past and I suspect this might actually be a kernel bug... AFAICT, it is the kernel itself that reads this file, but it does so (perhaps mistakenly?) with permission checking against the calling process. Unfortunately, I've never had time to look at this in more detail :/

Comment 5 Zbigniew Jędrzejewski-Szmek 2022-01-05 14:29:23 UTC
systemd-coredump will write "|/bin/false" as core_pattern to disable coredumps when the crashing process is PID 1.
It would be interesting to see if this was the condition here.

Comment 6 Zdenek Pytela 2022-01-05 15:40:09 UTC
Bruno,

I was unable to reproduce the problem in current F35 even after multiple tests runs. Could you do it again, possibly with full auditing enabled, and also try to pair the audit records with journal?

How to enable full auditing in the audit daemon:
1) Open the /etc/audit/rules.d/audit.rules file in an editor.
2) Remove the following line if it exists:
-a task,never
3) Add the following line to the end of the file:
-w /etc/shadow -p w
4) Restart the audit daemon:
  # service auditd restart
5) Re-run your scenario.
6) Collect AVC denials:
  # ausearch -i -m avc,user_avc,selinux_err,user_selinux_err -ts today

Comment 7 Bruno Goncalves 2022-01-11 07:40:15 UTC
I've retried to run the same tests on Fedora-35, but so far no luck to reproduce the issue.

Comment 8 Zdenek Pytela 2022-01-13 18:31:10 UTC
I've submitted a new Fedora PR to address the issue:
https://github.com/fedora-selinux/selinux-policy/pull/999

Comment 9 Fedora Update System 2022-01-18 10:18:09 UTC
FEDORA-2022-f060667f1e has been submitted as an update to Fedora 34. https://bodhi.fedoraproject.org/updates/FEDORA-2022-f060667f1e

Comment 10 Fedora Update System 2022-01-19 02:41:49 UTC
FEDORA-2022-f060667f1e has been pushed to the Fedora 34 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --advisory=FEDORA-2022-f060667f1e`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2022-f060667f1e

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 11 Fedora Update System 2022-02-03 01:19:34 UTC
FEDORA-2022-35e911cda6 has been pushed to the Fedora 34 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --advisory=FEDORA-2022-35e911cda6`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2022-35e911cda6

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 12 Fedora Update System 2022-02-05 01:09:46 UTC
FEDORA-2022-35e911cda6 has been pushed to the Fedora 34 stable repository.
If problem still persists, 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.