Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

spdk: defensive rpc_nvmf_get_qpairs #674

Merged
merged 1 commit into from
May 28, 2024
Merged

spdk: defensive rpc_nvmf_get_qpairs #674

merged 1 commit into from
May 28, 2024

Conversation

baum
Copy link
Collaborator

@baum baum commented May 27, 2024

spdk: defensive rpc_nvmf_get_qpairs

crash

Program terminated with signal SIGSEGV, Segmentation fault.
#0  rpc_nvmf_get_qpairs (i=0x218f230) at nvmf_rpc.c:2642
2642    nvmf_rpc.c: Directory not empty.
[Current thread is 1 (Thread 0x7f9eb6bc2780 (LWP 122))]
Missing separate debuginfos, use: dnf debuginfo-install thrift-0.15.0-2.el9.x86_64
(gdb)
(gdb)
(gdb) c
The program is not being run.
(gdb) bt
#0  rpc_nvmf_get_qpairs (i=0x218f230) at nvmf_rpc.c:2642
#1  0x00000000005c0572 in _call_channel (ctx=0x218f230) at thread.c:2552
#2  0x00000000005bc3cc in msg_queue_run_batch (thread=0x1ca2e80, max_msgs=8) at thread.c:848
#3  0x00000000005bcd6b in thread_poll (thread=0x1ca2e80, max_msgs=0, now=31713605381769668) at thread.c:1070
#4  0x00000000005bd077 in spdk_thread_poll (thread=0x1ca2e80, max_msgs=0, now=31713605381769668) at thread.c:1163
#5  0x000000000057a0b9 in _reactor_run (reactor=0x1c55e40) at reactor.c:914
#6  0x000000000057a1ad in reactor_run (arg=0x1c55e40) at reactor.c:952
#7  0x000000000057a652 in spdk_reactors_start () at reactor.c:1068
#8  0x0000000000576510 in spdk_app_start (opts_user=0x7fff569b9f50, start_fn=0x40992f <nvmf_tgt_started>, arg1=0x0) at app.c:839
#9  0x0000000000409a49 in main (argc=4, argv=0x7fff569ba158) at nvmf_main.c:47
(gdb) f 0
#0  rpc_nvmf_get_qpairs (i=0x218f230) at nvmf_rpc.c:2642
2642    in nvmf_rpc.c
(gdb) info locals
ctx = 0x2318930
ch = 0x1c4eb10
group = 0x1c4eb70
qpair = 0x23bed10
(gdb) p qpair->ctrlr->subsys
Cannot access memory at address 0xe8
(gdb) p qpair->ctrlr
$1 = (struct spdk_nvmf_ctrlr *) 0x0
(gdb)

@gbregman
Copy link
Contributor

The "if (group)" is redundant. If "ch" is not null we can't get a NULL "group". There is a test in the code for a NULL "ch" and we assert if it is. But we probably compile the code with NDEBUG, so the assert does nothing. Anyway, I think we should also display an error message in case "ch" is NULL. This shouldn't happen unless something is wrong.

Signed-off-by: Alexander Indenbaum <[email protected]>
Copy link
Contributor

@gbregman gbregman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest adding:

if (ch)
{
.
.
.
}
else
{
    SPDK_ERRLOG("ch is NULL");
}

@baum baum merged commit 26ca980 into ceph:devel May 28, 2024
27 of 28 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

3 participants