I've been trying to incorporate userfaultfd into a library in order to track accesses to specific memory region that I register with the userfaultfd mechanism but I have some problems getting it work on Android.
I found about userfaultfd recently so in order to get to know how it works I started by writing a standalone test app for desktop. When I got it to work as expected i ndk-build the c source for Android (12) and tried it out on an adb shell. When I saw that it was working there too I started applying the mechanism in the library.
The library is compiled in a .so and is used by other applications (executables) on desktop and (android apps) on Android. After I finished I tried it on desktop and it works. Unfortunately this is not the case for the Android apps. It seems that the thread that is causing the fault never get halted and the thread that is listening (polling/ALooping) on the userfaultfd file descriptor never gets any notification (only time outs)
Any ideas? What am I missing?