hybris: q: make sure executable code segment is mapped as readable
This neutralizes execute-only memory feature introduced in Android 10 and removed in Android 11: https://source.android.com/devices/tech/debug/execute-only-memory
Having code segments non-readable broke frame unwind in host libgcc and caused segmentation fault crashes when pthread_exit (hooked by libhybris to the method in host libc) is called from code located in execute-only memory. libgcc's unwind implementation attempts to read code from PC register in the saved context of the thread that is destroyed: https://github.com/gcc-mirror/gcc/blob/master/libgcc/config/aarch64/linux-unwind.h#L74. In this case "pc" points to execute-memory memory and dereferencing the pointer leads to segfault.
This is expected to fix audio in voice calls on Volla Phone X with Halium 10 and other MediaTek devices on same Android base. Currently PulseAudio crashes with the following back trace when closing input stream:
Thread 16 "processThread_2" received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7f96d52010 (LWP 29191)]
aarch64_fallback_frame_state (context=0x7f96d512c0, context=0x7f96d512c0, fs=0x7f96d507c0)
at ./md-unwind-support.h:72
72 ./md-unwind-support.h: No such file or directory.
(gdb) bt
#0 aarch64_fallback_frame_state (context=0x7f96d512c0, context=0x7f96d512c0,
fs=0x7f96d507c0) at ./md-unwind-support.h:72
#1 uw_frame_state_for (context=context@entry=0x7f96d512c0, fs=fs@entry=0x7f96d507c0)
at ../../../src/libgcc/unwind-dw2.c:1249
#2 0x0000007fb41a29c0 in _Unwind_ForcedUnwind_Phase2 (exc=exc@entry=0x7f96d52480,
context=context@entry=0x7f96d512c0) at ../../../src/libgcc/unwind.inc:155
#3 0x0000007fb41a2d4c in _Unwind_ForcedUnwind (exc=0x7f96d52480,
stop=stop@entry=0x7fbf431080 <unwind_stop>, stop_argument=0x7f96d51848)
at ../../../src/libgcc/unwind.inc:207
#4 0x0000007fbf4311fc in __GI___pthread_unwind (buf=<optimized out>) at unwind.c:121
#5 0x0000007fbf428fb0 in __do_cancel () at pthreadP.h:283
#6 __pthread_exit (value=<optimized out>) at pthread_exit.c:28
#7 0x0000007fb28d53fc in ?? ()
#8 0x0000007fbf2ca410 in thread_start () at ../sysdeps/unix/sysv/linux/aarch64/clone.S:89