[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <603100b4-3895-4b7c-a70e-f207dd961550@app.fastmail.com>
Date: Wed, 22 Jan 2025 08:30:51 +0100
From: "Arnd Bergmann" <arnd@...db.de>
To: Thomas Weißschuh <linux@...ssschuh.net>,
"Richard Cochran" <richardcochran@...il.com>,
"Andrew Lunn" <andrew+netdev@...n.ch>,
"David S . Miller" <davem@...emloft.net>,
"Eric Dumazet" <edumazet@...gle.com>, "Jakub Kicinski" <kuba@...nel.org>,
"Paolo Abeni" <pabeni@...hat.com>,
"Anna-Maria Gleixner" <anna-maria@...utronix.de>,
"Frederic Weisbecker" <frederic@...nel.org>,
"Thomas Gleixner" <tglx@...utronix.de>, "John Stultz" <johnstul@...ibm.com>
Cc: Netdev <netdev@...r.kernel.org>, linux-kernel@...r.kernel.org,
"Cyrill Gorcunov" <gorcunov@...il.com>, stable@...r.kernel.org
Subject: Re: [PATCH] posix-clock: Explicitly handle compat ioctls
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@...r.kernel.org
> Signed-off-by: Thomas Weißschuh <linux@...ssschuh.net>
This looks correct to me,
Reviewed-by: Arnd Bergmann <arnd@...db.de>
> +#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
Powered by blists - more mailing lists