Bug 1700494

Summary: sscanf parsing bug in get_sysfs_stats() - net-snmp-5.7.2-diskio-whitelist.patch
Product: Red Hat Enterprise Linux 7 Reporter: Chris Cheney <ccheney>
Component: net-snmpAssignee: Josef Ridky <jridky>
Status: CLOSED ERRATA QA Contact: David Jež <djez>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.6CC: djez, fkrska, ovasik
Target Milestone: rcKeywords: Patch, Reproducer
Target Release: ---   
Hardware: All   
OS: All   
Whiteboard:
Fixed In Version: net-snmp-5.7.2-44.el7 Doc Type: No Doc Update
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-03-31 19:54:44 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:
Bug Depends On:    
Bug Blocks: 1716965    

Description Chris Cheney 2019-04-16 17:59:22 UTC
Description of problem:

In the patch net-snmp-5.7.2-diskio-whitelist.patch there is a parsing bug in the following line:

if (sscanf (buffer, "%*[ \n\t]%lu%*[ \n\t]%lu%*[ \n\t]%lu%*[ \n\t]%lu%*[ \n\t]%lu%*[ \n\t]%lu%*[ \n\t]%lu%*[ \n\t]%lu%*[ \n\t]%lu%*[ \n\t]%lu%*[ \n\t]%lu\n",

If the /sys/dev/block/%d:%d/stat file has no preceding spaces, due to the number being very high, it will cause the sscanf to fail resulting in all 0's

eg

# cat stat
12379520        0 33751628   215116  1514946        0 20842087   127654        0   165055   342776

The line should likely be the following instead:

if (sscanf (buffer, "%lu%*[ \n\t]%lu%*[ \n\t]%lu%*[ \n\t]%lu%*[ \n\t]%lu%*[ \n\t]%lu%*[ \n\t]%lu%*[ \n\t]%lu%*[ \n\t]%lu%*[ \n\t]%lu%*[ \n\t]%lu\n",


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

net-snmp-5.7.2-37.el7.x86_64


How reproducible:

Any time /sys/dev/block/%d:%d/stat has no preceding spaces.

Comment 7 errata-xmlrpc 2020-03-31 19:54:44 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.

https://access.redhat.com/errata/RHSA-2020:1081