Ad

Android NDK SIGSEGV Fatal Signal 11, Code 2 (SEGV_ACCERR)

- 1 answer

I have this error appearing: A/libc: Fatal signal 11 (SIGSEGV), code 2 (SEGV_ACCERR), fault addr 0xf523dffc itd... and in the debugger I can gather only the following information:

<MAIN THREAD>
* frame #0: 0xf00e3a00 libart.so`art_sigsegv_fault
    frame #1: 0xf00e3fa4 libart.so`art::FaultManager::HandleFault(int, siginfo*, void*) + 372
    frame #2: 0xf00e3ccb libart.so`art::art_fault_handler(int, siginfo*, void*) (.llvm.2308358812779254744) + 43
    frame #3: 0x5fd1afe1 app_process32`___lldb_unnamed_symbol25$$app_process32 + 625
    frame #4: 0xf17d7180 libc.so`___lldb_unnamed_symbol2$$libc.so + 1
    frame #5: 0xc28d951c libnative-lib.so`vcode_synth_frame_rate at vocoder.c:1112
    frame #6: 0xc28d77bc libnative-lib.so`vcode_action at vocoder.c:1315
    frame #7: 0xc28d951c libnative-lib.so`vcode_synth_frame_rate at vocoder.c:1112

and then, clicking on the "continue execution" button it shows:

 thread #7, name = 'Signal Catcher', stop reason = breakpoint 15.1
  * frame #0: 0xf00e3a00 libart.so`art_sigsegv_fault
    frame #1: 0xf00e3fa4 libart.so`art::FaultManager::HandleFault(int, siginfo*, void*) + 372
    frame #2: 0xf00e3ccb libart.so`art::art_fault_handler(int, siginfo*, void*) (.llvm.2308358812779254744) + 43
    frame #3: 0x5fd1afe1 app_process32`___lldb_unnamed_symbol25$$app_process32 + 625
    frame #4: 0xf17d7180 libc.so`___lldb_unnamed_symbol2$$libc.so + 1
    frame #5: 0xc28d951c libnative-lib.so`vcode_synth_frame_rate at vocoder.c:1112
    frame #6: 0xc28d77bc libnative-lib.so`vcode_action at vocoder.c:1315
    frame #7: 0xc28680b3 libnative-lib.so`android_live_render(frames_number=128, ioData=0xc2930004) at app_delegate.c:198
    frame #8: 0xc286853b libnative-lib.so`do_stuff at app_delegate.c:265
    frame #9: 0xf186c140 libc.so`ru_reseed + 4
    frame #10: 0xeff73f21 libart.so

from there, sometimes it shows some more rows in the function, but most often it just stops on the function name.

From my understanding SEGV_ACCERR means that I'm accessing an address of which I'm not an owner. In the build file I have the following:

defaultConfig {
  ...

  ndk {
    abiFilters 'x86', 'x86_64', 'armeabi-v7a', 'arm64-v8a'
  }
}

Using Android 9. I cannot understand what's the issue, because the debugger won't evidence a specific line, but just the function name, as shown in the backtrace.

Every run will give the same event address, 0xf523dffc

Ad

Answer

Apparently, when a function name is indicated, it might mean that the stack of that function overflowed. I added the static keyword to some arrays inside vcode_synth_frame_rate, and that SIGSEGV error disappeared.

I still did not understand this very well, if anyone has more detailed information please add an answer and I'll mark it as the accepted answer.

Ad
source: stackoverflow.com
Ad