On Tue, Jan 21, 2025, at 23:41, Thomas Weißschuh wrote: > Pointer arguments passed to ioctls need to pass through compat_ptr() to > work correctly on s390; as explained in Documentation/driver-api/ioctl.rst. > Plumb the compat_ioctl callback through 'struct posix_clock_operations' > and handle the different ioctls cmds in the new ptp_compat_ioctl(). > > Using compat_ptr_ioctl is not possible. > For the commands PTP_ENABLE_PPS/PTP_ENABLE_PPS2 on s390 > it would corrupt the argument 0x80000000, aka BIT(31) to zero. > > Fixes: 0606f422b453 ("posix clocks: Introduce dynamic clocks") > Fixes: d94ba80ebbea ("ptp: Added a brand new class driver for ptp clocks.") > Cc: stable@xxxxxxxxxxxxxxx > Signed-off-by: Thomas Weißschuh <linux@xxxxxxxxxxxxxx> This looks correct to me, Reviewed-by: Arnd Bergmann <arnd@xxxxxxxx> > +#ifdef CONFIG_COMPAT > +long ptp_compat_ioctl(struct posix_clock_context *pccontext, unsigned > int cmd, > + unsigned long arg) > +{ > + switch (cmd) { > + case PTP_ENABLE_PPS: > + case PTP_ENABLE_PPS2: > + /* These take in scalar arg, do not convert */ > + break; I was confused a bit here because the PTP_ENABLE_PPS and PTP_ENABLE_PPS2 definitions use _IOW(..., int), suggesting that the argument is passed through a pointer, when the code uses the 'arg' as a integer instead. Not your fault of course but it might help to explain this in the comment. Arnd