sahlberg / libiscsi

iscsi client library and utilities
Other
192 stars 165 forks source link

segfault in conformance test #425

Open folkertvanheusden opened 1 month ago

folkertvanheusden commented 1 month ago

Hello,

With certain iSCSI targets, a segfault can be triggered in the conformance test:

iscsi-test-cu -d -S -x -V -t iSCSI.iSCSINop iscsi://localhost/test/1

results in:

    2024-10-03 09:10:21.003311     Test Nop Out Pings
    2024-10-03 09:10:21.003398     Send PRIN/READ_KEYS
    2024-10-03 09:10:21.003521     [SKIPPED] PERSISTENT RESERVE IN is not implemented.
iscsi-test-cu: TestRun.c:163: CU_assertImplementation: Assertion `NULL != f_pCurTest' failed.

Program received signal SIGABRT, Aborted.
__pthread_kill_implementation (no_tid=0, signo=6, threadid=<optimized out>) at ./nptl/pthread_kill.c:44
warning: 44 ./nptl/pthread_kill.c: No such file or directory
(gdb) bt
#0  __pthread_kill_implementation (no_tid=0, signo=6, threadid=<optimized out>) at ./nptl/pthread_kill.c:44
#1  __pthread_kill_internal (signo=6, threadid=<optimized out>) at ./nptl/pthread_kill.c:78
#2  __GI___pthread_kill (threadid=<optimized out>, signo=signo@entry=6) at ./nptl/pthread_kill.c:89
#3  0x00007ffff7c4526e in __GI_raise (sig=sig@entry=6) at ../sysdeps/posix/raise.c:26
#4  0x00007ffff7c288ff in __GI_abort () at ./stdlib/abort.c:79
#5  0x00007ffff7c2881b in __assert_fail_base (fmt=0x7ffff7dd01e8 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", 
    assertion=assertion@entry=0x7ffff7f891ce "NULL != f_pCurTest", file=file@entry=0x7ffff7f89128 "TestRun.c", line=line@entry=163, 
    function=function@entry=0x7ffff7f8b960 "CU_assertImplementation") at ./assert/assert.c:94
#6  0x00007ffff7c3b507 in __assert_fail (assertion=0x7ffff7f891ce "NULL != f_pCurTest", file=0x7ffff7f89128 "TestRun.c", line=163, 
    function=0x7ffff7f8b960 "CU_assertImplementation") at ./assert/assert.c:103
#7  0x00007ffff7f83ed6 in CU_assertImplementation () from /lib/x86_64-linux-gnu/libcunit.so.1
#8  0x0000555555575aea in test_iscsi_nop_cb (iscsi=0x555555638830, status=251658240, command_data=0x0, private_data=0x7fffffffd600)
    at test_iscsi_nop_simple.c:66
#9  0x00005555555cfa78 in iscsi_cancel_pdus (iscsi=0x555555638830) at pdu.c:966
#10 0x00005555555c71c7 in iscsi_destroy_context (iscsi=0x555555638830) at init.c:404
#11 0x0000555555560763 in suite_cleanup () at iscsi-test-cu.c:897
#12 0x00007ffff7f833e3 in ?? () from /lib/x86_64-linux-gnu/libcunit.so.1
#13 0x00007ffff7f84570 in CU_run_all_tests () from /lib/x86_64-linux-gnu/libcunit.so.1
#14 0x00007ffff7f87de2 in CU_automated_run_tests () from /lib/x86_64-linux-gnu/libcunit.so.1
#15 0x000055555556207d in main (argc=6, argv=0x7fffffffdda8) at iscsi-test-cu.c:1528

The segfault comes from CU_ASSERT_EQUAL(status, 0); where status is the status-parameter of the test_iscsi_nop_cb function.

Ideally it doesn't segfault but shows a 'FAILED' logging.

folkertvanheusden commented 1 month ago

This happens when the DUT does not include the "ping-data" in a NOP-IN. That's a bug in the DUT, yes, but the test-tooling should not segfault by it.