Bug 2091417 - SELinux is preventing ksmctl from 'add_name' accesses on the cartella run.
Summary: SELinux is preventing ksmctl from 'add_name' accesses on the cartella run.
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: selinux-policy
Version: 36
Hardware: x86_64
OS: Unspecified
medium
medium
Target Milestone: ---
Assignee: Zdenek Pytela
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard: abrt_hash:6538942e7159cd9f0a099166391...
: 2091416 2091418 (view as bug list)
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2022-05-29 18:05 UTC by Davide Repetto
Modified: 2022-08-05 01:34 UTC (History)
9 users (show)

Fixed In Version: selinux-policy-36.13-3.fc36
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2022-08-05 01:34:32 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Github fedora-selinux selinux-policy pull 1245 0 None open Allow ksmctl create hardware state information files 2022-06-17 18:50:40 UTC

Description Davide Repetto 2022-05-29 18:05:25 UTC
Description of problem:
This happens at boot, even after "fixfiles onboot", together with another 10 AVCs.

SELinux is preventing ksmctl from 'add_name' accesses on the cartella run.

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

Se ci credi ksmctl dovrebbe essere consentito add_name accesso al run directory per impostazione predefinita.
Then si dovrebbe riportare il problema come bug.
E' possibile generare un modulo di politica locale per consentire questo accesso.
Do
consentire questo accesso per ora eseguendo:
# ausearch -c 'ksmctl' --raw | audit2allow -M my-$MODULE_NOME
# semodule -X 300 -i miei-ksmctl.pp

Additional Information:
Source Context                system_u:system_r:ksm_t:s0
Target Context                system_u:object_r:sysfs_t:s0
Target Objects                run [ dir ]
Source                        ksmctl
Source Path                   ksmctl
Port                          <Sconosciuto>
Host                          (removed)
Source RPM Packages           
Target RPM Packages           filesystem-3.16-2.fc36.x86_64
SELinux Policy RPM            selinux-policy-targeted-36.9-1.fc36.noarch
Local Policy RPM              selinux-policy-targeted-36.9-1.fc36.noarch
Selinux Enabled               True
Policy Type                   targeted
Enforcing Mode                Permissive
Host Name                     (removed)
Platform                      Linux (removed) 5.17.11-300.fc36.x86_64 #1 SMP
                              PREEMPT Wed May 25 15:04:05 UTC 2022 x86_64 x86_64
Alert Count                   1
First Seen                    2022-05-29 19:59:57 CEST
Last Seen                     2022-05-29 19:59:57 CEST
Local ID                      a6672d66-e7e4-44ce-bec7-4e2274e56ceb

Raw Audit Messages
type=AVC msg=audit(1653847197.728:233): avc:  denied  { add_name } for  pid=1174 comm="ksmctl" name="run" scontext=system_u:system_r:ksm_t:s0 tcontext=system_u:object_r:sysfs_t:s0 tclass=dir permissive=1


Hash: ksmctl,ksm_t,sysfs_t,dir,add_name

Version-Release number of selected component:
selinux-policy-targeted-36.9-1.fc36.noarch

Additional info:
component:      selinux-policy
reporter:       libreport-2.17.1
hashmarkername: setroubleshoot
kernel:         5.17.11-300.fc36.x86_64
type:           libreport

Comment 1 Zdenek Pytela 2022-05-30 13:04:32 UTC
Davide,

Could you please gather all the denials in full auditing mode?

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 recent

Comment 2 Zdenek Pytela 2022-05-30 13:17:24 UTC
*** Bug 2091418 has been marked as a duplicate of this bug. ***

Comment 3 Zdenek Pytela 2022-05-30 13:17:34 UTC
*** Bug 2091416 has been marked as a duplicate of this bug. ***

Comment 4 Davide Repetto 2022-06-03 12:36:43 UTC
Similar problem has been detected:

Description of the problem:
===================
This happens at boot, even after "fixfiles onboot"

here are the denials data in in full auditing mode.

