Bug 675369

Summary: multipathd segfault if no "LUN wwid" value is present with keyword "wwid"
Product: Red Hat Enterprise Linux 5 Reporter: Dominic Geevarghese <dgeevarg>
Component: device-mapper-multipathAssignee: Ben Marzinski <bmarzins>
Status: CLOSED ERRATA QA Contact: Storage QE <storage-qe>
Severity: medium Docs Contact:
Priority: medium    
Version: 5.5CC: agk, bdonahue, bmarzins, bmr, christophe.varoqui, cww, dwysocha, heinzm, junichi.nomura, kabbott, kueda, lmb, mbroz, mkpai, prajnoha, prockai, qcai
Target Milestone: rc   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
multipath wasn't checking if the user had actually entered a value for their multipath.conf options, before it tried to read it. This caused multipathd to crash when users entered options in to multipath.conf without any values. Multipath now checks if there is a value before attempting to read it, and it no longer crashes.
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-07-21 08:22:36 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Dominic Geevarghese 2011-02-05 08:13:27 UTC
Description of problem:

multipathd daemon segfaults when no LUN wwid value present along with the keyword wwid . A typo mistake in multipath.conf should not segfault the daemon.

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

device-mapper-multipath-0.4.7-42.el5

How reproducible:

Always

Steps to Reproduce:

1. # grep -v ^# /etc/multipath.conf 

multipaths {
	multipath {
		wwid			   
		alias			red
	}
	multipath {
		wwid			1IET_00010001	 
		alias			hat
	}
}

2. # service multipathd start 
     Starting multipathd daemon:                                [  OK  ]

3. # multipath -ll
Segmentation fault 

/var/log/message reported segfault

kernel: multipath[15911]: segfault at 0000000000000000 rip 0000000000412a4d rsp 00007fff45a7b000 error 4

Actual results:

multipathd daemon segfaults 

Expected results:

Multipathd daemons should fail with warning message instead of segfault.

Additional info:

# file /tmp/core.15911 
/tmp/core.15911: ELF 64-bit LSB core file AMD x86-64, version 1 (SYSV), SVR4-style, from 'multipath'

#0  0x0000000000412a4d in set_value (strvec=0x46199d0) at parser.c:378
378		int size = strlen(str);
(gdb) bt
#0  0x0000000000412a4d in set_value (strvec=0x46199d0) at parser.c:378
#1  0x000000000040b065 in wwid_handler (strvec=0x46199d0) at dict.c:1006
#2  0x0000000000412eb0 in process_stream (keywords=0x4618880) at parser.c:493
#3  0x0000000000412edc in process_stream (keywords=0x4618480) at parser.c:497
#4  0x0000000000412edc in process_stream (keywords=0x46173b0) at parser.c:497
#5  0x000000000041300b in init_data (conf_file=0x42b5b4 "/etc/multipath.conf", init_keywords=0x40d663 <init_keywords>) at parser.c:542
#6  0x0000000000404c94 in load_config (file=0x42b5b4 "/etc/multipath.conf") at config.c:426
#7  0x000000000040332e in main (argc=2, argv=0x7fff45a7b318) at main.c:325
(gdb) frame 1
#1  0x000000000040b065 in wwid_handler (strvec=0x46199d0) at dict.c:1006
1006		mpe->wwid = set_value(strvec);
(gdb) p mpe->wwid
$1 = 0x0

Seems there is no condition check if the wwid value is NULL .

- dominic

Comment 1 Madhavprasad Pai 2011-02-08 08:04:09 UTC
Hello Ben, Dominic,

I wonder if the solution is to 

a. create a syntax checker for multipath.conf.
b. get multipathd to not start with an invalid conf file.

This is the behaviour with other daemons such as apache or samba.

Comment 3 Ben Marzinski 2011-04-07 22:19:32 UTC
multipath now correctly checks for empty values.

Comment 4 Ben Marzinski 2011-04-08 02:19:30 UTC
    Technical note added. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    New Contents:
multipath wasn't checking if the user had actually entered a value for their multipath.conf options, before it tried to read it.  This caused multipathd to crash when users entered options in to multipath.conf without any values.  Multipath now checks if there is a value before attempting to read it, and it no longer crashes.

Comment 6 Barry Donahue 2011-06-08 18:11:42 UTC
Verified, we now get an error message.

# multipath -ll
error parsing config file

Comment 7 errata-xmlrpc 2011-07-21 08:22:36 UTC
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHBA-2011-1032.html