Bug 835542

Summary: Test case failure: /CoreOS/ipmitool/Regression/bz311231-ipmitool-does-not-check-input-values
Product: Red Hat Enterprise Linux 7 Reporter: Karel Volný <kvolny>
Component: ipmitoolAssignee: Ales Ledvinka <aledvink>
Status: CLOSED CURRENTRELEASE QA Contact: qe-baseos-daemons
Severity: medium Docs Contact:
Priority: medium    
Version: 7.0CC: azelinka, jscotka, tsmetana
Target Milestone: rcKeywords: Regression
Target Release: ---   
Hardware: Unspecified   
OS: Linux   
Whiteboard:
Fixed In Version: 1.8.12-13073101 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-09-03 15:01:14 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:

Description Karel Volný 2012-06-26 12:26:41 UTC
Filed from caserun https://tcms.engineering.redhat.com/run/41363/#caserun_1236510

Version-Release number of selected component (if applicable):
RHEL-7.0-20120614.n.1


the new ipmitool segfaults on invalid input


[root@x86-64-v01 ~]# gdb ipmitool
GNU gdb (GDB) Red Hat Enterprise Linux (7.4.50.20120120-46.el7)
Copyright (C) 2012 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-redhat-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /usr/bin/ipmitool...Reading symbols from /usr/lib/debug/usr/bin/ipmitool.debug...done.
done.
(gdb) run sol payload status abcd
Starting program: /usr/bin/ipmitool sol payload status abcd
Could not open device at /dev/ipmi0 or /dev/ipmi/0 or /dev/ipmidev/0: No such file or directory

Program received signal SIGSEGV, Segmentation fault.
ipmi_sol_payload_access_status (intf=intf@entry=0x68fae0, channel=channel@entry=0 '\000', userid=userid@entry=1 '\001') at ipmi_sol.c:166
166                     lprintf(LOG_ERR, "Error: Unexpected data length (%d) received",
Missing separate debuginfos, use: debuginfo-install zlib-1.2.7-3.el7.x86_64
(gdb) bt full
#0  ipmi_sol_payload_access_status (intf=intf@entry=0x68fae0, channel=channel@entry=0 '\000', userid=userid@entry=1 '\001') at ipmi_sol.c:166
        req = {msg = {netfn = 6 '\006', lun = 0 '\000', cmd = 77 'M', target_cmd = 0 '\000', data_len = 2, data = 0x7fffffffded0 ""}}
        rsp = 0x0
        data = "\000\001"
#1  0x00000000004144c3 in ipmi_sol_main (intf=0x68fae0, argc=3, argv=0x7fffffffe108) at ipmi_sol.c:1973
        channel = <optimized out>
        userid = 1 '\001'
        enable = -1
        retval = 0
#2  0x00000000004332db in ipmi_main (argc=<optimized out>, argv=<optimized out>, cmdlist=cmdlist@entry=0x67d500, intflist=intflist@entry=0x0) at ipmi_main.c:722
        intf = 0x68fae0
        sup = <optimized out>
        privlvl = 0
        target_addr = 0 '\000'
        target_channel = 0 '\000'
        transit_addr = 0 '\000'
        transit_channel = 0 '\000'
        target_lun = 0 '\000'
        my_addr = 0 '\000'
        lookupbit = 16 '\020'
        authtype = -1
        tmp = <optimized out>
        hostname = 0x0
        username = 0x0
        password = 0x0
        intfname = 0x0
        progname = 0x7fffffffe3f4 "ipmitool"
        oemtype = 0x0
        sdrcache = 0x0
        kgkey = 0x0
        seloem = 0x0
        port = 0
        devnum = 0
        cipher_suite_id = 3
        argflag = <optimized out>
        i = <optimized out>
        found = <optimized out>
        rc = -1
        sol_escape_char = 126 '~'
#3  0x0000000000404ed0 in main (argc=<optimized out>, argv=<optimized out>) at ipmitool.c:124
        rc = <optimized out>
(gdb)

Comment 2 Karel Volný 2012-11-14 15:55:13 UTC
still fails:
https://tcms.engineering.redhat.com/run/50413/#caserun_1767346

Comment 3 Ales Ledvinka 2012-11-20 13:03:16 UTC
rawhide 1.8.12-7

Comment 6 Karel Volný 2013-02-26 15:58:02 UTC
there's still failure with ipmitool-1.8.12-9.el7

http://beaker-archive.app.eng.bos.redhat.com/beaker-logs/2013/02/3829/382935/804028/10945829/TESTOUT.log

for example:

:: [   PASS   ] :: Running 'ipmitool sol payload status abcd &> 1-abcd.out'
:: [   FAIL   ] :: File '1-abcd.out' should contain 'Invalid channel' 
set-in-progress abcd output:
Could not open device at /dev/ipmi0 or /dev/ipmi/0 or /dev/ipmidev/0: No such file or directory
Error: No valid response.


as channels are identified by numbers, ipmitool should reject "abcd" as channel name before even trying to use the ipmi device

Comment 8 Ales Ledvinka 2013-09-03 14:53:32 UTC
Could not open device at /dev/ipmi0 or /dev/ipmi/0 or /dev/ipmidev/0: No such file or directory
Could not open device at /dev/ipmi0 or /dev/ipmi/0 or /dev/ipmidev/0: No such file or directory
Given Channel number 'abcd' is either invalid or out of range.
Channel number must be from ranges: <0..7>, <0xE..0xF>

1.8.12-13073101 (and above)