# ausearch -i -m avc,user_avc,selinux_err,user_selinux_err -ts recent
----
type=PROCTITLE msg=audit(03/06/2022 14:23:34.678:235) : proctitle=/usr/libexec/ksmctl start 
type=PATH msg=audit(03/06/2022 14:23:34.678:235) : item=1 name=/sys/kernel/mm/ksm/run inode=5435 dev=00:17 mode=file,644 ouid=root ogid=root rdev=00:00 obj=system_u:object_r:sysfs_t:s0 nametype=NORMAL cap_fp=none cap_fi=none cap_fe=0 cap_fver=0 cap_frootid=0 
type=PATH msg=audit(03/06/2022 14:23:34.678:235) : item=0 name=/sys/kernel/mm/ksm/ inode=5432 dev=00:17 mode=dir,755 ouid=root ogid=root rdev=00:00 obj=system_u:object_r:sysfs_t:s0 nametype=PARENT cap_fp=none cap_fi=none cap_fe=0 cap_fver=0 cap_frootid=0 
type=CWD msg=audit(03/06/2022 14:23:34.678:235) : cwd=/ 
type=SYSCALL msg=audit(03/06/2022 14:23:34.678:235) : arch=x86_64 syscall=openat success=yes exit=3 a0=AT_FDCWD a1=0x558a0ea3603f a2=O_WRONLY|O_CREAT|O_TRUNC a3=0x1b6 items=2 ppid=1 pid=1153 auid=unset uid=root gid=root euid=root suid=root fsuid=root egid=root sgid=root fsgid=root tty=(none) ses=unset comm=ksmctl exe=/usr/libexec/ksmctl subj=system_u:system_r:ksm_t:s0 key=(null) 
type=AVC msg=audit(03/06/2022 14:23:34.678:235) : avc:  denied  { create } for  pid=1153 comm=ksmctl name=run scontext=system_u:system_r:ksm_t:s0 tcontext=system_u:object_r:sysfs_t:s0 tclass=file permissive=1 
type=AVC msg=audit(03/06/2022 14:23:34.678:235) : avc:  denied  { add_name } for  pid=1153 comm=ksmctl name=run scontext=system_u:system_r:ksm_t:s0 tcontext=system_u:object_r:sysfs_t:s0 tclass=dir permissive=1 
type=AVC msg=audit(03/06/2022 14:23:34.678:235) : avc:  denied  { write } for  pid=1153 comm=ksmctl name=ksm dev="sysfs" ino=5432 scontext=system_u:system_r:ksm_t:s0 tcontext=system_u:object_r:sysfs_t:s0 tclass=dir permissive=1 
----

hashmarkername: setroubleshoot
kernel:         5.17.11-300.fc36.x86_64
package:        selinux-policy-targeted-36.10-1.fc36.noarch
reason:         SELinux is preventing /usr/libexec/ksmctl from 'write' accesses on the cartella /sys/kernel/mm/ksm/run.
type:           libreport

Comment 5 Davide Repetto 2022-06-03 12:44:41 UTC
After the upgrade to selinux-policy-36.10-1 this specific AVC changed to the one above.
As you can see I included the denials in in full auditing mode as requested.

Comment 6 Davide Repetto 2022-06-03 22:25:01 UTC
Similar problem has been detected:

This AVC still happens at boot with selinux-policy-36.10-1



hashmarkername: setroubleshoot
kernel:         5.17.11-300.fc36.x86_64
package:        selinux-policy-targeted-36.10-1.fc36.noarch
reason:         SELinux is preventing ksmctl from 'create' accesses on the file run.
type:           libreport

Comment 7 Davide Repetto 2022-06-03 22:26:14 UTC
Similar problem has been detected:

This AVC still happens at boot with selinux-policy-36.10-1


hashmarkername: setroubleshoot
kernel:         5.17.11-300.fc36.x86_64
package:        selinux-policy-targeted-36.10-1.fc36.noarch
reason:         SELinux is preventing ksmctl from 'write' accesses on the cartella ksm.
type:           libreport

Comment 8 Milos Malik 2022-06-07 15:18:01 UTC
Test coverage for this bug exists in a form of PR:
 * https://src.fedoraproject.org/tests/selinux/pull-request/307

The PR waits for review.

Comment 9 aannoaanno 2022-06-19 09:21:45 UTC
Problem still persists on my f36 installation

Comment 10 Fedora Update System 2022-06-30 07:25:44 UTC
FEDORA-2022-fd22b79a84 has been submitted as an update to Fedora 36. https://bodhi.fedoraproject.org/updates/FEDORA-2022-fd22b79a84

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

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

Comment 12 Fedora Update System 2022-07-16 01:12:43 UTC
FEDORA-2022-320775eb9a has been pushed to the Fedora 36 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --refresh --advisory=FEDORA-2022-320775eb9a`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2022-320775eb9a

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

Comment 13 Fedora Update System 2022-08-04 02:41:47 UTC
FEDORA-2022-139ec288ca has been pushed to the Fedora 36 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --refresh --advisory=FEDORA-2022-139ec288ca`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2022-139ec288ca

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

Comment 14 Fedora Update System 2022-08-05 01:34:32 UTC
FEDORA-2022-139ec288ca has been pushed to the Fedora 36 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.