[PATCH 1/2] ioctl: add a stub for decoding vhost related ioctls

Dmitry V. Levin ldv at strace.io
Sun Oct 22 14:02:35 UTC 2023


Hi,

On Sun, Oct 22, 2023 at 03:52:09AM +0300, Daniel Cohen Hillel wrote:
[...]
> > +# ifdef HAVE_STRUCT_VHOST_VRING_FILE
> > +static int
> > +vhost_ioctl_decode_vring_file(struct tcb *const tcp, const unsigned int
> > code,
> > +                      const kernel_ulong_t arg)
> > +{
> > +    struct vhost_vring_file f;
> > +
> > +    if (entering(tcp) && (
> > +           code == VHOST_GET_VRING_BASE
> > +        || code == VHOST_GET_VRING_ENDIAN
> > +        || code == VHOST_GET_VRING_BUSYLOOP_TIMEOUT)) {
> > +            return 0;
> > +    }
[...]
> > +    # ifdef HAVE_STRUCT_VHOST_VRING_STATE
> > +    case VHOST_SET_VRING_NUM:
> > +    case VHOST_SET_VRING_BASE:
> > +    case VHOST_GET_VRING_BASE:
> > +    case VHOST_SET_VRING_ENDIAN:
> > +    case VHOST_GET_VRING_ENDIAN:
> > +    case VHOST_SET_VRING_BUSYLOOP_TIMEOUT:
> > +    case VHOST_GET_VRING_BUSYLOOP_TIMEOUT:
> > +    case VHOST_VDPA_SET_VRING_ENABLE:
> > +        return vhost_ioctl_decode_vring_state(tcp, code, arg);
> > +    # endif

>From a cursory look, the check for VHOST_GET_* is added to
vhost_ioctl_decode_vring_file() while the function being called
is actually vhost_ioctl_decode_vring_state().

Which raises the question, how this code has been tested?
We normally require that every new parser has to be accompanied by a test,
would you be able to provide that as well?


-- 
ldv


More information about the Strace-devel mailing list