termux / termux-packages

A package build system for Termux.
https://termux.dev
Other
13.41k stars 3.09k forks source link

Segmentation fault with `busybox httpd` #3216

Closed laomaiweng closed 5 years ago

laomaiweng commented 6 years ago

I get the following when trying to use Busybox's httpd:

$ busybox httpd -fvv -p 8888
Segmentation fault
$ busybox httpd -h
Segmentation fault

It was working fine a week ago. I can't quite remember but I think the sigsegvs started after upgrading Busybox. Other Busybox utilities that I tested work fine.

Here's my termux-info:

Updatable packages:
All packages up to date
System information:
Linux localhost 3.10.86-g7b77e01 #2 SMP PREEMPT Thu Jun 16 07:06:21 CST 2016 armv7l Android
Termux-packages arch:
arm
Android version:
6.0
Device manufacturer:
HUAWEI
Device model:
H60-L04
Grimler91 commented 6 years ago

We changed from compiling with gcc to clang not that long ago.

This seems to be the same segfault as I thought would be solved by this commit: https://github.com/termux/termux-packages/commit/1fbe9f6f17cc7df53d213d5c2f6b35b195b0ed62.

gdb backtrace:

$ gdb --args httpd -h
[...]
(gdb) run
Starting program: /data/data/com.termux/files/usr/bin/applets/httpd -h

Program received signal SIGSEGV, Segmentation fault.
httpd_main (argc=<optimized out>, argv=0xbefffab4) at networking/httpd.c:2633
2633
(gdb) bt
#0  httpd_main (argc=<optimized out>, argv=0xbefffab4) at networking/httpd.c:2633
#1  0x7f55a0e6 in run_applet_no_and_exit (applet_no=55, name=<optimized out>, argv=0xbefffab4) at libbb/appletlib.c:940
#2  0x7f55a182 in run_applet_and_exit (name=0xbefffc0c "httpd", argv=0xbefffab4) at libbb/appletlib.c:958
#3  0x7f55a150 in main (argc=<optimized out>, argv=0xbefffab4) at libbb/appletlib.c:1066

Edit: and line 2633 in httpd.c is where INIT_G(); is done, so it's maybe related to all the other busybox issues we've had, see https://github.com/termux/termux-packages/issues/2488.

ghost commented 5 years ago

Fixed in https://github.com/termux/termux-packages/commit/2a7d9007f235ee7b0e2f7d416f863735f2d04eac.