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

Re: [libvirt] [PATCH 2/2] virpcimock: Mock __open_2()



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
> 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 <mprivozn redhat com>
> ---

Reviewed-by: Erik Skultety <eskultet redhat com>


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