3

I was trying to emulate a firmware and as a part of the process I was interested in knowing what device files are being registered using mknod. In order to intercept those calls I had created a shared object file and just for a dry run, I was trying to preload this shared library while making a call to mknod to register a character device while doing user space emulation with QEMU like so.

sudo strace chroot . ./qemu-mips-static -E LD_PRELOAD="/mknod.so" mknod chrdev4 100 0

The files are in the correct place and I was following a tutorial very closely so I know am not making a syntactical as such, but my strace log showed my preloaded library not being accessed at all. Please note that in this case, my mknod is a symbolic link to the busybox binary which in turn executes the mknod syscall. I was wondering if that level of indirection could be an issue and possibly a reason as to why my library isn't getting preloaded?

1
  • If I had to guess, adding -E LD_LIBRARY_PATH="/" would do the trick. You can have multiple -E options. A complete command might look like this: sudo strace chroot . ./qemu-mips-static -E LD_LIBRARY_PATH="/" -E LD_PRELOAD="mknod.so" mknod chrdev4 100 0 Oct 31, 2022 at 3:20

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.