n0-computer / iroh

A toolkit for building distributed applications
https://iroh.computer
Apache License 2.0
2.38k stars 154 forks source link

Crashes due to seccomp in Android x86 emulator #2336

Open link2xt opened 4 months ago

link2xt commented 4 months ago

There is an attempt to use iroh 0.17.0 for realtime channels on Android at https://github.com/deltachat/deltachat-android/pull/3108

It crashes in emulator: https://github.com/deltachat/deltachat-android/pull/3108#issuecomment-2137897610

Larger log from the emulator:

30 14:03:58.635 8160-8160 tokio-runtime-w com.b44t.messenger.beta W type=1400 audit(0.0:780): avc: denied { read } for name="arp" dev="proc" ino=4026532043 scontext=u:r:untrusted_app:s0:c146,c256,c512,c768 tcontext=u:object_r:proc_net:s0 tclass=file permissive=0 app=com.b44t.messenger.beta
2024-05-30 14:03:58.635 8160-8160 tokio-runtime-w com.b44t.messenger.beta W type=1400 audit(0.0:781): avc: denied { read } for name="route" dev="proc" ino=4026532046 scontext=u:r:untrusted_app:s0:c146,c256,c512,c768 tcontext=u:object_r:proc_net:s0 tclass=file permissive=0 app=com.b44t.messenger.beta
2024-05-30 14:03:58.635 8160-8160 tokio-runtime-w com.b44t.messenger.beta W type=1400 audit(0.0:782): avc: denied { read } for name="ipv6_route" dev="proc" ino=4026532560 scontext=u:r:untrusted_app:s0:c146,c256,c512,c768 tcontext=u:object_r:proc_net:s0 tclass=file permissive=0 app=com.b44t.messenger.beta
2024-05-30 14:03:58.635 8160-8160 tokio-runtime-w com.b44t.messenger.beta W type=1400 audit(0.0:783): avc: denied { search } for name="net" dev="sysfs" ino=4051 scontext=u:r:untrusted_app:s0:c146,c256,c512,c768 tcontext=u:object_r:sysfs_net:s0 tclass=dir permissive=0 app=com.b44t.messenger.beta
2024-05-30 14:03:58.635 8160-8160 tokio-runtime-w com.b44t.messenger.beta W type=1400 audit(0.0:784): avc: denied { search } for name="net" dev="sysfs" ino=4051 scontext=u:r:untrusted_app:s0:c146,c256,c512,c768 tcontext=u:object_r:sysfs_net:s0 tclass=dir permissive=0 app=com.b44t.messenger.beta
2024-05-30 14:03:58.759 8160-8197 libc com.b44t.messenger.beta A Fatal signal 31 (SIGSYS), code 1 (SYS_SECCOMP) in tid 8197 (tokio-runtime-w), pid 8160 (.messenger.beta)
2024-05-30 14:03:58.635 8160-8160 chatty com.b44t.messenger.beta I uid=10146(com.b44t.messenger.beta) identical 3 lines
2024-05-30 14:03:58.635 8160-8160 tokio-runtime-w com.b44t.messenger.beta W type=1400 audit(0.0:788): avc: denied { search } for name="net" dev="sysfs" ino=4051 scontext=u:r:untrusted_app:s0:c146,c256,c512,c768 tcontext=u:object_r:sysfs_net:s0 tclass=dir permissive=0 app=com.b44t.messenger.beta
2024-05-30 14:03:58.817 8788-8788 DEBUG crash_dump32 A pid: 8160, tid: 8197, name: tokio-runtime-w >>> com.b44t.messenger.beta <<<
2024-05-30 14:03:58.818 8788-8788 DEBUG crash_dump32 A #02 pc 00db5680 /data/app/com.b44t.messenger.beta-VMaQurdwAW8xrf01HE6OsQ==/lib/x86/libnative-utils.so (BuildId: 7c3071b7147160a05e156755470bd2f5b9dfd42b)
2024-05-30 14:03:58.818 8788-8788 DEBUG crash_dump32 A #03 pc 00d8223e /data/app/com.b44t.messenger.beta-VMaQurdwAW8xrf01HE6OsQ==/lib/x86/libnative-utils.so (BuildId: 7c3071b7147160a05e156755470bd2f5b9dfd42b)
2024-05-30 14:03:58.818 8788-8788 DEBUG crash_dump32 A #04 pc 00d86256 /data/app/com.b44t.messenger.beta-VMaQurdwAW8xrf01HE6OsQ==/lib/x86/libnative-utils.so (BuildId: 7c3071b7147160a05e156755470bd2f5b9dfd42b)
2024-05-30 14:03:58.818 8788-8788 DEBUG crash_dump32 A #05 pc 00d9458e /data/app/com.b44t.messenger.beta-VMaQurdwAW8xrf01HE6OsQ==/lib/x86/libnative-utils.so (BuildId: 7c3071b7147160a05e156755470bd2f5b9dfd42b)
2024-05-30 14:03:58.818 8788-8788 DEBUG crash_dump32 A #06 pc 00d942a0 /data/app/com.b44t.messenger.beta-VMaQurdwAW8xrf01HE6OsQ==/lib/x86/libnative-utils.so (BuildId: 7c3071b7147160a05e156755470bd2f5b9dfd42b)
2024-05-30 14:03:58.818 8788-8788 DEBUG crash_dump32 A #07 pc 00d8e321 /data/app/com.b44t.messenger.beta-VMaQurdwAW8xrf01HE6OsQ==/lib/x86/libnative-utils.so (BuildId: 7c3071b7147160a05e156755470bd2f5b9dfd42b)
2024-05-30 14:03:58.818 8788-8788 DEBUG crash_dump32 A #08 pc 0100fadc /data/app/com.b44t.messenger.beta-VMaQurdwAW8xrf01HE6OsQ==/lib/x86/libnative-utils.so (BuildId: 7c3071b7147160a05e156755470bd2f5b9dfd42b)
2024-05-30 14:03:58.818 8788-8788 DEBUG crash_dump32 A #09 pc 0100e56d /data/app/com.b44t.messenger.beta-VMaQurdwAW8xrf01HE6OsQ==/lib/x86/libnative-utils.so (BuildId: 7c3071b7147160a05e156755470bd2f5b9dfd42b)
2024-05-30 14:03:58.818 8788-8788 DEBUG crash_dump32 A #10 pc 00a4006a /data/app/com.b44t.messenger.beta-VMaQurdwAW8xrf01HE6OsQ==/lib/x86/libnative-utils.so (BuildId: 7c3071b7147160a05e156755470bd2f5b9dfd42b)
2024-05-30 14:03:58.818 8788-8788 DEBUG crash_dump32 A #11 pc 0100cd10 /data/app/com.b44t.messenger.beta-VMaQurdwAW8xrf01HE6OsQ==/lib/x86/libnative-utils.so (BuildId: 7c3071b7147160a05e156755470bd2f5b9dfd42b)
2024-05-30 14:03:58.818 8788-8788 DEBUG crash_dump32 A #12 pc 0100c971 /data/app/com.b44t.messenger.beta-VMaQurdwAW8xrf01HE6OsQ==/lib/x86/libnative-utils.so (BuildId: 7c3071b7147160a05e156755470bd2f5b9dfd42b)
2024-05-30 14:03:58.818 8788-8788 DEBUG crash_dump32 A #13 pc 01012dd5 /data/app/com.b44t.messenger.beta-VMaQurdwAW8xrf01HE6OsQ==/lib/x86/libnative-utils.so (BuildId: 7c3071b7147160a05e156755470bd2f5b9dfd42b)
2024-05-30 14:03:58.818 8788-8788 DEBUG crash_dump32 A #14 pc 00ffc523 /data/app/com.b44t.messenger.beta-VMaQurdwAW8xrf01HE6OsQ==/lib/x86/libnative-utils.so (BuildId: 7c3071b7147160a05e156755470bd2f5b9dfd42b)
2024-05-30 14:03:59.503 2021-2133 InputDispatcher system_process E channel 'b0e7b2a com.b44t.messenger.beta/org.thoughtcrime.securesms.WebxdcActivity (server)' ~ Channel is unrecoverably broken and will be disposed!
2024-05-30 14:03:59.504 2021-2133 InputDispatcher system_process E channel '8c15b80 com.b44t.messenger.beta/org.thoughtcrime.securesms.ConversationActivity (server)' ~ Channel is unrecoverably broken and will be disposed!
2024-05-30 14:03:59.645 8806-8806 .messenger.bet com.b44t.messenger.beta I Late-enabling -Xcheck:jni
2024-05-30 14:03:59.689 8806-8806 .messenger.bet com.b44t.messenger.beta E Unknown bits set in runtime_flags: 0x8000
2024-05-30 14:03:59.691 8806-8806 .messenger.bet com.b44t.messenger.beta W Unexpected CPU variant for X86 using defaults: x86

There is no system call number found anywhere in the logs even though it is expected according to https://source.android.com/docs/core/tests/debug/native-crash#seccomp

Maybe running dumbpipe in termux in emulator can be tried to debug this.

I suspect that it is related to netdev crate, at least it does not make sense to try accessing /proc/net/arp like on normal Linux if it is not allowed on Androids anyway.

link2xt commented 4 months ago

Update: in x86_64 emulator it works, the problem is only in x86 (32-bit) emulator.