[libvirt-users] Preloading shared library with libVirt

Peter Krempa pkrempa at redhat.com
Thu Jul 18 08:25:57 UTC 2019


On Wed, Jul 17, 2019 at 13:33:08 -0500, Probir Roy wrote:
> Hi,
> 
> I am trying to preload two shared libraries while running Qemu using
> libvirt. To preload the shared libraries I have added an environment
> variable in the $domain.xml file with the following command:
> 
> ```
> virt-xml generic --edit --confirm --qemu-commandline
> 'env=LD_PRELOAD=/home/probir/Downloads/kpv_temp/temp/kvmTest/build_kvm/libperform.so:/home/probir/Downloads/kpv_temp/temp/kvmTest/dependencies/libmonitor/installDir/lib/libmonitor.so'
> 
> ```
> However, while running the domain, I get the following message of failure
> to preload the shared files in the log.
> 
> ```
> 2019-07-17 17:35:22.939+0000: starting up libvirt version: 1.3.1, package:
> 1ubuntu10.27 (Marc Deslauriers <marc.deslauriers at ubuntu.com> Tue, 02 Jul
> 2019 09:22:37 -0400), qemu version: 2.5.0 (Debian 1:2.5+dfsg-5ubuntu10.39),
> hostname: probir-XPS-13-9343
> LC_ALL=C PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
> QEMU_AUDIO_DRV=spice
> LD_PRELOAD=/home/probir/Downloads/kpv_temp/temp/kvmTest/build_kvm/libperform.so:/home/probir/Downloads/kpv_temp/temp/kvmTest/dependencies/libmonitor/installDir/lib/libmonitor.so
> /usr/bin/kvm-spice -name generic -S -machine

[...]

> ERROR: ld.so: object
> '/home/probir/Downloads/kpv_temp/temp/kvmTest/build_kvm/libperform.so' from
> LD_PRELOAD cannot be preloaded (cannot open shared object file): ignored.
> ERROR: ld.so: object
> '/home/probir/Downloads/kpv_temp/temp/kvmTest/dependencies/libmonitor/installDir/lib/libmonitor.so'
> from LD_PRELOAD cannot be preloaded (cannot open shared object file):
> ignored.

My rough guess would be that the process we forked off for qemu has
security confinment applied (apparmor and unix permissions changed in
case of ubuntu) and ld.so is thus unable to open the libraries you want
it to preload.

For any other resource libvirt configures the confinment such as that
the process has access, but in this case this is out of our scope and
you have to make sure that the libs are accessible yourself.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvirt-users/attachments/20190718/0eba1012/attachment.sig>


More information about the libvirt-users mailing list