SIGSEGV handler receives strange address in info->si_addr

Skip to first unread message

Panagiotis Apostolou

Aug 11, 2022, 1:23:29 PM8/11/22
to android-ndk
This is on Android 12 on a Pixel 6. I am installing a `SIGSEGV` handler to catch and handle on purpose generated segmentation faults. This works as expected but I am observing a single case where the `info->si_addr` passed to the handler is not what I expect it to be.

For example let's say that a memory is allocated with mmap at `0x6ecae15000` and size `4194304` bytes. It is protected with `PROT_NONE`. Then there is a write on address `0x6ecae1e000`. A `SIGSEGV` is triggered and the handler is called but the `info->si_addr` is `0x277500001a93`. However the `ucontext->uc_mcontext.fault_address` holds the expected address (`0x6ecae1e000`).

Any ideas why there's this discrepancy in `info->si_addr` value? Maybe on arm only `ucontext->uc_mcontext.fault_address` should be relied upon getting the fault address?

Reply all
Reply to author
0 new messages