On Thu, Aug 15, 2019 at 05:15:57PM +0200, Michal Privoznik wrote:
Hold on to your hat, this is going to be a wild ride. As nearly
nothing in glic, nor open() is a real function. Just look into

s/glic/glibc/

bits/fcntl2.h and you'll see that open() is actually a thin
wrapper that calls either __open_alias() or __open_2(). Now,
before 801ebb5edb6 the open() done in
virPCIDeviceConfigOpenInternal() had a constant oflags (we were
opening the pci config with O_RDWR). And since we were not
passing any mode nor O_CREAT the wrapper decided to call
__open_alias() which was open() provided by our mock. So far so
good. But after the referenced commit, the oflags is no longer
compile time constant and therefore the wrapper calls __open_2()
which we don't mock and thus the real __open_2() from glibc was
called and thus we did try to open real path from host's /sys.
This of course fails with variety of errors.

Signed-off-by: Michal Privoznik <mpriv...@redhat.com>
---
tests/virpcimock.c | 29 +++++++++++++++++++++++++++++
1 file changed, 29 insertions(+)


Thanks for tracking this down!

Reviewed-by: Ján Tomko <jto...@redhat.com>

Jano

Attachment: signature.asc
Description: PGP signature

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

Reply via email to