Bug 980693 - tgtd segfault when accessing to the passthrough device
Summary: tgtd segfault when accessing to the passthrough device
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: scsi-target-utils
Version: 6.4
Hardware: Unspecified
OS: Unspecified
Target Milestone: rc
: ---
Assignee: Andy Grover
QA Contact: Bruno Goncalves
Depends On:
TreeView+ depends on / blocked
Reported: 2013-07-03 03:58 UTC by Xiaowei Li
Modified: 2015-01-27 00:11 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Last Closed: 2013-08-10 16:55:35 UTC
Target Upstream Version:

Attachments (Terms of Use)

Description Xiaowei Li 2013-07-03 03:58:41 UTC
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 04:02:29 UTC
(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 09:57:36 UTC
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 20:14:48 UTC

Comment 13 RHEL Program Management 2013-08-10 16:55:35 UTC
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.