Re: [PATCH v2 5/5] Prevent more compiler optimization of mockable functions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Jul 11, 2017 at 11:54:21PM +0000, Marc-André Lureau wrote:
> Hi
> 
> On Mon, Jul 10, 2017 at 1:14 PM Peter Krempa <pkrempa@xxxxxxxxxx> wrote:
> 
> > On Wed, Jul 05, 2017 at 12:58:51 +0100, Daniel Berrange wrote:
> > > Currently all mockable functions are annotated with the 'noinline'
> > > attribute. This is insufficient to guarantee that a function can
> > > be reliably mocked with an LD_PRELOAD. The C language spec allows
> > > the compiler to assume there is only a single implementation of
> > > each function. It can thus do things like propagating constant
> > > return values into the caller at compile time, or creating
> > > multiple specialized copies of the function body each optimized
> > > for a different caller. To prevent these optimizations we must
> > > also set the 'noclone' and 'weak' attributes.
> > >
> > > This fixes the test suite when libvirt.so is built with CLang
> > > with optimization enabled.
> > >
> > > Signed-off-by: Daniel P. Berrange <berrange@xxxxxxxxxx>
> >
> 
> This patch makes virtlogd crash:
> 
>  (gdb) bt
> #0  0x0000000000000000 in ?? ()
> #1  0x00005555555a8084 in virHashCreateFull (size=size@entry=5,
> dataFree=0x5555555b0930 <virObjectFreeHashData>,
> keyCode=keyCode@entry=0x5555555a7c30
> <virHashStrCode>, keyEqual=keyEqual@entry=0x5555555a7c10 <virHashStrEqual>,
> keyCopy=keyCopy@entry=0x5555555a7bb0 <virHashStrCopy>,
> keyFree=keyFree@entry=0x5555555a7b90
> <virHashStrFree>) at util/virhash.c:167
> #2  0x00005555555a8151 in virHashCreate (size=size@entry=5,
> dataFree=<optimized out>) at util/virhash.c:196
> #3  0x00005555555779f0 in virNetDaemonNew () at rpc/virnetdaemon.c:137
> #4  0x00005555555708ec in virLogDaemonNew (privileged=false,
> config=0x555555820940) at logging/log_daemon.c:163
> #5  main (argc=<optimized out>, argv=0x7fffffffd888) at
> logging/log_daemon.c:1069
> 
> any idea?

I can reproduce that too, so i'll investigate

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 :|

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]
  Powered by Linux