• Uncategorized

About linux : Failed-in-using-LDPRELOAD-to-hook-mmap-system-call-in-qemuthrough-libvirt

Question Detail

I want to hook mmap system call in qemu, and I use libvirt to passthrough the environment argument like this:

<qemu:commandline>
  <qemu:env name='LD_PRELOAD' value='/glibcHookMMAP.so'/>
</qemu:commandline>

But it failed! I can hardly find out what is the matter! The log in libvirt like this:

ERROR: ld.so: object '/glibcHookMMAP.so' from LD_PRELOAD cannot be preloaded (cannot open shared object file): ignored.

Firstly, I think it’s the problem of authority. But the file glibcHookMMAP.so has been done with command chmod 777.

Environment:

Ubuntu 18.04.2 Linux 5.4.0-92

libvirt 4.0.0

qemu 2.11.1

Question Answer

OK, now I know the solution: Apparmor policy in Ubuntu limits the work, is like the SELinux. Thus I should modify configuration in /etc/apparmor.d/abstractions/libvirt-qemu to allow libvirt to link .so.

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.