Bug 2085392
Summary: | SELinux prevents dbus-broker from ioctl and getopt on a unix_stream_socket labeled kernel_t | ||
---|---|---|---|
Product: | Red Hat Enterprise Linux 9 | Reporter: | Bruno Goncalves <bgoncalv> |
Component: | selinux-policy | Assignee: | Nikola Knazekova <nknazeko> |
Status: | CLOSED ERRATA | QA Contact: | Milos Malik <mmalik> |
Severity: | medium | Docs Contact: | |
Priority: | medium | ||
Version: | CentOS Stream | CC: | bstinson, jwboyer, lvrabec, mmalik, nknazeko, omosnace, ssekidde, zpytela |
Target Milestone: | rc | Keywords: | Triaged |
Target Release: | 9.1 | ||
Hardware: | s390x | ||
OS: | Linux | ||
Whiteboard: | |||
Fixed In Version: | selinux-policy-34.1.41-1.el9 | Doc Type: | Bug Fix |
Doc Text: |
Cause:
Systemd creates and starts to listen on the socket before SELinux policy is loaded and it inherits the kernel secid as its label.
Consequence:
SELinux is preventing system_dbusd ioctl kernel with a unix stream sockets.
Fix:
Allow system_dbusd ioctl kernel with a unix stream sockets. Create interface to allow the specified domain to ioctl a kernel with a unix domain stream sockets
Result:
No AVC
|
Story Points: | --- |
Clone Of: | Environment: | ||
Last Closed: | 2022-11-15 11:13:50 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: |
Description
Bruno Goncalves
2022-05-13 08:55:02 UTC
Bruno, We need to have more information, preferably reproducing steps, or also access to the system if you happen to catch it again. Full auditing may also help if set prior to the denial: 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 Ondro, Can you help us with understanding what is going on here and to assess if the request is legit, either from SELinux PoV or s390x kernel? If I am not mistaken, it is TIOCOUTQ: https://access.redhat.com/labs/rhcb/RHEL-9.0/kernel-5.14.0-70.13.1.el9/source/blob/include/uapi/asm-generic/ioctls.h#L36 #define TIOCOUTQ 0x5411 https://access.redhat.com/labs/rhcb/RHEL-9.0/kernel-5.14.0-70.13.1.el9/source/blob/include/uapi/linux/sockios.h#L27#define SIOCOUTQ TIOCOUTQ /* output queue size (not sent + not acked) */ Yes, I think the ioctl is legitimate. The label is kernel_t probably because systemd creates and starts to listen on this socket before SELinux policy is loaded and it inherits the kernel secid as its label. (This is the same problem as with the journal socket.) The getopt is probably fine as well (dbusd just wants to get some info about the socket, likely for performance reasons). BTW, tcp(7) has a slightly more verbose description of SIOCOUTQ/TIOCOUTQ: SIOCOUTQ Returns the amount of unsent data in the socket send queue. The socket must not be in LISTEN state, otherwise an error (EINVAL) is returned. SIOCOUTQ is defined in <linux/sockios.h>. Alternatively, you can use the synonymous TIOCOUTQ, defined in <sys/ioctl.h>. I have been trying to reproduce this issue with full audit enabled, but so far I had no luck reproducing it... Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory (selinux-policy bug fix and enhancement update), and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. https://access.redhat.com/errata/RHBA-2022:8283 |