ggerganov / llama.cpp

LLM inference in C/C++
MIT License
60.82k stars 8.68k forks source link

Bug: Fatal signal 11 (SIGSEGV) on Google Pixel 8 (dart) #7908

Open g1henx opened 1 week ago

g1henx commented 1 week ago

What happened?

The app crashes directly on Android.

Name and Version

version 82fa6b5 built on mac os Version 14.4.1 (23E224) for android arm64

What operating system are you seeing the problem on?

Other? (Please let us know in description)

Relevant log output

F/libc    (13025): Fatal signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x104 in tid 13129 (1.ui), pid 13025 (ical_transcript)
*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
Build fingerprint: 'google/shiba/shiba:14/AP1A.240505.005/11677807:user/release-keys'
Revision: 'MP1.0'
ABI: 'arm64'
Timestamp: 2024-06-12 22:32:49.439917835+0200
Process uptime: 22s
Cmdline: com.m.medical_transcript
pid: 13025, tid: 13129, name: 1.ui  >>> com.m.medical_transcript <<<
uid: 10001
tagged_addr_ctrl: 0000000000000001 (PR_TAGGED_ADDR_ENABLE)
pac_enabled_keys: 000000000000000f (PR_PAC_APIAKEY, PR_PAC_APIBKEY, PR_PAC_APDAKEY, PR_PAC_APDBKEY)
signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x0000000000000104
Cause: null pointer dereference
    x0  0000000000000000  x1  00000077005674f8  x2  0000000000000000  x3  0000000000000000
    x4  0000000000000100  x5  b40000785be05535  x6  5e6b60626863646c  x7  7f7f7f7f7f7f7f7f
    x8  0000000000000000  x9  000000000000000b  x10 b4000078fbde0378  x11 fffffffffffffff5
    x12 000000000000000b  x13 b40000797bdf4a7b  x14 00000000fffffff5  x15 0000007788d045b5
    x16 0000000000000054  x17 000000000000004c  x18 0000007673870000  x19 0000007700567548
    x20 0000000000000100  x21 b40000785bdf1040  x22 0000000000000055  x23 b40000785be054e0
    x24 0000007700568c00  x25 0000007700566440  x26 b40000798bef3204  x27 b40000798bef3260
    x28 b40000798bef32cc  x29 0000007700567460
    lr  0000007788d79708  sp  0000007700565360  pc  0000007788d79734  pst 0000000020001000
3 total frames
backtrace:
      #00 pc 00000000000f0734  /data/app/~~pxfJwopSsKArvgUnNhUKeQ==/com.m.medical_transcript-hb6fLWXE7pgcYYYkBFcFrQ==/base.apk!libllama.so (offset 0x294000) (llama_model_loader::llama_model_loader(std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> > const&, bool, bool, llama_model_kv_override const*)+276) (BuildId: ad08ef7eaf532ed83ec1110dcf992b82c3414fa1)
      #01 pc 00000000000eebf0  /data/app/~~pxfJwopSsKArvgUnNhUKeQ==/com.m.medical_transcript-hb6fLWXE7pgcYYYkBFcFrQ==/base.apk!libllama.so (offset 0x294000) (llama_load_model_from_file+1188) (BuildId: ad08ef7eaf532ed83ec1110dcf992b82c3414fa1)
      #02 pc 0000000000007fd4  [anon:dart-code]
Lost connection to device.
the Dart compiler exited unexpectedly.
g1henx commented 1 week ago

It happens on IOS too, the same error.

ignoramous commented 1 week ago

PR_TAGGED_ADDR_ENABLE

A workaround as an app developer: Ask Android to relax on crashing out on address sanity (this won't prevent your app from crashing if you're not careful, though some apps genuinely have a need to manipulate the higher-bits of pointers, which when it goes wrong will end up but in a different crash). This is what we do for our app (code):

https://github.com/celzero/rethink-app/issues/962

+   <application android:gwpAsanMode="never"
        android:name=".RethinkDnsApplication"
        android:largeHeap="true"
+       android:allowNativeHeapPointerTagging="false"
+       android:memtagMode="off"