Bug 1385410

Summary: python-dmidecode segfaults when reading invalid dmidecode data
Product: Red Hat Enterprise Linux 7 Reporter: David Pinkerton <dpinkert>
Component: python-dmidecodeAssignee: Petr Oros <poros>
Status: CLOSED ERRATA QA Contact: Mike Gahagan <mgahagan>
Severity: medium Docs Contact:
Priority: high    
Version: 7.2CC: danken
Target Milestone: rcKeywords: ZStream
Target Release: 7.4   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: python-dmidecode-3.12.2-1.el7 Doc Type: Bug Fix
Doc Text:
Previously, the dmidecode Python module did not check for presence of entries in the Desktop Management Interface (DMI) table and was unable to handle malformed data when querying the DMI table. As a consequence, when querying a non-existent or invalid DMI table entry, the dmidecode module terminated unexpectedly with a segmentation fault. This update adds a check for the presence and format of the DMI table entries. As a result, the dmidecode module no longer terminates with a segmentation fault when querying malformed DMI tables, and correctly returns empty data in the described situation.
Story Points: ---
Clone Of:
: 1431702 (view as bug list) Environment:
Last Closed: 2017-08-01 19:18:00 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:
Bug Depends On:    
Bug Blocks: 1394638, 1404314, 1431702    
Attachments:
Description Flags
All the logs and pythong codes used to isolate fault. none

Description David Pinkerton 2016-10-16 22:28:32 UTC
Created attachment 1211145 [details]
All the logs and pythong codes used to isolate fault.

Description of problem:


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

rhel7.2
python-dmidecode-3.10.13-11.el7.x86_64

How reproducible:


Steps to Reproduce:
1. Tried to install RHV4 on Supermicro Servers
2. Ran the attached python code to isolate error to OS.
3.

Actual results:

python-dmidecode segfaults


Expected results:

output of dmidecode information


Additional info:

With the help of Dan Kenigsberg and Nir Soffer ran the following steps to isolate initial error (RHV4 installation failure) to python-dmidecode)

sudo debuginfo-install -y python
sudo gdb python
(gdb) run

from vdsm import dmidecodeUtil
dmidecodeUtil.getHardwareInfoStructure()

(gdb) thread apply all bt full



I used the attached python dmidecode code to confirm issue was python-dmidecode-3.10.13-11.el7.x86_64.


Installed fedora24 package (python-dmidecode-3.12.2-3.fc24.x86_64)
This worked successfully.  I was able to successfully install RHV4

Comment 7 Mike Gahagan 2017-04-19 19:04:21 UTC
Confirmed updated python-dmidecode has fixed this issue:

python-dmidecode-3.12.2-1.el7.x86_64
>>> import dmidecode
>>> dmidecode.get_dev()
'/dev/mem'
>>> dmidecode.set_dev("./dmidecode-dump-bin")
True
>>> dmidecode.get_dev()
'./dmidecode-dump-bin'
>>> dmidecode.QuerySection('bios')
{'0x000d': {'dmi_type': 0, 'data': {'Vendor': '', 'Characteristics': {'NEC PC-98': False, 'EDD is supported': False, 'PC Card (PCMCIA) is supported': False, '3.5"/2.88 MB floppy services are supported (int 13h)': False, '5.25"/360 kB floppy services are supported (int 13h)': True, 'Printer services are supported (int 17h)': False, 'BIOS is upgradeable': False, '8042 keyboard services are supported (int 9h)': True, 'BIOS shadowing is allowed': True, 'BIOS ROM is socketed': True, 'APM is supported': False, 'PNP is supported': False, 'VLB is supported': False, 'ISA is supported': False, 'Japanese floppy for Toshiba 1.2 MB is supported (int 13h)': False, 'CGA/mono video services are supported (int 10h)': True, 'Serial services are supported (int 14h)': False, '3.5"/720 kB floppy services are supported (int 13h)': True, 'MCA is supported': False, 'PCI is supported': False, '5.25"/1.2 MB floppy services are supported (int 13h)': False, 'Selectable boot is supported': True, 'Japanese floppy for NEC 9800 1.2 MB is supported (int 13h)': False, 'EISA is supported': False, 'Boot from PC Card (PCMCIA) is supported': False, 'ESCD support is available': True, 'Boot from CD is supported': False, 'Print screen service is supported (int 5h)': False}, 'Runtime Size': '1040336 bytes', 'BIOS Revision': '0.1', 'Version': '', 'ROM Size': '832 KB', 'Characteristic x2': {'System is a virtual machine': False, 'UEFI is supported': False, 'Targeted content distribution': False, 'Function key-initiated network boot': False, 'BIOS boot specification': False}, 'Address': '0x02030', 'Release Date': '', 'Characteristic x1': {'I2O boot': False, 'USB legacy': False, 'ATAPI Zip drive boot': False, 'Smart battery': False, 'IEEE 1394 boot': False, 'ACPI': False, 'LS-120 boot': False, 'AGP': False}}, 'dmi_handle': '0x000d', 'dmi_size': 252}, '0x000e': {'dmi_type': 0, 'data': {'Vendor': None, 'Characteristics': {}, 'Runtime Size': ' ', 'BIOS Revision': None, 'Version': None, 'ROM Size': ' ', 'Characteristic x2': {}, 'Address': None, 'Release Date': None, 'Characteristic x1': {}}, 'dmi_handle': '0x000e', 'dmi_size': 17}, '0x0000': {'dmi_type': 0, 'data': {'Vendor': 'American Megatrends Inc.', 'Characteristics': {'NEC PC-98': False, 'EDD is supported': True, 'PC Card (PCMCIA) is supported': False, '3.5"/2.88 MB floppy services are supported (int 13h)': True, '5.25"/360 kB floppy services are supported (int 13h)': False, 'Printer services are supported (int 17h)': True, 'BIOS is upgradeable': True, '8042 keyboard services are supported (int 9h)': True, 'BIOS shadowing is allowed': True, 'BIOS ROM is socketed': True, 'APM is supported': True, 'PNP is supported': True, 'VLB is supported': False, 'ISA is supported': True, 'Japanese floppy for Toshiba 1.2 MB is supported (int 13h)': False, 'CGA/mono video services are supported (int 10h)': True, 'Serial services are supported (int 14h)': True, '3.5"/720 kB floppy services are supported (int 13h)': True, 'MCA is supported': False, 'PCI is supported': True, '5.25"/1.2 MB floppy services are supported (int 13h)': True, 'Selectable boot is supported': True, 'Japanese floppy for NEC 9800 1.2 MB is supported (int 13h)': False, 'EISA is supported': False, 'Boot from PC Card (PCMCIA) is supported': False, 'ESCD support is available': True, 'Boot from CD is supported': True, 'Print screen service is supported (int 5h)': True}, 'Runtime Size': '64 KB', 'BIOS Revision': '8.14', 'Version': '080014 ', 'ROM Size': '1024 KB', 'Characteristic x2': {'System is a virtual machine': True, 'UEFI is supported': False, 'Targeted content distribution': False, 'Function key-initiated network boot': True, 'BIOS boot specification': True}, 'Address': '0xf0000', 'Release Date': '10/22/2009', 'Characteristic x1': {'I2O boot': False, 'USB legacy': True, 'ATAPI Zip drive boot': True, 'Smart battery': False, 'IEEE 1394 boot': False, 'ACPI': True, 'LS-120 boot': True, 'AGP': False}}, 'dmi_handle': '0x0000', 'dmi_size': 24}}
# also works with 'system' and 'processor'


with python-dmidecode-3.10.13-11.el7.x86_64:

>>> import dmidecode
>>> dmidecode.get_dev()
'/dev/mem'
>>> dmidecode.set_dev("./dmidecode-dump-bin")
True
>>> dmidecode.QuerySection('bios')
Segmentation fault

Comment 8 errata-xmlrpc 2017-08-01 19:18:00 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/RHEA-2017:2080