qiling icon indicating copy to clipboard operation
qiling copied to clipboard

Make symbolic link for Android

Open ytournier opened this issue 1 year ago • 1 comments

Using Android binaries found in the rootfs, the readlink syscall does not find the binaries associated with file descriptors 3 and 4 which are libdl.so and libc.so respectively.

Here's the warning message raise during the execution:

linker: readlink("/proc/self/fd/3") failed: Operation not permitted [fd=3]
linker: warning: unable to get realpath for the library "/system/lib64/libdl.so". Will use given path.
linker: readlink("/proc/self/fd/4") failed: Operation not permitted [fd=4]
linker: warning: unable to get realpath for the library "/system/lib64/libc.so". Will use given path.
propClient: PropClient failed to load

Creating symbolic links as shown below is enough to satisfy the linker:

mkdir -p rootfs/arm64_android/proc/self/fd
ln -sf rootfs/arm64_android/system/lib64/libdl.so rootfs/arm64_android/proc/self/fd/3
ln -sf rootfs/arm64_android/system/lib64/libc.so rootfs/arm64_android/proc/self/fd/4

ytournier avatar Mar 09 '24 10:03 ytournier

When u open a file , /proc/pid/fd/[N] will be a symbol link to the file which is opened with fd [N]. It's done by linux kernel. But qiling's procfs is not consistent with the real environment. You can mock procfs by Hijacking VFS objects

DiamondHunters avatar Apr 01 '24 08:04 DiamondHunters