Re: in_compat_syscall() on x86

From: Al Viro
Date: Tue Jan 05 2021 - 19:31:26 EST


On Tue, Jan 05, 2021 at 06:03:15PM -0600, Eric W. Biederman wrote:
> > Yes, the current mainline is bloody awful in that area (PRSTATUS_SIZE and
> > SET_PR_FPVALID are not for weak stomach), but that's really not hard to
> > get into sane shape - -next had that done in last cycle and I'm currently
> > testing (well, building the test kernel) of port of that to 5.11-rc1.
>
> That does sound interesting. Anytime we can clean up arch specific
> weirdness so that it simply becomes generic weirdness and it can be
> tested and maintained by more people is always nice.

vfs.git #work.elf-compat, and AFAICS it works.

arch/Kconfig | 3 ++
arch/arm64/Kconfig | 1 -
arch/ia64/kernel/crash.c | 2 +-
arch/mips/Kconfig | 8 ++----
arch/mips/include/asm/elf.h | 56 +++++++++++++-----------------------
arch/mips/include/asm/elfcore-compat.h | 29 +++++++++++++++++++
arch/mips/kernel/Makefile | 4 +--
arch/mips/kernel/binfmt_elfn32.c | 106 --------------------------------------------------------------------
arch/mips/kernel/binfmt_elfo32.c | 109 ----------------------------------------------------------------------
arch/mips/kernel/scall64-n64.S | 2 +-
arch/parisc/Kconfig | 1 -
arch/powerpc/Kconfig | 1 -
arch/powerpc/platforms/powernv/opal-core.c | 6 ++--
arch/s390/Kconfig | 1 -
arch/s390/kernel/crash_dump.c | 2 +-
arch/sparc/Kconfig | 1 -
arch/x86/Kconfig | 2 +-
arch/x86/include/asm/compat.h | 11 -------
arch/x86/include/asm/elf.h | 2 +-
arch/x86/include/asm/elfcore-compat.h | 31 ++++++++++++++++++++
fs/Kconfig.binfmt | 2 +-
fs/binfmt_elf.c | 19 ++++++-------
fs/binfmt_elf_fdpic.c | 22 ++++----------
fs/compat_binfmt_elf.c | 7 +----
include/linux/elfcore-compat.h | 15 ++++++++--
include/linux/elfcore.h | 7 ++++-
kernel/kexec_core.c | 2 +-
28 files changed, 128 insertions(+), 324 deletions(-)
create mode 100644 arch/mips/include/asm/elfcore-compat.h
delete mode 100644 arch/mips/kernel/binfmt_elfn32.c
delete mode 100644 arch/mips/kernel/binfmt_elfo32.c
create mode 100644 arch/x86/include/asm/elfcore-compat.h