Thanks!
Not a problem, will commit in a different patch as this is specific to ptp.
Luca
On 02/02/2023 16:06, Kevin Brodsky wrote:
On 31/01/2023 17:01, Luca Vizzarro wrote:
The third argument of ioctl handlers is a user input which can contain either a pointer to data in the user space or any number. This commit changes the type of the argument from unsigned long to user_uintptr_t so that we can accommodate the bigger size of capabilities and accept them from user space correctly without discarding their metadata.
Good explanation and nothing to complain about in the diff :)
Not directly about this diff, but looking at the core POSIX clock functions (kernel/time/posix-clock.c), I realised that the compat handler (posix_clock_compat_ioctl) is not PCuABI-friendly: it passes the unsigned long arg unchanged to the native handler. Considering that arg almost always represents a user pointer (all commands but one AFAICT), I think we can consider it's always a user pointer and go for the usual approach, see this section [1] of the porting guide. This is closely related to the changes you are making here, so it could be in the same patch, or a separate one, up to you.
Kevin
[1] https://git.morello-project.org/morello/kernel/linux/-/blob/morello/master/D...
Signed-off-by: Luca Vizzarro Luca.Vizzarro@arm.com
drivers/ptp/ptp_chardev.c | 2 +- drivers/ptp/ptp_private.h | 2 +- include/linux/posix-clock.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/ptp/ptp_chardev.c b/drivers/ptp/ptp_chardev.c index af3bc65c4595..397e4ba71d90 100644 --- a/drivers/ptp/ptp_chardev.c +++ b/drivers/ptp/ptp_chardev.c @@ -106,7 +106,7 @@ int ptp_open(struct posix_clock *pc, fmode_t fmode) return 0; } -long ptp_ioctl(struct posix_clock *pc, unsigned int cmd, unsigned long arg) +long ptp_ioctl(struct posix_clock *pc, unsigned int cmd, user_uintptr_t arg) { struct ptp_clock *ptp = container_of(pc, struct ptp_clock, clock); struct ptp_sys_offset_extended *extoff = NULL; diff --git a/drivers/ptp/ptp_private.h b/drivers/ptp/ptp_private.h index 77918a2c6701..3bd83bc6e209 100644 --- a/drivers/ptp/ptp_private.h +++ b/drivers/ptp/ptp_private.h @@ -118,7 +118,7 @@ int ptp_set_pinfunc(struct ptp_clock *ptp, unsigned int pin, enum ptp_pin_function func, unsigned int chan); long ptp_ioctl(struct posix_clock *pc,
unsigned int cmd, unsigned long arg);
unsigned int cmd, user_uintptr_t arg);
int ptp_open(struct posix_clock *pc, fmode_t fmode); diff --git a/include/linux/posix-clock.h b/include/linux/posix-clock.h index 468328b1e1dd..184aaa05d0ff 100644 --- a/include/linux/posix-clock.h +++ b/include/linux/posix-clock.h @@ -51,7 +51,7 @@ struct posix_clock_operations { * Optional character device methods: */ long (*ioctl) (struct posix_clock *pc,
unsigned int cmd, unsigned long arg);
unsigned int cmd, user_uintptr_t arg);
int (*open) (struct posix_clock *pc, fmode_t f_mode);