[libvirt-users] Preloading shared library with libVirt

Daniel P. Berrangé berrange at redhat.com
Thu Jul 18 09:01:52 UTC 2019


On Thu, Jul 18, 2019 at 10:25:57AM +0200, Peter Krempa wrote:
> 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.

Yep, $HOME permissions would be the most likely explanation as $HOME
is usually locked down by default which would prevent the qemu user
from loading anything from under it.

Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|




More information about the libvirt-users mailing list