On Mon, May 06, 2024 at 10:43:02AM +0200, Michal Privoznik wrote: > Strictly speaking, xdrproc_t is declared as following: > > typedef bool_t (*xdrproc_t)(XDR *, ...); > > But our rpcgen generates properly typed functions, e.g.: > > bool_t xdr_virNetMessageError(XDR *xdrs, virNetMessageError *objp) > > Now, these functions of ours are passed around as callbacks (via > an argument of xdrproc_t type), for instance in > virNetMessageEncodePayload(). But these two types are strictly > different. We silence the compiler by typecasting the callbacks > when passing them, but strictly speaking - calling such callback > later, when a function of xdrproc_t is expected is an undefined > behavior. > > Ideally, we would fix our rpcgen to generate proper function > headers, but: a) my brain is too small to do that, and b) we > would lose compiler protection if an xdr_*() function is called > directly but argument of a wrong type is passed. The right solution is to finish my previous work to throw away libtirpc, in favour of generating libvirt code that natively works with virNetMessage. > > Silence UBSAN for now. > > Signed-off-by: Michal Privoznik <mprivozn@xxxxxxxxxx> > --- > meson.build | 13 +++++++++++++ > 1 file changed, 13 insertions(+) Reviewed-by: Daniel P. Berrangé <berrange@xxxxxxxxxx> With 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 :| _______________________________________________ Devel mailing list -- devel@xxxxxxxxxxxxxxxxx To unsubscribe send an email to devel-leave@xxxxxxxxxxxxxxxxx