Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 2217872

Summary: USB device nodes are not always properly labeled with "usb_device_t"
Product: Red Hat Enterprise Linux 8 Reporter: Renaud Métrich <rmetrich>
Component: selinux-policyAssignee: Zdenek Pytela <zpytela>
Status: CLOSED MIGRATED QA Contact: Milos Malik <mmalik>
Severity: medium Docs Contact:
Priority: low    
Version: 8.8CC: jeperez, lvrabec, mmalik, nknazeko, omosnace, sgandhi, zpytela
Target Milestone: rcKeywords: MigratedToJIRA, Triaged
Target Release: ---Flags: pm-rhel: mirror+
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2023-09-02 01:00:05 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 Renaud Métrich 2023-06-27 10:32:54 UTC
Description of problem:

We have transition rules to label /dev/bus/usb/XXX/YYY nodes appropriately with "usb_device_t".
This is done in policy/modules/kernel/devices.if:
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------
        filetrans_pattern($1, device_t, usb_device_t, chr_file, "000")
        filetrans_pattern($1, device_t, usb_device_t, chr_file, "001")
        filetrans_pattern($1, device_t, usb_device_t, chr_file, "002")
 :
        filetrans_pattern($1, device_t, usb_device_t, chr_file, "027")
        filetrans_pattern($1, device_t, usb_device_t, chr_file, "028")
        filetrans_pattern($1, device_t, usb_device_t, chr_file, "029")
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------

Unfortunately this hardcoded list is not sufficient, because some hardware devices are enumerated with numbers > 029, e.g.:
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------
$ grep 094 sos_commands/usb/lsusb
Bus 001 Device 094: ID 0a5c:5842 Broadcom Corp. 

$ grep -w 94 sos_commands/usb/lsusb_-t 
    |__ Port 10: Dev 94, If 0, Class=Application Specific Interface, Driver=, 480M
    |__ Port 10: Dev 94, If 1, Class=Chip/SmartCard, Driver=usbfs, 480M
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------

We need hence to add more device names, ideally a regex should be used, but I doubt this is supported at all.

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

selinux-policy-3.14.3-117.el8.noarch
Also applies to RHEL9, from sources of the policy

How reproducible:

Always on customer system

Comment 1 Zdenek Pytela 2023-06-27 12:03:05 UTC
Regular expressions are not supported in transitions yet in current kernels.
These particular file transitions are quite troublesome since the path is not a part the definition, so can possibly affect other files in the /dev tree.

Comment 2 Zdenek Pytela 2023-07-24 17:54:42 UTC
Renaud,

Will it be possible to troubleshoot this case further? We'd like to know what are the udev events which pop when the devices are created: add, bind, some other, more of them at once, at which order? The udev service should run restorecon for each device created by kernel, but it may happen that this code path may be executed only for add events.

I can't see any udev logs attached, so perhaps udevadm monitor can be used to gather the data.

Comment 5 Renaud Métrich 2023-08-16 07:59:18 UTC
From "udevadm monitor" output, the nodes udev is aware is /devices/... nodes, not /dev/bus/usb/xxx/yyy ones, explaining the issue.
The latter nodes are directly created by the kernel driver (in customer's case it's the Broadcom device, running as "kernel_t").

Comment 7 RHEL Program Management 2023-09-02 00:59:25 UTC
Issue migration from Bugzilla to Jira is in process at this time. This will be the last message in Jira copied from the Bugzilla bug.

Comment 8 RHEL Program Management 2023-09-02 01:00:05 UTC
This BZ has been automatically migrated to the issues.redhat.com Red Hat Issue Tracker. All future work related to this report will be managed there.

Due to differences in account names between systems, some fields were not replicated.  Be sure to add yourself to Jira issue's "Watchers" field to continue receiving updates and add others to the "Need Info From" field to continue requesting information.

To find the migrated issue, look in the "Links" section for a direct link to the new issue location. The issue key will have an icon of 2 footprints next to it, and begin with "RHEL-" followed by an integer.  You can also find this issue by visiting https://issues.redhat.com/issues/?jql= and searching the "Bugzilla Bug" field for this BZ's number, e.g. a search like:

"Bugzilla Bug" = 1234567

In the event you have trouble locating or viewing this issue, you can file an issue by sending mail to rh-issues.