x86: IA32 emulation cleanups
cover x86: IA32 emulation cleanups
This series cleans up some files in the 32-bit emulation code, by merging with the native 32-bit code, or in the case of the syscall audit, using the generic compat code that was recently added.
Brian Gerst (5):
x86: Remove compat_ni_syscall()
x86: Merge native and compat 32-bit syscall tables
x86: Remove sys32_vm86_warning
x86: Use generic compat audit code
x86: Clean up ia32/Makefile
arch/x86/Kconfig | 5 +-- arch/x86/ia32/Makefile | 6 +-- arch/x86/ia32/audit.c | 43 --------------------- arch/x86/ia32/nosyscall.c | 7 ---- arch/x86/ia32/sys_ia32.c | 14 ------- arch/x86/ia32/syscall_ia32.c | 25 ------------ arch/x86/include/asm/unistd32.h | 2 + arch/x86/kernel/Makefile | 3 +- arch/x86/kernel/audit_64.c | 82 ---------------------------------------- arch/x86/kernel/syscall_32.c | 16 ++++++-- arch/x86/syscalls/syscall_32.tbl | 4 +- 11 files changed, 19 insertions(+), 188 deletions(-) delete mode 100644 arch/x86/ia32/audit.c delete mode 100644 arch/x86/ia32/nosyscall.c delete mode 100644 arch/x86/ia32/syscall_ia32.c create mode 100644 arch/x86/include/asm/unistd32.h delete mode 100644 arch/x86/kernel/audit_64.c
Signature · 1 line
2.1.0
PATCH 1/5 x86: Remove compat_ni_syscall()
compat_ni_syscall() does the same thing as sys_ni_syscall().
--- arch/x86/ia32/Makefile | 2 +- arch/x86/ia32/nosyscall.c | 7 ------- arch/x86/ia32/syscall_ia32.c | 4 ++-- 3 files changed, 3 insertions(+), 10 deletions(-) delete mode 100644 arch/x86/ia32/nosyscall.c
arch/x86/ia32/Makefile +1 -1
@@ -3,7 +3,7 @@ # obj-$(CONFIG_IA32_EMULATION) := ia32entry.o sys_ia32.o ia32_signal.o -obj-$(CONFIG_IA32_EMULATION) += nosyscall.o syscall_ia32.o +obj-$(CONFIG_IA32_EMULATION) += syscall_ia32.o obj-$(CONFIG_IA32_AOUT) += ia32_aout.o
arch/x86/ia32/nosyscall.c deleted +0 -7
@@ -1,7 +0,0 @@ -#include <linux/kernel.h> -#include <linux/errno.h> - -long compat_ni_syscall (void ) -{ -return -ENOSYS ; -}
arch/x86/ia32/syscall_ia32.c +2 -2
@@ -13,13 +13,13 @@typedef void (*sys_call_ptr_t )(void ); -extern void compat_ni_syscall (void ); +extern asmlinkage void sys_ni_syscall(void);const sys_call_ptr_t ia32_sys_call_table[__NR_ia32_syscall_max+1 ] = {/* * Smells like a compiler bug -- it doesn't work * when the & below is removed. */ - [0 ... __NR_ia32_syscall_max] = &compat_ni_syscall, + [0 ... __NR_ia32_syscall_max] = &sys_ni_syscall, #include <asm/syscalls_32.h> };
Signature · 1 line
2.1.0
tip-bot for Brian Gerst
merge bot[tip:x86/asm] x86/compat: Remove compat_ni_syscall()
x86/compat: Remove compat_ni_syscall()
Commit-ID: 29a5ff97fa0d8045d262a772c3853e3ef1ed98d8 Gitweb: http://git.kernel.org/tip/29a5ff97fa0d8045d262a772c3853e3ef1ed98d8 Author: Brian Gerst <[email protected]> AuthorDate: Tue, 3 Mar 2015 22:31:32 -0500 Committer: Ingo Molnar <[email protected]> CommitDate: Wed, 4 Mar 2015 06:16:21 +0100
x86/compat: Remove compat_ni_syscall()
compat_ni_syscall() does the same thing as sys_ni_syscall().
--- arch/x86/ia32/Makefile | 2 +- arch/x86/ia32/nosyscall.c | 7 ------- arch/x86/ia32/syscall_ia32.c | 4 ++-- 3 files changed, 3 insertions(+), 10 deletions(-)
arch/x86/ia32/Makefile +1 -1
@@ -3,7 +3,7 @@ # obj-$(CONFIG_IA32_EMULATION) := ia32entry.o sys_ia32.o ia32_signal.o -obj-$(CONFIG_IA32_EMULATION) += nosyscall.o syscall_ia32.o +obj-$(CONFIG_IA32_EMULATION) += syscall_ia32.o obj-$(CONFIG_IA32_AOUT) += ia32_aout.o
arch/x86/ia32/nosyscall.c deleted +0 -7
@@ -1,7 +0,0 @@ -#include <linux/kernel.h> -#include <linux/errno.h> - -long compat_ni_syscall (void ) -{ -return -ENOSYS ; -}
arch/x86/ia32/syscall_ia32.c +2 -2
@@ -13,13 +13,13 @@typedef void (*sys_call_ptr_t )(void ); -extern void compat_ni_syscall (void ); +extern asmlinkage void sys_ni_syscall(void);const sys_call_ptr_t ia32_sys_call_table[__NR_ia32_syscall_max+1 ] = {/* * Smells like a compiler bug -- it doesn't work * when the & below is removed. */ - [0 ... __NR_ia32_syscall_max] = &compat_ni_syscall, + [0 ... __NR_ia32_syscall_max] = &sys_ni_syscall, #include <asm/syscalls_32.h> };
PATCH 2/5 x86: Merge native and compat 32-bit syscall tables
In reply to Brian GerstCombine the 32-bit syscall tables into one file.
--- arch/x86/ia32/Makefile | 1 - arch/x86/ia32/syscall_ia32.c | 25 ------------------------- arch/x86/kernel/Makefile | 1 + arch/x86/kernel/syscall_32.c | 16 ++++++++++++---- 4 files changed, 13 insertions(+), 30 deletions(-) delete mode 100644 arch/x86/ia32/syscall_ia32.c
arch/x86/ia32/Makefile +0 -1
@@ -3,7 +3,6 @@ # obj-$(CONFIG_IA32_EMULATION) := ia32entry.o sys_ia32.o ia32_signal.o -obj-$(CONFIG_IA32_EMULATION) += syscall_ia32.o obj-$(CONFIG_IA32_AOUT) += ia32_aout.o
arch/x86/ia32/syscall_ia32.c deleted +0 -25
@@ -1,25 +0,0 @@ -/* System call table for ia32 emulation. */ - -#include <linux/linkage.h> -#include <linux/sys.h> -#include <linux/cache.h> -#include <asm/asm-offsets.h> - -#define __SYSCALL_I386 (nr, sym, compat) extern asmlinkage void compat(void) ; -#include <asm/syscalls_32.h> -#undef __SYSCALL_I386 - -#define __SYSCALL_I386 (nr, sym, compat) [nr] = compat, - -typedef void (*sys_call_ptr_t )(void ); - -extern asmlinkage void sys_ni_syscall(void); - -const sys_call_ptr_t ia32_sys_call_table[__NR_ia32_syscall_max+1 ] = { -/* -* Smells like a compiler bug -- it doesn't work -* when the & below is removed. -*/ - [0 ... __NR_ia32_syscall_max] = &sys_ni_syscall, -#include <asm/syscalls_32.h> -};
arch/x86/kernel/Makefile +1 -0
@@ -32,6 +32,7 @@ obj-$(CONFIG_X86_32) += i386_ksyms_32.o obj-$(CONFIG_X86_64) += sys_x86_64.o x8664_ksyms_64.o obj-$(CONFIG_X86_64) += mcount_64.o obj-y += syscall_$(BITS).o vsyscall_gtod.o +obj-$(CONFIG_IA32_EMULATION) += syscall_32.o obj-$(CONFIG_X86_VSYSCALL_EMULATION) += vsyscall_64.o vsyscall_emu_64.o obj-$(CONFIG_X86_ESPFIX64) += espfix_64.o obj-$(CONFIG_SYSFS) += ksysfs.o
arch/x86/kernel/syscall_32.c +12 -4
@@ -5,21 +5,29 @@#include <linux/cache.h> #include <asm/asm-offsets.h> -#define __SYSCALL_I386 (nr, sym, compat) extern asmlinkage void sym(void) ; +#ifdef CONFIG_IA32_EMULATION +#define SYM (sym, compat) compat +#else +#define SYM (sym, compat) sym +#define ia32_sys_call_table sys_call_table +#define __NR_ia32_syscall_max __NR_syscall_max +#endif + +#define __SYSCALL_I386 (nr, sym, compat) extern asmlinkage void SYM(sym, compat)(void) ;#include <asm/syscalls_32.h> #undef __SYSCALL_I386 -#define __SYSCALL_I386 (nr, sym, compat) [nr] = sym, +#define __SYSCALL_I386 (nr, sym, compat) [nr] = SYM(sym, compat), typedef asmlinkage void (*sys_call_ptr_t)(void); extern asmlinkage void sys_ni_syscall(void); -__visible const sys_call_ptr_t sys_call_table[__NR_syscall_max+1] = { +__visible const sys_call_ptr_t ia32_sys_call_table[__NR_ia32_syscall_max+1] = {/* * Smells like a compiler bug -- it doesn't work * when the & below is removed. */ - [0 ... __NR_syscall_max] = &sys_ni_syscall, + [0 ... __NR_ia32_syscall_max] = &sys_ni_syscall, #include <asm/syscalls_32.h> };
Signature · 1 line
2.1.0
tip-bot for Brian Gerst
merge bot[tip:x86/asm] x86/compat: Merge native and compat 32-bit syscall tables
x86/compat: Merge native and compat 32-bit syscall tables
Commit-ID: 2aa4a710928863e84cb71e60b7c839d12403f5ca Gitweb: http://git.kernel.org/tip/2aa4a710928863e84cb71e60b7c839d12403f5ca Author: Brian Gerst <[email protected]> AuthorDate: Tue, 3 Mar 2015 22:31:33 -0500 Committer: Ingo Molnar <[email protected]> CommitDate: Wed, 4 Mar 2015 06:16:21 +0100
x86/compat: Merge native and compat 32-bit syscall tables
Combine the 32-bit syscall tables into one file.
--- arch/x86/ia32/Makefile | 1 - arch/x86/ia32/syscall_ia32.c | 25 ------------------------- arch/x86/kernel/Makefile | 1 + arch/x86/kernel/syscall_32.c | 16 ++++++++++++---- 4 files changed, 13 insertions(+), 30 deletions(-)
arch/x86/ia32/Makefile +0 -1
@@ -3,7 +3,6 @@ # obj-$(CONFIG_IA32_EMULATION) := ia32entry.o sys_ia32.o ia32_signal.o -obj-$(CONFIG_IA32_EMULATION) += syscall_ia32.o obj-$(CONFIG_IA32_AOUT) += ia32_aout.o
arch/x86/ia32/syscall_ia32.c deleted +0 -25
@@ -1,25 +0,0 @@ -/* System call table for ia32 emulation. */ - -#include <linux/linkage.h> -#include <linux/sys.h> -#include <linux/cache.h> -#include <asm/asm-offsets.h> - -#define __SYSCALL_I386 (nr, sym, compat) extern asmlinkage void compat(void) ; -#include <asm/syscalls_32.h> -#undef __SYSCALL_I386 - -#define __SYSCALL_I386 (nr, sym, compat) [nr] = compat, - -typedef void (*sys_call_ptr_t )(void ); - -extern asmlinkage void sys_ni_syscall(void); - -const sys_call_ptr_t ia32_sys_call_table[__NR_ia32_syscall_max+1 ] = { -/* -* Smells like a compiler bug -- it doesn't work -* when the & below is removed. -*/ - [0 ... __NR_ia32_syscall_max] = &sys_ni_syscall, -#include <asm/syscalls_32.h> -};
arch/x86/kernel/Makefile +1 -0
@@ -28,6 +28,7 @@ obj-$(CONFIG_X86_32) += i386_ksyms_32.o obj-$(CONFIG_X86_64) += sys_x86_64.o x8664_ksyms_64.o obj-$(CONFIG_X86_64) += mcount_64.o obj-y += syscall_$(BITS).o vsyscall_gtod.o +obj-$(CONFIG_IA32_EMULATION) += syscall_32.o obj-$(CONFIG_X86_VSYSCALL_EMULATION) += vsyscall_64.o vsyscall_emu_64.o obj-$(CONFIG_X86_ESPFIX64) += espfix_64.o obj-$(CONFIG_SYSFS) += ksysfs.o
arch/x86/kernel/syscall_32.c +12 -4
@@ -5,21 +5,29 @@#include <linux/cache.h> #include <asm/asm-offsets.h> -#define __SYSCALL_I386 (nr, sym, compat) extern asmlinkage void sym(void) ; +#ifdef CONFIG_IA32_EMULATION +#define SYM (sym, compat) compat +#else +#define SYM (sym, compat) sym +#define ia32_sys_call_table sys_call_table +#define __NR_ia32_syscall_max __NR_syscall_max +#endif + +#define __SYSCALL_I386 (nr, sym, compat) extern asmlinkage void SYM(sym, compat)(void) ;#include <asm/syscalls_32.h> #undef __SYSCALL_I386 -#define __SYSCALL_I386 (nr, sym, compat) [nr] = sym, +#define __SYSCALL_I386 (nr, sym, compat) [nr] = SYM(sym, compat), typedef asmlinkage void (*sys_call_ptr_t)(void); extern asmlinkage void sys_ni_syscall(void); -__visible const sys_call_ptr_t sys_call_table[__NR_syscall_max+1] = { +__visible const sys_call_ptr_t ia32_sys_call_table[__NR_ia32_syscall_max+1] = {/* * Smells like a compiler bug -- it doesn't work * when the & below is removed. */ - [0 ... __NR_syscall_max] = &sys_ni_syscall, + [0 ... __NR_ia32_syscall_max] = &sys_ni_syscall, #include <asm/syscalls_32.h> };
PATCH 3/5 x86: Remove sys32_vm86_warning
In reply to Brian GerstThe check against lastcomm is racy, and the message it produces isn't necessary. vm86 support can be disabled on a 32-bit kernel also, and doesn't have this message. Switch to sys_ni_syscall instead.
--- arch/x86/ia32/sys_ia32.c | 14 -------------- arch/x86/syscalls/syscall_32.tbl | 4 ++-- 2 files changed, 2 insertions(+), 16 deletions(-)
arch/x86/ia32/sys_ia32.c +0 -14
@@ -201,20 +201,6 @@ long sys32_fadvise64_64(int fd, __u32 offset_low, __u32 offset_high, advice); } -long sys32_vm86_warning (void ) -{ -struct task_struct *me = current; -static char lastcomm[sizeof (me->comm)]; - -if (strncmp (lastcomm, me->comm,sizeof (lastcomm))) { -compat_printk (KERN_INFO -"%s: vm86 mode not supported on 64 bit kernel\n" , - me->comm); -strncpy (lastcomm, me->comm,sizeof (lastcomm)); - } -return -ENOSYS ; -} - asmlinkage ssize_t sys32_readahead(int fd, unsigned off_lo, unsigned off_hi,size_t count) {
arch/x86/syscalls/syscall_32.tbl +2 -2
@@ -119,7 +119,7 @@ 110 i386 iopl sys_iopl 111 i386 vhangup sys_vhangup 112 i386 idle -113 i386 vm86old sys_vm86old sys32_vm86_warning +113 i386 vm86old sys_vm86old sys_ni_syscall 114 i386 wait4 sys_wait4 compat_sys_wait4 115 i386 swapoff sys_swapoff 116 i386 sysinfo sys_sysinfo compat_sys_sysinfo
@@ -172,7 +172,7 @@ 163 i386 mremap sys_mremap 164 i386 setresuid sys_setresuid16 165 i386 getresuid sys_getresuid16 -166 i386 vm86 sys_vm86 sys32_vm86_warning +166 i386 vm86 sys_vm86 sys_ni_syscall 167 i386 query_module 168 i386 poll sys_poll 169 i386 nfsservctl
Signature · 1 line
2.1.0
tip-bot for Brian Gerst
merge bot[tip:x86/asm] x86/compat: Remove sys32_vm86_warning
x86/compat: Remove sys32_vm86_warning
Commit-ID: 7e8e385aaf6ed5b64b5d9108081cfcdcdd021b78 Gitweb: http://git.kernel.org/tip/7e8e385aaf6ed5b64b5d9108081cfcdcdd021b78 Author: Brian Gerst <[email protected]> AuthorDate: Tue, 3 Mar 2015 22:31:34 -0500 Committer: Ingo Molnar <[email protected]> CommitDate: Wed, 4 Mar 2015 06:16:21 +0100
x86/compat: Remove sys32_vm86_warning
The check against lastcomm is racy, and the message it produces isn't necessary. vm86 support can be disabled on a 32-bit kernel also, and doesn't have this message. Switch to sys_ni_syscall instead.
--- arch/x86/ia32/sys_ia32.c | 14 -------------- arch/x86/syscalls/syscall_32.tbl | 4 ++-- 2 files changed, 2 insertions(+), 16 deletions(-)
arch/x86/ia32/sys_ia32.c +0 -14
@@ -201,20 +201,6 @@ long sys32_fadvise64_64(int fd, __u32 offset_low, __u32 offset_high, advice); } -long sys32_vm86_warning (void ) -{ -struct task_struct *me = current; -static char lastcomm[sizeof (me->comm)]; - -if (strncmp (lastcomm, me->comm,sizeof (lastcomm))) { -compat_printk (KERN_INFO -"%s: vm86 mode not supported on 64 bit kernel\n" , - me->comm); -strncpy (lastcomm, me->comm,sizeof (lastcomm)); - } -return -ENOSYS ; -} - asmlinkage ssize_t sys32_readahead(int fd, unsigned off_lo, unsigned off_hi,size_t count) {
arch/x86/syscalls/syscall_32.tbl +2 -2
@@ -119,7 +119,7 @@ 110 i386 iopl sys_iopl 111 i386 vhangup sys_vhangup 112 i386 idle -113 i386 vm86old sys_vm86old sys32_vm86_warning +113 i386 vm86old sys_vm86old sys_ni_syscall 114 i386 wait4 sys_wait4 compat_sys_wait4 115 i386 swapoff sys_swapoff 116 i386 sysinfo sys_sysinfo compat_sys_sysinfo
@@ -172,7 +172,7 @@ 163 i386 mremap sys_mremap 164 i386 setresuid sys_setresuid16 165 i386 getresuid sys_getresuid16 -166 i386 vm86 sys_vm86 sys32_vm86_warning +166 i386 vm86 sys_vm86 sys_ni_syscall 167 i386 query_module 168 i386 poll sys_poll 169 i386 nfsservctl
PATCH 4/5 x86: Use generic compat audit code
In reply to Brian GerstUse the generic compat syscall audit code instead of an x86 specific implementation.
--- arch/x86/Kconfig | 5 +-- arch/x86/ia32/Makefile | 3 -- arch/x86/ia32/audit.c | 43 --------------------- arch/x86/include/asm/unistd32.h | 2 + arch/x86/kernel/Makefile | 2 - arch/x86/kernel/audit_64.c | 82 ----------------------------------------- 6 files changed, 3 insertions(+), 134 deletions(-) delete mode 100644 arch/x86/ia32/audit.c create mode 100644 arch/x86/include/asm/unistd32.h delete mode 100644 arch/x86/kernel/audit_64.c
arch/x86/Kconfig +1 -4
@@ -135,6 +135,7 @@ config X86 select HAVE_CC_STACKPROTECTOR select GENERIC_CPU_AUTOPROBE select HAVE_ARCH_AUDITSYSCALL + select AUDIT_ARCH_COMPAT_GENERIC select ARCH_SUPPORTS_ATOMIC_RMW select HAVE_ACPI_APEI if ACPI select HAVE_ACPI_APEI_NMI if ACPI
@@ -238,10 +239,6 @@ config ZONE_DMA32 bool default X86_64 -config AUDIT_ARCH - bool - default X86_64 - config ARCH_SUPPORTS_OPTIMIZED_INLINING def_bool y
arch/x86/ia32/Makefile +0 -3
@@ -5,6 +5,3 @@ obj-$(CONFIG_IA32_EMULATION) := ia32entry.o sys_ia32.o ia32_signal.o obj-$(CONFIG_IA32_AOUT) += ia32_aout.o - -audit-class-$(CONFIG_AUDIT) := audit.o -obj-$(CONFIG_IA32_EMULATION) += $(audit-class-y)
arch/x86/ia32/audit.c deleted +0 -43
43 lines not on this page · raw message
arch/x86/include/asm/unistd32.h new file +2 -0
@@ -0,0 +1,2 @@ +/* Generic code expects this header to be named unistd32.h */ +#include <asm/unistd_32.h>
arch/x86/kernel/Makefile +0 -2
@@ -115,8 +115,6 @@ obj-$(CONFIG_PMC_ATOM) += pmc_atom.o ### # 64 bit specific files ifeq ($(CONFIG_X86_64),y) - obj-$(CONFIG_AUDIT) += audit_64.o - obj-$(CONFIG_GART_IOMMU) += amd_gart_64.o aperture_64.o obj-$(CONFIG_CALGARY_IOMMU) += pci-calgary_64.o tce_64.o
arch/x86/kernel/audit_64.c deleted +0 -82
82 lines not on this page · raw message
Signature · 1 line
2.1.0
Re: [PATCH 4/5] x86: Use generic compat audit code
Quoted 4 lines · Brian Gerst
Use the generic compat syscall audit code instead of an x86 specific implementation.
Signed-off-by Brian Gerst <[email protected]>
Quoted 11 lines
--- arch/x86/Kconfig | 5 +-- arch/x86/ia32/Makefile | 3 -- arch/x86/ia32/audit.c | 43 --------------------- arch/x86/include/asm/unistd32.h | 2 + arch/x86/kernel/Makefile | 2 - arch/x86/kernel/audit_64.c | 82 ----------------------------------------- 6 files changed, 3 insertions(+), 134 deletions(-) delete mode 100644 arch/x86/ia32/audit.c create mode 100644 arch/x86/include/asm/unistd32.h delete mode 100644 arch/x86/kernel/audit_64.c
Nice!
Because there are many types of conversions it would be nice if the changelog included a declaration of some sorts about what this means
precisely: 'the two implementations were 100% identical', or 'the x86 one was buggy and we now switch to the correct generic one', or 'the only difference between the two is X, Y and Z, which is not a problem'?
Thanks,
Ingo
Re: [PATCH 4/5] x86: Use generic compat audit code
Quoted 28 lines · Ingo Molnar
Quoted 4 lines · Brian Gerst
Use the generic compat syscall audit code instead of an x86 specific implementation.
Signed-off-by Brian Gerst <[email protected]>Quoted 11 lines
--- arch/x86/Kconfig | 5 +-- arch/x86/ia32/Makefile | 3 -- arch/x86/ia32/audit.c | 43 --------------------- arch/x86/include/asm/unistd32.h | 2 + arch/x86/kernel/Makefile | 2 - arch/x86/kernel/audit_64.c | 82 ----------------------------------------- 6 files changed, 3 insertions(+), 134 deletions(-) delete mode 100644 arch/x86/ia32/audit.c create mode 100644 arch/x86/include/asm/unistd32.h delete mode 100644 arch/x86/kernel/audit_64.cNice!
Because there are many types of conversions it would be nice if the changelog included a declaration of some sorts about what this means
precisely: 'the two implementations were 100% identical', or 'the x86 one was buggy and we now switch to the correct generic one', or 'the only difference between the two is X, Y and Z, which is not a problem'?
Quoted 3 lines
Thanks,
Ingo
The generic compat version was added along with the arm64 support. It is functionally equivalent to the x86-specific implementation. The main difference is using audit_is_compat() instead of a hardcoded check for AUDIT_ARCH_I386.
I just noticed a bug in lib/compat_audit.c though. It is missing __NR_execveat.
--
Brian Gerst
Re: [PATCH 4/5] x86: Use generic compat audit code
Quoted 33 lines · Brian Gerst
Quoted 28 lines · Ingo Molnar
Quoted 4 lines · Brian Gerst
Use the generic compat syscall audit code instead of an x86 specific implementation.
Signed-off-by Brian Gerst <[email protected]>Quoted 11 lines
--- arch/x86/Kconfig | 5 +-- arch/x86/ia32/Makefile | 3 -- arch/x86/ia32/audit.c | 43 --------------------- arch/x86/include/asm/unistd32.h | 2 + arch/x86/kernel/Makefile | 2 - arch/x86/kernel/audit_64.c | 82 ----------------------------------------- 6 files changed, 3 insertions(+), 134 deletions(-) delete mode 100644 arch/x86/ia32/audit.c create mode 100644 arch/x86/include/asm/unistd32.h delete mode 100644 arch/x86/kernel/audit_64.cNice!
Because there are many types of conversions it would be nice if the changelog included a declaration of some sorts about what this means
precisely: 'the two implementations were 100% identical', or 'the x86 one was buggy and we now switch to the correct generic one', or 'the only difference between the two is X, Y and Z, which is not a problem'?Quoted 3 lines
Thanks,
Ingo
Quoted 7 lines
The generic compat version was added along with the arm64 support. It is functionally equivalent to the x86-specific implementation. The main difference is using
audit_is_compat()instead of a hardcoded check forAUDIT_ARCH_I386.I just noticed a bug in
lib/compat_audit.cthough. It is missing__NR_execveat.
Another asymmetry is that lib/compat_audit.c covers __NR_socketcall, while arch/x86/kernel/audit.c does not.
But that's an improvement I think: for __NR_socketcall the old x86 code would not do the socketcall permission check for SYS_BIND, which is an audit record generation bug AFAICS.
Thanks,
Ingo
Re: [PATCH 4/5] x86: Use generic compat audit code
In reply to Brian GerstQuoted 32 lines · Brian Gerst
Quoted 30 lines · Ingo Molnar
Quoted 4 lines · Brian Gerst
Use the generic compat syscall audit code instead of an x86 specific implementation.
Signed-off-by Brian Gerst <[email protected]>Quoted 11 lines
--- arch/x86/Kconfig | 5 +-- arch/x86/ia32/Makefile | 3 -- arch/x86/ia32/audit.c | 43 --------------------- arch/x86/include/asm/unistd32.h | 2 + arch/x86/kernel/Makefile | 2 - arch/x86/kernel/audit_64.c | 82 ----------------------------------------- 6 files changed, 3 insertions(+), 134 deletions(-) delete mode 100644 arch/x86/ia32/audit.c create mode 100644 arch/x86/include/asm/unistd32.h delete mode 100644 arch/x86/kernel/audit_64.cNice!
Because there are many types of conversions it would be nice if the changelog included a declaration of some sorts about what this means
precisely: 'the two implementations were 100% identical', or 'the x86 one was buggy and we now switch to the correct generic one', or 'the only difference between the two is X, Y and Z, which is not a problem'?Thanks,
Quoted 8 lines
Quoted 1 line
Ingo
The generic compat version was added along with the arm64 support. It is functionally equivalent to the x86-specific implementation. The main difference is using
audit_is_compat()instead of a hardcoded check forAUDIT_ARCH_I386.I just noticed a bug in
lib/compat_audit.cthough. It is missing__NR_execveat.
Sorry I missed that. I'll send a patch (and cc: stable for 3.19).
Quoted 2 lines
--
Brian Gerst
PATCH 5/5 x86: Clean up ia32/Makefile
In reply to Brian GerstThe ia32/ subdirectory is only entered if CONFIG_IA32_EMULATION is set. There is no need to depend on it in ia32/Makefile.
--- arch/x86/ia32/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/ia32/Makefile +1 -1
@@ -2,6 +2,6 @@ # Makefile for the ia32 kernel emulation subsystem. # -obj-$(CONFIG_IA32_EMULATION) := ia32entry.o sys_ia32.o ia32_signal.o +obj-y := ia32entry.o sys_ia32.o ia32_signal.o obj-$(CONFIG_IA32_AOUT) += ia32_aout.o
Signature · 1 line
2.1.0
Quoted 10 lines · Brian Gerst
This series cleans up some files in the 32-bit emulation code, by merging with the native 32-bit code, or in the case of the syscall audit, using the generic compat code that was recently added.
Brian Gerst (5):
x86: Removecompat_ni_syscall()
x86: Merge native and compat 32-bit syscall tables
x86: Removesys32_vm86_warning
x86: Use generic compat audit code
x86: Clean up ia32/Makefile
So this series is looking pretty good to me, I've picked up #1-#3, pending clarification on #4. I've stuck them into tip:x86/asm, because they might interact with ongoing system call entry work.
While we are at it: CONFIG_IA32_EMULATION is a misnomer: there's nothing 'emulated' there, it's full software and hardware support for the 32-bit ABI. It's just an ugly (and somewhat confusing) replacement for CONFIG_COMPAT that most other architectures are using.
So could we also get rid of CONFIG_IA32_EMULATION and change most of its uses over to CONFIG_COMPAT et al? The only complication with that might be that IA32_EMULATION kconfig switch hardcodes a few features currently:
select BINFMT_ELF
select COMPAT_BINFMT_ELF
select HAVE_UID16
allowing the binfmt formats to be undefined should be OK; the uid16 dependency needs to be checked, whether it's safe to allow it to be disabled.
Thanks,
Ingo
Quoted 32 lines · Ingo Molnar
Quoted 10 lines · Brian Gerst
This series cleans up some files in the 32-bit emulation code, by merging with the native 32-bit code, or in the case of the syscall audit, using the generic compat code that was recently added.
Brian Gerst (5):
x86: Removecompat_ni_syscall()
x86: Merge native and compat 32-bit syscall tables
x86: Removesys32_vm86_warning
x86: Use generic compat audit code
x86: Clean up ia32/MakefileSo this series is looking pretty good to me, I've picked up #1-#3, pending clarification on #4. I've stuck them into tip:x86/asm, because they might interact with ongoing system call entry work.
While we are at it:
CONFIG_IA32_EMULATIONis a misnomer: there's nothing 'emulated' there, it's full software and hardware support for the 32-bit ABI. It's just an ugly (and somewhat confusing) replacement forCONFIG_COMPATthat most other architectures are using.So could we also get rid of
CONFIG_IA32_EMULATIONand change most of its uses over toCONFIG_COMPATet al? The only complication with that might be thatIA32_EMULATIONkconfig switch hardcodes a few features currently:select
BINFMT_ELF
selectCOMPAT_BINFMT_ELF
selectHAVE_UID16
Quoted 7 lines
allowing the binfmt formats to be undefined should be OK; the uid16 dependency needs to be checked, whether it's safe to allow it to be disabled.
Thanks,
Ingo
It looks like most cases can simply be replaced. There are some subtle relations with the x32 ABI though, and that will take some time to sort out.
--
Brian Gerst
H. Peter Anvin
reviewerQuoted 5 lines · Brian Gerst
It looks like most cases can simply be replaced. There are some subtle relations with the x32 ABI though, and that will take some time to sort out.
Yes, some aspects of CONFIG_COMPAT is used also by x32.
Overall the current Linux kernel handles the case of *more* than two ABIs extremely poorly. It is not the only case of more than two ABIs, either; consider ARM for example.
-hpa