Re: [PATCH v3 5/8] x86: Move 32-bit compat syscalls to common location

From: Andy Lutomirski
Date: Fri Feb 28 2020 - 13:47:12 EST


On Thu, Feb 27, 2020 at 5:28 AM Brian Gerst <brgerst@xxxxxxxxx> wrote:
>
> Move the 32-bit wrappers for syscalls that take 64-bit arguments (loff_t)
> to a common location so that native 32-bit can use them in preparation for
> enabling pt_regs-based syscalls.

Can you clarify the purpose? Even having read the series up to this
point, I have no idea what this has to do with pt_regs.

I think some renaming is in order. Consider:

>
> -COMPAT_SYSCALL_DEFINE3(x86_ftruncate64, unsigned int, fd,
> - unsigned long, offset_low, unsigned long, offset_high)

It used to be at least a little bit clear what was going on. There's
this compat-only mess that changes arguments for ftruncate64. But
now:

> +SYSCALL_DEFINE3(x86_ftruncate64, unsigned int, fd,
> + unsigned long, offset_low, unsigned long, offset_high)
> {
> return ksys_ftruncate(fd, ((loff_t) offset_high << 32) | offset_low);
> }

What is this "x86" ftruncate64 thing?

Maybe call it ia32_ftructate? Or at least do something to indicate
that this is for a specific ABI.

> diff --git a/arch/x86/um/sys_call_table_32.c b/arch/x86/um/sys_call_table_32.c
> index 9649b5ad2ca2..d5520e92f89d 100644
> --- a/arch/x86/um/sys_call_table_32.c
> +++ b/arch/x86/um/sys_call_table_32.c
> @@ -26,6 +26,16 @@
>
> #define old_mmap sys_old_mmap
>
> +#define sys_x86_pread sys_pread64
> +#define sys_x86_pwrite sys_pwrite64
> +#define sys_x86_truncate64 sys_truncate64
> +#define sys_x86_ftruncate64 sys_ftruncate64
> +#define sys_x86_readahead sys_readahead
> +#define sys_x86_fadvise64 sys_fadvise64
> +#define sys_x86_fadvise64_64 sys_fadvise64_64
> +#define sys_x86_sync_file_range sys_sync_file_range
> +#define sys_x86_fallocate sys_fallocate

Can this not be killed by changing the table itself instead of adding
a bunch of defines?