Bug 980693 - tgtd segfault when accessing to the passthrough device
tgtd segfault when accessing to the passthrough device
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: scsi-target-utils (Show other bugs)
Unspecified Unspecified
low Severity low
: rc
: ---
Assigned To: Andy Grover
Bruno Goncalves
Depends On:
  Show dependency treegraph
Reported: 2013-07-02 23:58 EDT by Xiaowei Li
Modified: 2015-01-26 19:11 EST (History)
5 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2013-08-10 12:55:35 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Xiaowei Li 2013-07-02 23:58:41 EDT
Description of problem:
tgtd segfault when accessing to the passthrough device

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

How reproducible:

Steps to Reproduce:
1. on the target, export the pass through device
tgtadm --lld iscsi --op new --mode logicalunit --tid 1 --device-type pt --lun 1 -b /dev/sdc
2. on the initiator, perform iscsi discovery and login
iscsiadm -m node -l

Actual results:
Jul  2 23:45:03 el64 kernel: tgtd[11641]: segfault at 0 ip (null) sp 00007fff23a4c178 error 14 in tgtd[400000+3c000]
Jul  2 23:45:04 el64 abrtd: Directory 'ccpp-2013-07-02-23:45:03-11641' creation detected
Jul  2 23:45:04 el64 abrt[11770]: Saved core dump of pid 11641 (/usr/sbin/tgtd) to /var/spool/abrt/ccpp-2013-07-02-23:45:03-11641 (168316928 bytes)
Jul  2 23:45:04 el64 tgtd: tgtd logger exits abnormally, pid:11644

Expected results:

Additional info:
Comment 3 Xiaowei Li 2013-07-03 00:02:29 EDT
(gdb) bt
#0  0x0000000000000000 in ?? ()
#1  0x000000000041e6d2 in target_cmd_perform (tid=<value optimized out>, cmd=0x2113400)
    at target.c:978
#2  0x0000000000405b8b in iscsi_target_cmd_queue (task=0x2113330) at iscsi/iscsid.c:1347
#3  iscsi_scsi_cmd_execute (task=0x2113330) at iscsi/iscsid.c:1367
#4  0x0000000000405e2e in iscsi_task_execute (task=0x2113330) at iscsi/iscsid.c:1482
#5  0x00000000004084bf in iscsi_task_queue (conn=0x2108298) at iscsi/iscsid.c:1570
#6  iscsi_task_rx_done (conn=0x2108298) at iscsi/iscsid.c:1703
#7  iscsi_rx_handler (conn=0x2108298) at iscsi/iscsid.c:2119
#8  0x000000000040e028 in iscsi_tcp_event_handler (fd=<value optimized out>, events=1, data=0x2108298)
    at iscsi/iscsi_tcp.c:158
#9  0x0000000000418be9 in event_loop () at tgtd.c:411
#10 0x000000000041929a in main (argc=<value optimized out>, argv=<value optimized out>) at tgtd.c:583

please let me know if you want the coredupm file.
Comment 8 Bruno Goncalves 2013-07-11 05:57:36 EDT
It is possible to create a target using sg devices, but selinux has to be disabled.

tgtadm --lld iscsi --op new --mode logicalunit --tid 1 --lun 1 --bstype=sg --device-type=pt --backing-store=/dev/sg0

the following selinux policy seems to fix the issue:

require {
	type tgtd_t;
	type scsi_generic_device_t;
	class capability { sys_rawio sys_admin };
	class chr_file { read write getattr open ioctl };

#============= tgtd_t ==============
#!!!! The source type 'tgtd_t' can write to a 'chr_file' of the following types:
# initrc_devpts_t, null_device_t, zero_device_t, devtty_t, fixed_disk_device_t, devpts_t, ptynode, ttynode, tty_device_t

allow tgtd_t scsi_generic_device_t:chr_file { read write getattr open ioctl };
allow tgtd_t self:capability { sys_rawio sys_admin };

rpm -q selinux-policy
Comment 10 Michael Revelle 2013-07-22 16:14:48 EDT
Comment 13 RHEL Product and Program Management 2013-08-10 12:55:35 EDT
Development Management has reviewed and declined this request.
You may appeal this decision by reopening this request.

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