With a iSCSI-target which not yet implements any mode sense pages, there's a segfault in set_swp as ms->pages is then never set.
Suite: ModeSense6
Test: AllPages ...
Test of MODESENSE6 AllPages
Send MODESENSE6 command to fetch AllPages
Send MODESENSE6 (Expecting SUCCESS)
[OK] MODESENSE6 returned SUCCESS NO SENSE(0x00) UNKNOWN(0x0000)
[SUCCESS] All Pages fetched.
Try to unmarshall the DATA-IN buffer.
[SUCCESS] Unmarshalling successful.
Verify that mode data length is >= 3
[FAILED] Mode data length is < 3
FAILED
1. test_modesense6_all_pages.c:61 - CU_ASSERT_TRUE(ms->mode_data_length >= 3)
Test: Control ...
Test of MODESENSE6 CONTROL page
Fetch the CONTROL page via AllPages
Send MODESENSE6 command to fetch AllPages
Send MODESENSE6 (Expecting SUCCESS)
[OK] MODESENSE6 returned SUCCESS NO SENSE(0x00) UNKNOWN(0x0000)
[SUCCESS] All Pages fetched.
Try to unmarshall the DATA-IN buffer.
[SUCCESS] Unmarshalling successful.
Verify that mode data length is >= 3
[FAILED] Mode data length is < 3
[WARNING] CONTROL page was not returned from AllPages. All devices SHOULD implement this page.
Fetch the CONTROL page directly
Send MODESENSE6 command to fetch CONTROL
Send MODESENSE6 (Expecting SUCCESS)
[OK] MODESENSE6 returned SUCCESS NO SENSE(0x00) UNKNOWN(0x0000)
[SUCCESS] CONTROL page fetched.
Try to unmarshall the DATA-IN buffer.
[SUCCESS] Unmarshalling successful.
Verify that mode data length is >= 3
[FAILED] Mode data length is < 3
[WARNING] CONTROL page was not returned.All devices SHOULD implement this page.
[SKIPPED] CONTROL page is not implemented.
FAILED
1. test_modesense6_control.c:65 - CU_ASSERT_TRUE(ms->mode_data_length >= 3)
2. test_modesense6_control.c:103 - CU_ASSERT_TRUE(ms->mode_data_length >= 3)
Test: Control-D_SENSE ...
Test of MODESENSE6 CONTROL D_SENSE flag
Read the CONTROL page from the device
Send MODESENSE6 (Expecting SUCCESS)
[OK] MODESENSE6 returned SUCCESS NO SENSE(0x00) UNKNOWN(0x0000)
[SUCCESS] CONTROL page fetched.
Try to unmarshall the DATA-IN buffer.
[SUCCESS] Unmarshalling successful.
[WARNING] CONTROL page was not returned.All devices SHOULD implement this page.
passed
Test: Control-SWP ...
Test of MODESENSE6 CONTROL SWP flag
Set SWP to enable write protect
Read CONTROL page
Send MODESENSE6 (Expecting SUCCESS)
[OK] MODESENSE6 returned SUCCESS NO SENSE(0x00) UNKNOWN(0x0000)
[SUCCESS] CONTROL page fetched.
Program received signal SIGSEGV, Segmentation fault.
0x0000555555566fca in set_swp (sdev=0x5555555fe2a0) at iscsi-support.c:2745
2745 if (ms->pages->control.swp == 0) {
#0 set_swp (sdev=0x5555556272a0) at iscsi-support.c:2745
#1 0x0000555555577f0b in test_modesense6_control_swp () at test_modesense6_control_swp.c:43
#2 0x00007ffff7f7c0db in ?? () from /lib/x86_64-linux-gnu/libcunit.so.1
#3 0x00007ffff7f7c408 in ?? () from /lib/x86_64-linux-gnu/libcunit.so.1
#4 0x00007ffff7f7d368 in CU_run_all_tests () from /lib/x86_64-linux-gnu/libcunit.so.1
#5 0x0000555555561d64 in main (argc=4, argv=0x7fffffffdba8) at iscsi-test-cu.c:1530
(gdb) print ms->pages
$1 = (struct scsi_mode_page *) 0x0
(gdb) print ms
$2 = (struct scsi_mode_sense *) 0x555555640d08
(gdb) print *ms
$3 = {mode_data_length = 0, medium_type = 0 '\000', device_specific_parameter = 0 '\000', longlba = 0 '\000', block_descriptor_length = 0 '\000', pages = 0x0}
With a iSCSI-target which not yet implements any mode sense pages, there's a segfault in set_swp as
ms->pages
is then never set.