Bug 1462767 - Segmentation fault when querying iscsi session
Segmentation fault when querying iscsi session
Status: NEW
Product: Fedora
Classification: Fedora
Component: iscsi-initiator-utils (Show other bugs)
28
Unspecified Unspecified
unspecified Severity unspecified
: ---
: ---
Assigned To: Chris Leech
Fedora Extras Quality Assurance
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2017-06-19 09:34 EDT by Gris Ge
Modified: 2018-07-20 03:29 EDT (History)
5 users (show)

See Also:
Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed:
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Gris Ge 2017-06-19 09:34:01 EDT
Description of problem:
====
[fge@fedr open-iscsi]$ sudo iscsiadm -m session -P 3
iSCSI Transport Class version 2.0-870
version 6.2.0.874
Segmentation fault
====


Version-Release number of selected component (if applicable):
iscsi-initiator-utils-6.2.0.874-4.git86e8892.fc27.x86_64

How reproducible:
100%

Steps to Reproduce:
1. Connect to a iSCSI session.
2. sudo iscsiadm -m session -P 3
3.

Actual results:
Segmentation fault

Expected results:
Print iscsi session information

Additional info:

Program received signal SIGSEGV, Segmentation fault.
session_info_print (info_level=<optimized out>, info=<optimized out>, do_show=0) at session_info.c:426
426                     session_info_print_tree(&list, "", flags, do_show,
(gdb) bt
#0  session_info_print (info_level=<optimized out>, info=<optimized out>, do_show=0) at session_info.c:426
#1  0x000055555555a46f in main (argc=5, argv=0x7fffffffe538) at iscsiadm.c:3716


The upstream (8acf1fcc8d4d03ef64aee73ea16b5cf325878c97) does not have this problem.
Comment 1 Jan Kurik 2017-08-15 04:44:07 EDT
This bug appears to have been reported against 'rawhide' during the Fedora 27 development cycle.
Changing version to '27'.
Comment 2 Seth Howell 2017-10-30 16:13:46 EDT
This error also exists in fedora 26. 

Version-Release number of selected component (if applicable):
iscsiadm version 6.2.0.874
iscsi-initiator-utils-6.2.0.874-3.git86e8892.fc26.x86_64

root cause:
It occurs because between iscsiadm version 6.2.0.873-33 and version 6.2.0.874, a timeout argument was added to session_info_print_tree function, and the iscsi_req_tmo field of the session_info pointer provided to session_info_print is used to populate that argument. 
However, line 426 of session_info.c is on a branch that assumes that the session_info pointer passed to session_info_print is Null. That is why the call to session_info_print_tree on that line fails with a segfault.

Possible Solution:
In the upstream version of open-iscsi on Github, the call to session_info_print_tree on line 426 passes -1 as the timeout argument instead of using the value of info->iscsi_req_tmo. I also pulled the source rpm, and changed line 426 to read:
session_info_print_tree(&list, "", flags, do_show, -1);
Making that change to the fedora source fixed the issue for my use case.
Comment 3 ZhangQiuLiang 2018-07-20 03:29:07 EDT
This error is still exists in fedora 28.

while i run avocado to test about muti vms.
it use command iscsiadm.

$ sudo iscsiadm -m session -P 3
iSCSI Transport Class version 2.0-870
version 6.2.0.874
Segmentation fault

Note You need to log in before you can comment on or make changes to this bug.