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 1959918 - hdparm --dco-identify produces invalid Real max sectors output for some drives
Summary: hdparm --dco-identify produces invalid Real max sectors output for some drives
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 8
Classification: Red Hat
Component: hdparm
Version: CentOS Stream
Hardware: x86_64
OS: All
unspecified
medium
Target Milestone: beta
: ---
Assignee: Tomáš Bžatek
QA Contact: Robin Hack
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2021-05-12 15:53 UTC by Michal Grzedzicki
Modified: 2021-11-10 08:42 UTC (History)
4 users (show)

Fixed In Version: hdparm-9.54-4.el8
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2021-11-09 19:44:15 UTC
Type: Bug
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
Patch backporting upstream fix to hdparm package (3.23 KB, patch)
2021-05-12 15:53 UTC, Michal Grzedzicki
no flags Details | Diff
Patch backporting upstream fix to hdparm package (4.32 KB, patch)
2021-05-13 10:01 UTC, Michal Grzedzicki
no flags Details | Diff


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2021:4421 0 None None None 2021-11-09 19:44:17 UTC

Description Michal Grzedzicki 2021-05-12 15:53:46 UTC
Created attachment 1782457 [details]
Patch backporting upstream fix to hdparm package

Description of problem:
hdparm --dco-identify produces invalid Real max sectors output for drives with certain sizes.

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


How reproducible:
Can be reliably reproduced on affected drives like Seagate XF1230 1920GB.
The drives need to have certain sizes to trigger the issue.

Steps to Reproduce:
1. run hdparm --dco-identify /dev/sdd


Actual results:
/dev/sdd:
DCO Checksum verified.
DCO Revision: 0x0002
The following features can be selectively disabled via DCO:
Transfer modes:
mdma0 mdma1 mdma2
udma0 udma1 udma2 udma3 udma4 udma5 udma6
Real max sectors: 18446744073165333168
ATA command/feature sets:
SMART self_test error_log security 48_bit
SATA command/feature sets:
interface_power_management SSP

Expected results:
/dev/sdd:
DCO Checksum verified.
DCO Revision: 0x0002
The following features can be selectively disabled via DCO:
Transfer modes:
mdma0 mdma1 mdma2
udma0 udma1 udma2 udma3 udma4 udma5 udma6
Real max sectors: 3750748848
ATA command/feature sets:
SMART self_test error_log security 48_bit
SATA command/feature sets:
interface_power_management SSP

Additional info:
Real max sectors value is incorrect.

calculation is using bitshift operations, if shift result value has most significant bit set it's treated as signed negative value and extended as such to 64 bit value (filled with 1-s instead of 0's).

The issue is more clear if we look at hex values.

Incorrect value:
hex(18446744073165333168) = 0xffffffffdf8fe2b0

Expected value:
hex(3750748848) = 0xdf8fe2b0


Reported and fixed upstream in https://sourceforge.net/p/hdparm/bugs/87/ (triggered the release of 9.62). Attached patch backports the upstream fix to 9.54.

Comment 1 Michal Grzedzicki 2021-05-13 10:01:51 UTC
Created attachment 1782689 [details]
Patch backporting upstream fix to hdparm package

Comment 3 Davide Cavalca 2021-05-18 19:44:38 UTC
I filed https://bugzilla.redhat.com/show_bug.cgi?id=1961841 to get this fixed in c9s as well, and put up https://gitlab.com/redhat/centos-stream/rpms/hdparm/-/merge_requests/4 to that end.

Comment 5 Tomáš Bžatek 2021-05-19 13:32:21 UTC
Thanks for the contribution, this is really helpful!

I've read through the patch and tried to find a drive nearby to trigger the issue, no luck so far.

Comment 9 Michal Grzedzicki 2021-05-20 10:46:03 UTC
(In reply to Tomáš Bžatek from comment #5)
> Thanks for the contribution, this is really helpful!
> 
> I've read through the patch and tried to find a drive nearby to trigger the
> issue, no luck so far.

Yeah it's tricky to reproduce, not many drives are in the size range triggering this, we noticed this after processing hundreds of drives.
To test it I created a reproducer based on the data caught by strace.

Comment 10 Michal Grzedzicki 2021-05-20 10:47:03 UTC
(In reply to Tomáš Bžatek from comment #5)
> Thanks for the contribution, this is really helpful!
> 
> I've read through the patch and tried to find a drive nearby to trigger the
> issue, no luck so far.

I have access to the hardware and can test the rpm if that helps.

Comment 20 errata-xmlrpc 2021-11-09 19:44:15 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 (hdparm 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-2021:4421


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