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 920687 - "sginfo -l" should not open /dev/snapshot
Summary: "sginfo -l" should not open /dev/snapshot
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: sg3_utils
Version: 6.4
Hardware: All
OS: Linux
high
medium
Target Milestone: rc
: ---
Assignee: Dan Horák
QA Contact: Jan Kepler
URL:
Whiteboard:
Depends On:
Blocks: 835616 1020324
TreeView+ depends on / blocked
 
Reported: 2013-03-12 14:43 UTC by J.H.M. Dassen (Ray)
Modified: 2018-12-01 16:46 UTC (History)
5 users (show)

Fixed In Version: sg3_utils-1.28-5.el6
Doc Type: Bug Fix
Doc Text:
Cause: The logic used in the show_devices() function (as used by "sginfo") to identify the available storage devices opens devices rather indiscriminately. Consequence: /dev/snapshot was opened, causing the system to prepare for suspend/hibernate and (as part of that) to block hot-added CPUs from being activated. Fix: The logic used in the show_devices() function to decide which devices to open was adjusted. Result: Running "sginfo -l" no longer has the unintended side effect of blocking the activation of hot-added CPUs.
Clone Of:
: 1020324 (view as bug list)
Environment:
Last Closed: 2013-06-19 13:48:25 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
Patch to prevent /dev/snapshot from being opened (545 bytes, patch)
2013-04-09 10:42 UTC, J.H.M. Dassen (Ray)
no flags Details | Diff


Links
System ID Private Priority Status Summary Last Updated
Red Hat Bugzilla 920681 0 medium CLOSED /dev/snapshot's design is accident prone 2021-02-22 00:41:40 UTC
Red Hat Knowledge Base (Solution) 327713 0 None None None Never
Red Hat Product Errata RHBA-2013:0956 0 normal SHIPPED_LIVE sg3_utils bug fix update 2013-06-19 17:48:01 UTC

Internal Links: 920681

Description J.H.M. Dassen (Ray) 2013-03-12 14:43:45 UTC
Description of problem:
"sginfo -l" opens /dev/snapshot which is unfortunately not a side effects free operation (cf. bug #920681). sg3_utils should not touch this device.

Version-Release number of selected component (if applicable):
1.28-4.el6

How reproducible:
100%

Steps to Reproduce:
1. strace -f -s128 -e file sginfo -l
  
Actual results:
[...]
2163  open("/dev", O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC) = 3
2163  open("/dev/stderr", O_RDONLY|O_NONBLOCK) = 4
2163  open("/dev/stdout", O_RDONLY|O_NONBLOCK) = 4
2163  open("/dev/stdin", O_RDONLY|O_NONBLOCK) = 4
2163  open("/dev/systty", O_RDONLY|O_NONBLOCK) = 4
2163  open("/dev/network_throughput", O_RDONLY|O_NONBLOCK) = 4
2163  open("/dev/network_latency", O_RDONLY|O_NONBLOCK) = 4
2163  open("/dev/nvram", O_RDONLY|O_NONBLOCK) = 4
2163  open("/dev/snapshot", O_RDONLY|O_NONBLOCK) = 4
2163  open("/dev/null", O_RDONLY|O_NONBLOCK) = 4
2163  open("/dev/sg0", O_RDWR|O_NONBLOCK) = -1 ENOENT (No such file or directory)
[...]

Expected results:
Ideally: "sginfo -l" does not attempt to open non-storage devices.
Realistically: "sginfo -l" does not attempt to open /dev/snapshot .

Additional info:
The show_devices() function in src/sginfo.c loops over the entries in /dev, opening those that are character or block devices whose name starts with "n" or "s", opens them and attempts to obtain storage-related information from them.

Comment 2 J.H.M. Dassen (Ray) 2013-04-09 10:42:26 UTC
Created attachment 733138 [details]
Patch to prevent /dev/snapshot from being opened

Comment 3 J.H.M. Dassen (Ray) 2013-04-09 10:55:14 UTC
Simple patch added, intended to achieve the realistically expected result.

Changing show_devices() to use sysfs entries to identify storage devices would be a lot cleaner (aligned with the ideally expected result), but also a much more sizeable change.

Comment 6 Dan Horák 2013-04-15 09:15:28 UTC
(In reply to comment #3)
> Simple patch added, intended to achieve the realistically expected result.
> 
> Changing show_devices() to use sysfs entries to identify storage devices
> would be a lot cleaner (aligned with the ideally expected result), but also
> a much more sizeable change.

for the change to use sysfs please talk to the sg3_utils upstream directly, making this bug and the related kernel one public would also help him

Comment 7 J.H.M. Dassen (Ray) 2013-04-15 09:54:55 UTC
Uncloaking this bugzilla - Engineering requested this be opened up to facilitate communication with upstream and Global Support Services has not identified any sensitive data in or attached to this bugzilla.

Comment 8 Dan Horák 2013-04-17 08:54:45 UTC
Reply from upstream author for the record -

sginfo has been in legacy support mode for about 10 years
as far as I'm concerned. Perhaps I should state that more
clearly. There a very few things that it does, that my
newer utilities don't do better and in a cleaner way (e.g.
listing defect blocks is one thing sginfo does that none of
my other utilities do, but that is probably only useful to
the disk manufacturers (or someone trying to reverse
engineer a disk)). sginfo was a quick hack conversion of
scsiinfo to test sg devices circa 1998. Linux 2.0 vintage,
with no devfs, sysfs (and thus lsscsi). A system with 20 SCSI
devices was huge ...

But it doesn't change the fact we can and will apply the fix in the package.

Comment 13 errata-xmlrpc 2013-06-19 13:48:25 UTC
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/RHBA-2013-0956.html


Note You need to log in before you can comment on or make changes to this bug.