2024-06-06 13:29:25

by Arnd Bergmann

[permalink] [raw]
Subject: Re: [PATCH v3] hpet: Support 32-bit userspace

On Thu, Jun 6, 2024, at 14:39, He Zhe wrote:
> hpet_compat_ioctl and read file operations failed to handle parameters from
> 32-bit userspace and thus samples/timers/hpet_example.c fails as below.
>
> root@intel-x86-64:~# ./hpet_example-32.out poll /dev/hpet 1 2
> -hpet: executing poll
> hpet_poll: HPET_IRQFREQ failed
>
> This patch fixes cmd and arg handling in hpet_compat_ioctl and adds compat
> handling for 32-bit userspace in hpet_read.
>
> hpet_example now shows that it works for both 64-bit and 32-bit.
>
> root@intel-x86-64:~# ./hpet_example-32.out poll /dev/hpet 1 2
> -hpet: executing poll
> hpet_poll: info.hi_flags 0x0
> hpet_poll: expired time = 0xf4298
> hpet_poll: revents = 0x1
> hpet_poll: data 0x1
> hpet_poll: expired time = 0xf4235
> hpet_poll: revents = 0x1
> hpet_poll: data 0x1
> root@intel-x86-64:~# ./hpet_example-64.out poll /dev/hpet 1 2
> -hpet: executing poll
> hpet_poll: info.hi_flags 0x0
> hpet_poll: expired time = 0xf42a1
> hpet_poll: revents = 0x1
> hpet_poll: data 0x1
> hpet_poll: expired time = 0xf4232
> hpet_poll: revents = 0x1
> hpet_poll: data 0x1
>
> Cc: [email protected]
> Signed-off-by: He Zhe <[email protected]>

Fixes: 54066a57c584 ("hpet: kill BKL, add compat_ioctl")
Reviewed-by: Arnd Bergmann <[email protected]>