+1
On 1/30/23 10:31, Kevin Brodsky wrote:
preadv, pwritev and their variants (preadv2/pwritev2) do have compat handlers defined in generic code. However, these handlers are completely specific to 32-bit, as they expect the offset to be passed in two consecutive 32-bit integers.
Since the compat handlers do not perform any other conversion, we can simply use the native handlers instead in compat64.
Note that using the 64-suffixed compat handlers (e.g. compat_sys_preadv64) would not be any better, and in fact would not work in the case of preadv2/pwritev2. Indeed, these syscalls accept another argument after the offset, but compat_sys_{preadv64v2,pwrite64v2} take just one 64-bit integer as offset. This is incompatible with the prototype of native handlers, as they take two 64-bit integers for the offset and ignore the second one.
Signed-off-by: Kevin Brodsky kevin.brodsky@arm.com
arch/arm64/kernel/sys_compat64.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
diff --git a/arch/arm64/kernel/sys_compat64.c b/arch/arm64/kernel/sys_compat64.c index b3c4cf9f3af8..41d72554907a 100644 --- a/arch/arm64/kernel/sys_compat64.c +++ b/arch/arm64/kernel/sys_compat64.c @@ -29,6 +29,16 @@ #define __arm64_compatentry_compat_sys_readahead __arm64_compatentry_sys_readahead #define __arm64_compatentry_compat_sys_fadvise64_64 __arm64_compatentry_sys_fadvise64_64 +/*
- The compat_sys_{preadv,pwritev}{,2} handlers are not appropriate for 64-bit
- tasks, as they expect the offset to be split in two 32-bit integers. The
- native handlers work fine in 64-bit compat too so just use those instead.
- */
+#define __arm64_compatentry_compat_sys_preadv __arm64_compatentry_sys_preadv +#define __arm64_compatentry_compat_sys_preadv2 __arm64_compatentry_sys_preadv2 +#define __arm64_compatentry_compat_sys_pwritev __arm64_compatentry_sys_pwritev +#define __arm64_compatentry_compat_sys_pwritev2 __arm64_compatentry_sys_pwritev2
- /*
*/
- 64-bit tasks use mmap (not mmap2).