Re: [PATCH] posix-clock: Explicitly handle compat ioctls
From: Arnd Bergmann
Date: Thu Jan 23 2025 - 16:11:32 EST
On Thu, Jan 23, 2025, at 17:22, Thomas Weißschuh wrote:
> On 2025-01-22 18:15:13+0100, Arnd Bergmann wrote:
>> A simpler variant of the patch would move the switch/case logic
>> into posix_clock_compat_ioctl() and avoid the extra function
>> pointer, simply calling posix_clock_ioctl() with the modified
>> argument.
>
> That would work, but be a layering violation.
> Or a "compat_mode" argument to ptp_ioctl()
>
> I'm fine with either approach.
You don't even need to add an argument, just use
in_compat_syscall() to check for compat mode inside
of the ioctl handler. If CONFIG_COMPAT is disabled, that
gets optimized out through dead-code-elimination.
Arnd