Bug 731999

Summary: segfault of iscsid during login in 2 iscsi target on OpenVz
Product: Red Hat Enterprise Linux 6 Reporter: Serguei Krasnov <krasnov>
Component: iscsi-initiator-utilsAssignee: Andy Grover <agrover>
Status: CLOSED CURRENTRELEASE QA Contact: Red Hat Kernel QE team <kernel-qe>
Severity: high Docs Contact:
Priority: medium    
Version: 6.1CC: coughlan, davide_cosentino, dwysocha, jwest, khorenko, mchristi, syeghiay
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Linux   
Whiteboard:
Fixed In Version: iscsi-initiator-utils-6.2.0.872-30.el6 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-12-08 17:21:16 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description Serguei Krasnov 2011-08-19 12:28:18 UTC
Description of problem:
I got this bug on OpenVz.
I connected to 2 iscsi targets and try to login:

[root@tmpl15 ~]# iscsiadm -m node -L all
Logging in to [iface: default, target: iqn.2000-11.com.parallels:s57:1:vz.iscsi-targets.tg-fxhmn8, portal: 10.29.0.63,3260]
Logging in to [iface: default, target: iqn.2007-06.com.parallels:10.30.19.239.storage0, portal: 10.30.19.234,3260]
Logging in to [iface: default, target: iqn.2007-06.com.parallels:10.30.19.239.storage1, portal: 10.30.19.234,3260]
iscsiadm: Could not login to [iface: default, target: iqn.2000-11.com.parallels:s57:1:vz.iscsi-targets.tg-fxhmn8, portal: 10.29.0.63,3260].
iscsiadm: initiator reported error (15 - session exists)
iscsiadm: Could not login to [iface: default, target: iqn.2007-06.com.parallels:10.30.19.239.storage0, portal: 10.30.19.234,3260].
iscsiadm: initiator reported error (15 - session exists)
iscsiadm: Could not login to [iface: default, target: iqn.2007-06.com.parallels:10.30.19.239.storage1, portal: 10.30.19.234,3260].
iscsiadm: initiator reported error (15 - session exists)
iscsiadm: Could not log into all portals
[root@tmpl15 ~]#


[root@tmpl15 ~]# gdb /sbin/iscsid 79388 -s /usr/lib/debug/sbin/iscsid.debug
GNU gdb (GDB) Red Hat Enterprise Linux (7.2-48.el6)
...
Program received signal SIGSEGV, Segmentation fault.
0x0000000000404acc in find_ifname (conn=0xeb3668, timeout_ms=<value optimized out>) at io.c:131
131 if (ss->ss.ss_family != ifa->ifa_addr->sa_family) 
(gdb) p *ifa
$19 = {ifa_next = 0xeaf8d0, ifa_name = 0xeaf8bc "venet0", ifa_flags = 65747, ifa_addr = 0x0, ifa_netmask = 0x0, ifa_ifu = {ifu_broadaddr = 0x0,
    ifu_dstaddr = 0x0}, ifa_data = 0xeb0114}
(gdb)

Yes, openvz has such device:
[root@tmpl15 open-iscsi-2.0-872-rc4-bnx2i]# ifconfig venet0
venet0 Link encap:UNSPEC HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
          inet6 addr: fe80::1/128 Scope:Link
          UP BROADCAST POINTOPOINT RUNNING NOARP MTU:1500 Metric:1
          RX packets:18 errors:0 dropped:0 overruns:0 frame:0
          TX packets:24 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:1196 (1.1 KiB) TX bytes:1550 (1.5 KiB)

and ifa_addr field of struct ifaddrs is 0 for this device after getifaddrs() call.

I understand that it's openvz trouble, but fix for initiator is simple:
[root@tmpl15 open-iscsi-2.0-872-rc4-bnx2i]# diff -urN usr/io.c.orig usr/io.c
--- usr/io.c.orig 2011-08-18 20:18:32.000000000 +0400
+++ usr/io.c 2011-08-18 20:08:25.000000000 +0400
@@ -128,6 +128,8 @@
 find_ifname(const struct ifaddrs *ifa, const union sockaddr_u *ss)
 {
        for (; ifa; ifa = ifa->ifa_next) {
+               if (ifa->ifa_addr == NULL)
+                       continue;
                if (ss->ss.ss_family != ifa->ifa_addr->sa_family)
                        continue;
                switch (ss->ss.ss_family) {
[root@tmpl15 open-iscsi-2.0-872-rc4-bnx2i]# 

Version-Release number of selected component (if applicable):
iscsi-initiator-utils-6.2.0.872-21.el6.x86_64

How reproducible:
100%

Steps to Reproduce:
1. Distcovery 2 target via "iscsiadm --mode discovery --type sendtargets --portal ..."
2. Login via "iscsiadm -m node -L all"
  
Actual results:
Segfault of iscsid

Expected results:


Additional info:

Comment 2 Mike Christie 2011-08-22 17:02:03 UTC
That is actually a valid interface case we should have handled. I remember seeing it in testing. I thought I fixed this in the 6.1 rpm before we shipped it. It looks like for some reason the wrong patch got merged and so the bug stayed in there.

For 6.2 I rebuild the patches and I just checked and confirmed that this is fixed in iscsi-initiator-utils-6.2.0.872-22.el6 which is scheduled for rhel 6.2. You can test it here:
http://people.redhat.com/mchristi/iscsi/rhel6.2/iscsi-initiator-utils/

Comment 3 Suzanne Logcher 2011-10-06 18:54:05 UTC
Since RHEL 6.2 External Beta has begun, and this bug remains
unresolved, it has been rejected as it is not proposed as
exception or blocker.
               
Red Hat invites you to ask your support representative to
propose this request, if appropriate and relevant, in the
next release of Red Hat Enterprise Linux.

Comment 6 Mike Christie 2011-12-02 00:00:09 UTC
*** Bug 758230 has been marked as a duplicate of this bug. ***