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.
Cause:
lsblk opens block devices to check if the device is in read-only mode, although the information is available in /sys.
Consequence:
unexpected selinux alerts, unnecessary open() call
Fix:
now lsblk is less aggressive and reads the info from /sys filesystem
Description of problem:
lsblk was meant as debugging utility which is usable even in situation when e.g. device-mapper devices are suspended, multipath devices are blocked etc.
It should (in default mode) read only information from /sys and /pro (IOW read only virtual filesystems).
Unfortunately in RHEL6 version it uses check_mount_point() function (formerly from ext utils) which tries to open device (to check if it can be opened exclusively.)
This is wrong and should be avoided (it will perhaps produce even some selinux alerts - lsblk can be run from use account.)
In upstream this problem is already solved by using libmount.
Moreover, there is bug in scanning "ro" sysfs attribute which causes another device open
(one line fix).
Version-Release number of selected component (if applicable):
util-linux-ng-2.17.2-12.7.el6.i686
How reproducible:
# strace lsblk /dev/sda1 2>&1 |grep open\( |grep sda1
open("/sys/block/sda/sda1", O_RDONLY|O_LARGEFILE) = 4
open("/dev/sda1", O_RDONLY|O_LARGEFILE) = 5
open("/dev/sda1", O_RDONLY|O_EXCL|O_LARGEFILE) = -1 EBUSY (Device or resource busy)
(these are wrong)
Expected results:
Do not open device at all.
Note that RHEL6 lsblk rebase fixes the problem with "ro" attribute only. Now it correctly reads the attribute from /sys and BLKROGET ioctl is unnecessary.
The rebase does not remove the check_mount_point() code and O_RDONLY|O_EXCL, because we don't want to backport whole libmount too...
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, and where to find the updated
files, follow the link below.
If the solution does not work for you, open a new bug report.
http://rhn.redhat.com/errata/RHSA-2013-0517.html
Description of problem: lsblk was meant as debugging utility which is usable even in situation when e.g. device-mapper devices are suspended, multipath devices are blocked etc. It should (in default mode) read only information from /sys and /pro (IOW read only virtual filesystems). Unfortunately in RHEL6 version it uses check_mount_point() function (formerly from ext utils) which tries to open device (to check if it can be opened exclusively.) This is wrong and should be avoided (it will perhaps produce even some selinux alerts - lsblk can be run from use account.) In upstream this problem is already solved by using libmount. Moreover, there is bug in scanning "ro" sysfs attribute which causes another device open (one line fix). Version-Release number of selected component (if applicable): util-linux-ng-2.17.2-12.7.el6.i686 How reproducible: # strace lsblk /dev/sda1 2>&1 |grep open\( |grep sda1 open("/sys/block/sda/sda1", O_RDONLY|O_LARGEFILE) = 4 open("/dev/sda1", O_RDONLY|O_LARGEFILE) = 5 open("/dev/sda1", O_RDONLY|O_EXCL|O_LARGEFILE) = -1 EBUSY (Device or resource busy) (these are wrong) Expected results: Do not open device at all.