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

ABI: 'arm' problem with ftp / tcpsvd connection -> signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x10 #2740

Closed
araczkowski opened this issue Aug 15, 2018 · 4 comments

Comments

@araczkowski
Copy link
Contributor

araczkowski commented Aug 15, 2018

I have a problem with ftp / tcpsvd connection

was OK in BusyBox v1.28.3

bash-4.4$ busybox | head -1
BusyBox v1.28.3 (2018-04-10 06:59:50 UTC) multi-call binary.

connection via ftp

bash-4.4$ tcpsvd -vE 0.0.0.0 1024 ftpd -w /sdcard
tcpsvd: listening on 0.0.0.0:1024, starting
tcpsvd: start 10559 192.168.1.15:1024-192.168.1.34:46840
tcpsvd: status 1/30
tcpsvd: end 10559 exit 0
tcpsvd: status 0/30

upgrade busybox

bash-4.4$ apt install busybox
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages will be upgraded:
  busybox
1 upgraded, 0 newly installed, 0 to remove and 43 not upgraded.
...

bash-4.4$ busybox | head -1
BusyBox v1.29.2 (2018-08-13 15:20:43 UTC) multi-call binary.

connection via ftp after busybox upgrade

bash-4.4$ tcpsvd -vE 0.0.0.0 1024 ftpd -w /sdcard
tcpsvd: listening on 0.0.0.0:1024, starting
tcpsvd: start 10762 192.168.1.15:1024-192.168.1.34:46870
tcpsvd: status 1/30
tcpsvd: end 10762 signal 11
tcpsvd: status 0/30

the problem is here:
tcpsvd: end 10762 signal 11

Logcat:

08-15 08:02:59.288 11437-11437/? A/DEBUG: *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
    Build fingerprint: 'Amlogic/p281/p281:7.1.2/p281/20171230:userdebug/test-keys'
    Revision: '0'
    ABI: 'arm'
08-15 08:02:59.289 11437-11437/? A/DEBUG: pid: 11436, tid: 11436, name: ftpd  >>> ftpd <<<
    signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x10
        r0 00000008  r1 ffffffff  r2 f6b7b648  r3 f6b69867
        r4 00000008  r5 0000002b  r6 0000000c  r7 00000010
        r8 ff9ab3f4  r9 00000000  sl 00000000  fp 00000000
        ip 00000003  sp ff9ab2a0  lr ab126b1b  pc ab126b1c  cpsr a00f0030
08-15 08:02:59.290 11437-11437/? A/DEBUG: backtrace:
        #00 pc 0000cb1c  /data/data/com.termux/files/usr/bin/busybox

I reproduced this problem in clean newest termux, ABI: 'arm' too.

I will be appreciated for any advice how to solve this problem,
I can compile the BusyBox with some additional flag? etc, and retest this issue

thanks

@ghost
Copy link

ghost commented Aug 15, 2018

@araczkowski The problem is with ftpd (not tcpsvd). I'm getting segfault on ARM (Android 6.0) when just executing ftpd without any arguments.

On AArch64 no problems (tcpsvd/ftpd), tested on Android 8.0.

@Grimler91
Copy link
Member

I don't have an arm device at hand so can't test at the moment, but try building it with this patch:

--- ../ftpd.c.orig      2018-08-15 10:30:22.369789946 +0200
+++ ./networking/ftpd.c 2018-08-15 10:31:50.164561041 +0200
@@ -177,13 +177,9 @@
        char msg_ok [(sizeof("NNN " MSG_OK ) + 3) & 0xfffc];
        char msg_err[(sizeof("NNN " MSG_ERR) + 3) & 0xfffc];
 } FIX_ALIASING;
-#define G (*ptr_to_globals)
-/* ^^^ about 75 bytes smaller code than this: */
-//#define G (*(struct globals*)bb_common_bufsiz1)
+#define G (*(struct globals*)bb_common_bufsiz1)
 #define INIT_G() do { \
-       SET_PTR_TO_GLOBALS(xzalloc(sizeof(G))); \
-       /*setup_common_bufsiz();*/ \
-       \
+       setup_common_bufsiz(); \
        /* Moved to main */ \
        /*strcpy(G.msg_ok  + 4, MSG_OK );*/ \
        /*strcpy(G.msg_err + 4, MSG_ERR);*/ \

This reverts commit 565af2322271984edf6eb533f90789e52e311848. Something else to try could be to add a asm volatile("":::"memory"); \ line as in https://github.com/termux/termux-packages/blob/master/packages/busybox/build-with-clang.patch.

@ghost
Copy link

ghost commented Aug 15, 2018

@Grimler91 Looks like your patch solves problem:
screenshot_20180815-090845

The tcpsvd -vE 0.0.0.0 1024 ftpd -w /sdcard is working too, after patch.

@araczkowski
Copy link
Contributor Author

thx for your help, and quick response

I build it with the patch provided by @Grimler91 (I added the patch to the end of the packages/busybox/build-with-clang.patch file) and... it works :)

I see that the patch is already in repo added by @xeffyr so I'm closing this issue

Thanks again you are great! 🥇

fornwall pushed a commit that referenced this issue Aug 15, 2018
@ghost ghost locked and limited conversation to collaborators Oct 9, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants