[Magisk] doremus0:
Hi everyone,

I writing my first Magisk module to add a fork of Iode Blocker.

I need to inject a modified version of libnetd_resolv.so inside /apex.

To achieve this i have written a custom .rc with the following code :

on early-boot
mount rootfs rootfs / rw remount
exec u:r:magisk:s0 0 0 -- /system/bin/mount -o bind ${MAGISKTMP}/libnetd_resolv.so /apex/com.android.resolv/lib64/libnetd_resolv.so
exec u:r:magisk:s0 0 0 -- /system/bin/mount -o bind ${MAGISKTMP}/libnetd_resolv.so /apex/com.android.resolv@350090000/lib64/libnetd_resolv.so
mount rootfs rootfs / ro remount

I have patched the boot image to add custom .rc to the root overlay and libnetd_resolv.so to overlay.d/sbin.

Logcat shown that the substitution is ok and if i compare the checksum of the lib inside /apex it is my own libnetd_resolv.so version on the system but i suspect the system to not execute my version of the lib, i put some logs inside it and there are never displayed in logcat.

What i'm doing wrong ?

01-15 01:20:35.568 380 380 I apexd-bootstrap: Found pre-installed APEX /system/apex/com.android.resolv.capex
01-15 01:20:36.799 674 674 I apexd : Found pre-installed APEX /system/apex/com.android.resolv.capex
01-15 01:20:36.813 674 674 I apexd : Processing compressed APEX /system/apex/com.android.resolv.capex
01-15 01:20:36.816 674 674 I apexd : Skipping decompression for /system/apex/com.android.resolv.capex
01-15 01:20:36.883 695 695 I apexd : Successfully mounted package /data/apex/decompressed/com.android.resolv@350090000.decompressed.apex on /apex/com.android.resolv@350090000 duration=34
07-24 15:00:26.288 1 1 I init : starting service 'exec 18 (/system/bin/mount -o bind /debug_ramdisk/libnetd_resolv.so /apex/com.android.resolv/lib64/libnetd_resolv.so)'...
07-24 15:00:26.289 1 1 I init : ... started service 'exec 18 (/system/bin/mount -o bind /debug_ramdisk/libnetd_resolv.so /apex/com.android.resolv/lib64/libnetd_resolv.so)' has pid 881
07-24 15:00:26.289 1 1 I init : SVC_EXEC service 'exec 18 (/system/bin/mount -o bind /debug_ramdisk/libnetd_resolv.so /apex/com.android.resolv/lib64/libnetd_resolv.so)' pid 881 (uid 0 gid 0+0 context u:r:magisk:s0) started; waiting...
07-24 15:00:26.296 1 1 I init : Service 'exec 18 (/system/bin/mount -o bind /debug_ramdisk/libnetd_resolv.so /apex/com.android.resolv/lib64/libnetd_resolv.so)' (pid 881) exited with status 0 waiting took 0.006000 seconds
07-24 15:00:26.296 1 1 I init : Sending signal 9 to service 'exec 18 (/system/bin/mount -o bind /debug_ramdisk/libnetd_resolv.so /apex/com.android.resolv/lib64/libnetd_resolv.so)' (pid 881) process group...
07-24 15:00:26.296 1 1 I init : starting service 'exec 19 (/system/bin/mount -o bind /debug_ramdisk/libnetd_resolv.so /apex/com.android.resolv@350090000/lib64/libnetd_resolv.so)'...
07-24 15:00:26.297 1 1 I init : ... started service 'exec 19 (/system/bin/mount -o bind /debug_ramdisk/libnetd_resolv.so /apex/com.android.resolv@350090000/lib64/libnetd_resolv.so)' has pid 884
07-24 15:00:26.297 1 1 I init : SVC_EXEC service 'exec 19 (/system/bin/mount -o bind /debug_ramdisk/libnetd_resolv.so /apex/com.android.resolv@350090000/lib64/libnetd_resolv.so)' pid 884 (uid 0 gid 0+0 context u:r:magisk:s0) started; waiting...
07-24 15:00:26.303 1 1 I init : Service 'exec 19 (/system/bin/mount -o bind /debug_ramdisk/libnetd_resolv.so /apex/com.android.resolv@350090000/lib64/libnetd_resolv.so)' (pid 884) exited with status 0 waiting took 0.006000 seconds
07-24 15:00:26.303 1 1 I init : Sending signal 9 to service 'exec 19 (/system/bin/mount -o bind /debug_ramdisk/libnetd_resolv.so /apex/com.android.resolv@350090000/lib64/libnetd_resolv.so)' (pid 884) process group...