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

Segfault on host-side virtio shutdown #158

Open
letmaik opened this issue May 4, 2020 · 1 comment
Open

Segfault on host-side virtio shutdown #158

letmaik opened this issue May 4, 2020 · 1 comment
Labels
area: virtio VirtIO host interface bug p2 Important but non-urgent priority
Milestone

Comments

@letmaik
Copy link
Contributor

letmaik commented May 4, 2020

The following only happens in sw mode, and only when not having a tty (which is common when running things within a Docker container).

Repro:

cd apps/basic/helloworld
setsid sh -c 'tty; make run-sw' < /dev/null | cat
2020-04-16T10:44:40.7369506Z [[  SGX-LKL ]] lkl_termination_thread(): termination thread unblocked
2020-04-16T10:44:40.7370126Z [    0.250259] EXT4-fs (vda): re-mounted. Opts: (null)
2020-04-16T10:44:40.7370423Z [LWP 875 exited]
2020-04-16T10:44:40.7370932Z [[  SGX-LKL ]] lkl_termination_thread(): calling lkl_sys_halt()
2020-04-16T10:44:40.7371300Z [    0.251472] reboot: Restarting system
2020-04-16T10:44:40.7371858Z [[  SGX-LKL ]] lkl_termination_thread(): lthread_detach2() done
2020-04-16T10:44:40.7372478Z [   SGX-LKL  ] ethread (3: 0) ethread (2: 0) [LWP 882 exited]
2020-04-16T10:44:40.7372785Z [LWP 881 exited]
2020-04-16T10:44:40.7373070Z ethread (1: 0) init (0: 0 exit=0) [LWP 880 exited]
2020-04-16T10:44:40.7373341Z [LWP 879 exited]
2020-04-16T10:44:40.7373492Z 
2020-04-16T10:44:40.7373881Z [   SGX-LKL  ] oe_terminate_enclave... 
2020-04-16T10:44:40.7374440Z Thread 7 "sgx-lkl-run-oe" received signal SIGSEGV, Segmentation fault.
2020-04-16T10:44:40.7374759Z [Switching to LWP 877]
2020-04-16T10:44:40.7375145Z 0x000000004001452b in virtio_process_queue (dev=0x7ffff7f03008, qidx=0) at host_interface/virtio.c:284
2020-04-16T10:44:40.7375592Z 284	host_interface/virtio.c: No such file or directory.
2020-04-16T10:44:40.7376056Z #0  0x000000004001452b in virtio_process_queue (dev=0x7ffff7f03008, qidx=0) at host_interface/virtio.c:284
2020-04-16T10:44:40.7376613Z #1  0x0000000040011c39 in monitor_console_input (cons_dev=0x7ffff7f03000) at host_interface/virtio_console.c:108
2020-04-16T10:44:40.7377431Z #2  0x00007ffff70736db in start_thread () from /opt/sgx-lkl/bin/../lib/external/libpthread-2-1032040b.27.so
2020-04-16T10:44:40.7378191Z #3  0x00007ffff6d9c88f in clone () from /opt/sgx-lkl/bin/../lib/external/libc-2-cd7c1a03.27.so

I set a breakpoint just before oe_terminate_enclave and I was surprised to see many host threads still running, like console_task, monitor_console_input, netdev_task, blkdevice_thread. Shouldn't they all be shut down by then?

@letmaik letmaik added bug area: virtio VirtIO host interface labels May 4, 2020
@prp
Copy link
Member

prp commented May 4, 2020

It makes sense that you see those host-side threads, as the segfault happened during the host side termination sequence.

This should be fairly easy to fix, as I suspect that, due to the missing TTY, the host-side of the virtio console was not allocated correctly.

@prp prp added the p1 Medium priority label May 4, 2020
@prp prp added this to the Milestone 1 milestone May 4, 2020
@davidchisnall davidchisnall added the needs-triage Bug does not yet have a priority assigned label Jul 28, 2020
@SeanTAllen SeanTAllen added p2 Important but non-urgent priority and removed needs-triage Bug does not yet have a priority assigned p1 Medium priority labels Jul 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: virtio VirtIO host interface bug p2 Important but non-urgent priority
Projects
None yet
Development

No branches or pull requests

4 participants