Re: [RFC PATCH 1/9] ntsync: Introduce the ntsync driver and character device.

From: Arnd Bergmann
Date: Wed Jan 24 2024 - 02:41:45 EST


On Wed, Jan 24, 2024, at 01:40, Elizabeth Figura wrote:
> ntsync uses a misc device as the simplest and least intrusive uAPI interface.
>
> Each file description on the device represents an isolated NT instance, intended
> to correspond to a single NT virtual machine.
>
> Signed-off-by: Elizabeth Figura <zfigura@xxxxxxxxxxxxxxx>

I'm looking at the ioctl interface to ensure it's well-formed.

Your patches look ok from that perspective, but there are a
few minor things I would check for consistency here:

> +
> +static const struct file_operations ntsync_fops = {
> + .owner = THIS_MODULE,
> + .open = ntsync_char_open,
> + .release = ntsync_char_release,
> + .unlocked_ioctl = ntsync_char_ioctl,
> + .compat_ioctl = ntsync_char_ioctl,
> + .llseek = no_llseek,
> +};

The .compat_ioctl pointer should point to compat_ptr_ioctl()
since the actual ioctl commands all take pointers instead
of interpreting the argument as a number.

On x86 and arm64 this won't make a difference as compat_ptr()
is a nop.

Arnd