All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/5] x86: IA32 emulation cleanups
@ 2015-03-04  3:31 Brian Gerst
  2015-03-04  3:31 ` [PATCH 1/5] x86: Remove compat_ni_syscall() Brian Gerst
                   ` (5 more replies)
  0 siblings, 6 replies; 16+ messages in thread
From: Brian Gerst @ 2015-03-04  3:31 UTC (permalink / raw)
  To: x86; +Cc: linux-kernel, mingo, hpa

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

-- 
2.1.0


^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH 1/5] x86: Remove compat_ni_syscall()
  2015-03-04  3:31 [PATCH 0/5] x86: IA32 emulation cleanups Brian Gerst
@ 2015-03-04  3:31 ` Brian Gerst
  2015-03-04  5:27   ` [tip:x86/asm] x86/compat: " tip-bot for Brian Gerst
  2015-03-04  3:31 ` [PATCH 2/5] x86: Merge native and compat 32-bit syscall tables Brian Gerst
                   ` (4 subsequent siblings)
  5 siblings, 1 reply; 16+ messages in thread
From: Brian Gerst @ 2015-03-04  3:31 UTC (permalink / raw)
  To: x86; +Cc: linux-kernel, mingo, hpa

compat_ni_syscall() does the same thing as sys_ni_syscall().

Signed-off-by: Brian Gerst <brgerst@gmail.com>
---
 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

diff --git a/arch/x86/ia32/Makefile b/arch/x86/ia32/Makefile
index e785b42..e66d850 100644
--- a/arch/x86/ia32/Makefile
+++ b/arch/x86/ia32/Makefile
@@ -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
 
diff --git a/arch/x86/ia32/nosyscall.c b/arch/x86/ia32/nosyscall.c
deleted file mode 100644
index 51ecd5b..0000000
--- a/arch/x86/ia32/nosyscall.c
+++ /dev/null
@@ -1,7 +0,0 @@
-#include <linux/kernel.h>
-#include <linux/errno.h>
-
-long compat_ni_syscall(void)
-{
-	return -ENOSYS;
-}
diff --git a/arch/x86/ia32/syscall_ia32.c b/arch/x86/ia32/syscall_ia32.c
index 4754ba0..3429b14 100644
--- a/arch/x86/ia32/syscall_ia32.c
+++ b/arch/x86/ia32/syscall_ia32.c
@@ -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>
 };
-- 
2.1.0


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 2/5] x86: Merge native and compat 32-bit syscall tables
  2015-03-04  3:31 [PATCH 0/5] x86: IA32 emulation cleanups Brian Gerst
  2015-03-04  3:31 ` [PATCH 1/5] x86: Remove compat_ni_syscall() Brian Gerst
@ 2015-03-04  3:31 ` Brian Gerst
  2015-03-04  5:27   ` [tip:x86/asm] x86/compat: " tip-bot for Brian Gerst
  2015-03-04  3:31 ` [PATCH 3/5] x86: Remove sys32_vm86_warning Brian Gerst
                   ` (3 subsequent siblings)
  5 siblings, 1 reply; 16+ messages in thread
From: Brian Gerst @ 2015-03-04  3:31 UTC (permalink / raw)
  To: x86; +Cc: linux-kernel, mingo, hpa

Combine the 32-bit syscall tables into one file.

Signed-off-by: Brian Gerst <brgerst@gmail.com>
---
 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

diff --git a/arch/x86/ia32/Makefile b/arch/x86/ia32/Makefile
index e66d850..bb635c6 100644
--- a/arch/x86/ia32/Makefile
+++ b/arch/x86/ia32/Makefile
@@ -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
 
diff --git a/arch/x86/ia32/syscall_ia32.c b/arch/x86/ia32/syscall_ia32.c
deleted file mode 100644
index 3429b14..0000000
--- a/arch/x86/ia32/syscall_ia32.c
+++ /dev/null
@@ -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>
-};
diff --git a/arch/x86/kernel/Makefile b/arch/x86/kernel/Makefile
index cdb1b70..c887cd9 100644
--- a/arch/x86/kernel/Makefile
+++ b/arch/x86/kernel/Makefile
@@ -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
diff --git a/arch/x86/kernel/syscall_32.c b/arch/x86/kernel/syscall_32.c
index e9bcd57..3777189 100644
--- a/arch/x86/kernel/syscall_32.c
+++ b/arch/x86/kernel/syscall_32.c
@@ -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>
 };
-- 
2.1.0


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 3/5] x86: Remove sys32_vm86_warning
  2015-03-04  3:31 [PATCH 0/5] x86: IA32 emulation cleanups Brian Gerst
  2015-03-04  3:31 ` [PATCH 1/5] x86: Remove compat_ni_syscall() Brian Gerst
  2015-03-04  3:31 ` [PATCH 2/5] x86: Merge native and compat 32-bit syscall tables Brian Gerst
@ 2015-03-04  3:31 ` Brian Gerst
  2015-03-04  5:28   ` [tip:x86/asm] x86/compat: " tip-bot for Brian Gerst
  2015-03-04  3:31 ` [PATCH 4/5] x86: Use generic compat audit code Brian Gerst
                   ` (2 subsequent siblings)
  5 siblings, 1 reply; 16+ messages in thread
From: Brian Gerst @ 2015-03-04  3:31 UTC (permalink / raw)
  To: x86; +Cc: linux-kernel, mingo, hpa

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.

Signed-off-by: Brian Gerst <brgerst@gmail.com>
---
 arch/x86/ia32/sys_ia32.c         | 14 --------------
 arch/x86/syscalls/syscall_32.tbl |  4 ++--
 2 files changed, 2 insertions(+), 16 deletions(-)

diff --git a/arch/x86/ia32/sys_ia32.c b/arch/x86/ia32/sys_ia32.c
index 8e0ceec..719cd70 100644
--- a/arch/x86/ia32/sys_ia32.c
+++ b/arch/x86/ia32/sys_ia32.c
@@ -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)
 {
diff --git a/arch/x86/syscalls/syscall_32.tbl b/arch/x86/syscalls/syscall_32.tbl
index b3560ec..ef8187f 100644
--- a/arch/x86/syscalls/syscall_32.tbl
+++ b/arch/x86/syscalls/syscall_32.tbl
@@ -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
-- 
2.1.0


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 4/5] x86: Use generic compat audit code
  2015-03-04  3:31 [PATCH 0/5] x86: IA32 emulation cleanups Brian Gerst
                   ` (2 preceding siblings ...)
  2015-03-04  3:31 ` [PATCH 3/5] x86: Remove sys32_vm86_warning Brian Gerst
@ 2015-03-04  3:31 ` Brian Gerst
  2015-03-04  5:14   ` Ingo Molnar
  2015-03-04  3:31 ` [PATCH 5/5] x86: Clean up ia32/Makefile Brian Gerst
  2015-03-04  5:24 ` [PATCH 0/5] x86: IA32 emulation cleanups Ingo Molnar
  5 siblings, 1 reply; 16+ messages in thread
From: Brian Gerst @ 2015-03-04  3:31 UTC (permalink / raw)
  To: x86; +Cc: linux-kernel, mingo, hpa

Use the generic compat syscall audit code instead of an x86 specific
implementation.

Signed-off-by: Brian Gerst <brgerst@gmail.com>
---
 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

diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index c2fb8a8..ce75862 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -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
 
diff --git a/arch/x86/ia32/Makefile b/arch/x86/ia32/Makefile
index bb635c6..88ac1dd 100644
--- a/arch/x86/ia32/Makefile
+++ b/arch/x86/ia32/Makefile
@@ -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)
diff --git a/arch/x86/ia32/audit.c b/arch/x86/ia32/audit.c
deleted file mode 100644
index 2eccc89..0000000
--- a/arch/x86/ia32/audit.c
+++ /dev/null
@@ -1,43 +0,0 @@
-#include <asm/unistd_32.h>
-
-unsigned ia32_dir_class[] = {
-#include <asm-generic/audit_dir_write.h>
-~0U
-};
-
-unsigned ia32_chattr_class[] = {
-#include <asm-generic/audit_change_attr.h>
-~0U
-};
-
-unsigned ia32_write_class[] = {
-#include <asm-generic/audit_write.h>
-~0U
-};
-
-unsigned ia32_read_class[] = {
-#include <asm-generic/audit_read.h>
-~0U
-};
-
-unsigned ia32_signal_class[] = {
-#include <asm-generic/audit_signal.h>
-~0U
-};
-
-int ia32_classify_syscall(unsigned syscall)
-{
-	switch (syscall) {
-	case __NR_open:
-		return 2;
-	case __NR_openat:
-		return 3;
-	case __NR_socketcall:
-		return 4;
-	case __NR_execve:
-	case __NR_execveat:
-		return 5;
-	default:
-		return 1;
-	}
-}
diff --git a/arch/x86/include/asm/unistd32.h b/arch/x86/include/asm/unistd32.h
new file mode 100644
index 0000000..3653918
--- /dev/null
+++ b/arch/x86/include/asm/unistd32.h
@@ -0,0 +1,2 @@
+/* Generic code expects this header to be named unistd32.h */
+#include <asm/unistd_32.h>
diff --git a/arch/x86/kernel/Makefile b/arch/x86/kernel/Makefile
index c887cd9..280eb3b 100644
--- a/arch/x86/kernel/Makefile
+++ b/arch/x86/kernel/Makefile
@@ -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
 
diff --git a/arch/x86/kernel/audit_64.c b/arch/x86/kernel/audit_64.c
deleted file mode 100644
index f367250..0000000
--- a/arch/x86/kernel/audit_64.c
+++ /dev/null
@@ -1,82 +0,0 @@
-#include <linux/init.h>
-#include <linux/types.h>
-#include <linux/audit.h>
-#include <asm/unistd.h>
-
-static unsigned dir_class[] = {
-#include <asm-generic/audit_dir_write.h>
-~0U
-};
-
-static unsigned read_class[] = {
-#include <asm-generic/audit_read.h>
-~0U
-};
-
-static unsigned write_class[] = {
-#include <asm-generic/audit_write.h>
-~0U
-};
-
-static unsigned chattr_class[] = {
-#include <asm-generic/audit_change_attr.h>
-~0U
-};
-
-static unsigned signal_class[] = {
-#include <asm-generic/audit_signal.h>
-~0U
-};
-
-int audit_classify_arch(int arch)
-{
-#ifdef CONFIG_IA32_EMULATION
-	if (arch == AUDIT_ARCH_I386)
-		return 1;
-#endif
-	return 0;
-}
-
-int audit_classify_syscall(int abi, unsigned syscall)
-{
-#ifdef CONFIG_IA32_EMULATION
-	extern int ia32_classify_syscall(unsigned);
-	if (abi == AUDIT_ARCH_I386)
-		return ia32_classify_syscall(syscall);
-#endif
-	switch(syscall) {
-	case __NR_open:
-		return 2;
-	case __NR_openat:
-		return 3;
-	case __NR_execve:
-	case __NR_execveat:
-		return 5;
-	default:
-		return 0;
-	}
-}
-
-static int __init audit_classes_init(void)
-{
-#ifdef CONFIG_IA32_EMULATION
-	extern __u32 ia32_dir_class[];
-	extern __u32 ia32_write_class[];
-	extern __u32 ia32_read_class[];
-	extern __u32 ia32_chattr_class[];
-	extern __u32 ia32_signal_class[];
-	audit_register_class(AUDIT_CLASS_WRITE_32, ia32_write_class);
-	audit_register_class(AUDIT_CLASS_READ_32, ia32_read_class);
-	audit_register_class(AUDIT_CLASS_DIR_WRITE_32, ia32_dir_class);
-	audit_register_class(AUDIT_CLASS_CHATTR_32, ia32_chattr_class);
-	audit_register_class(AUDIT_CLASS_SIGNAL_32, ia32_signal_class);
-#endif
-	audit_register_class(AUDIT_CLASS_WRITE, write_class);
-	audit_register_class(AUDIT_CLASS_READ, read_class);
-	audit_register_class(AUDIT_CLASS_DIR_WRITE, dir_class);
-	audit_register_class(AUDIT_CLASS_CHATTR, chattr_class);
-	audit_register_class(AUDIT_CLASS_SIGNAL, signal_class);
-	return 0;
-}
-
-__initcall(audit_classes_init);
-- 
2.1.0


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 5/5] x86: Clean up ia32/Makefile
  2015-03-04  3:31 [PATCH 0/5] x86: IA32 emulation cleanups Brian Gerst
                   ` (3 preceding siblings ...)
  2015-03-04  3:31 ` [PATCH 4/5] x86: Use generic compat audit code Brian Gerst
@ 2015-03-04  3:31 ` Brian Gerst
  2015-03-04  5:24 ` [PATCH 0/5] x86: IA32 emulation cleanups Ingo Molnar
  5 siblings, 0 replies; 16+ messages in thread
From: Brian Gerst @ 2015-03-04  3:31 UTC (permalink / raw)
  To: x86; +Cc: linux-kernel, mingo, hpa

The ia32/ subdirectory is only entered if CONFIG_IA32_EMULATION is
set.  There is no need to depend on it in ia32/Makefile.

Signed-off-by: Brian Gerst <brgerst@gmail.com>
---
 arch/x86/ia32/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/ia32/Makefile b/arch/x86/ia32/Makefile
index 88ac1dd..eef2a8d 100644
--- a/arch/x86/ia32/Makefile
+++ b/arch/x86/ia32/Makefile
@@ -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
-- 
2.1.0


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* Re: [PATCH 4/5] x86: Use generic compat audit code
  2015-03-04  3:31 ` [PATCH 4/5] x86: Use generic compat audit code Brian Gerst
@ 2015-03-04  5:14   ` Ingo Molnar
  2015-03-04  6:39     ` Brian Gerst
  0 siblings, 1 reply; 16+ messages in thread
From: Ingo Molnar @ 2015-03-04  5:14 UTC (permalink / raw)
  To: Brian Gerst; +Cc: x86, linux-kernel, hpa


* Brian Gerst <brgerst@gmail.com> wrote:

> Use the generic compat syscall audit code instead of an x86 specific
> implementation.
> 
> Signed-off-by: Brian Gerst <brgerst@gmail.com>
> ---
>  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

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 0/5] x86: IA32 emulation cleanups
  2015-03-04  3:31 [PATCH 0/5] x86: IA32 emulation cleanups Brian Gerst
                   ` (4 preceding siblings ...)
  2015-03-04  3:31 ` [PATCH 5/5] x86: Clean up ia32/Makefile Brian Gerst
@ 2015-03-04  5:24 ` Ingo Molnar
  2015-03-04  6:22   ` Brian Gerst
  5 siblings, 1 reply; 16+ messages in thread
From: Ingo Molnar @ 2015-03-04  5:24 UTC (permalink / raw)
  To: Brian Gerst; +Cc: x86, linux-kernel, hpa, Borislav Petkov, Linus Torvalds


* Brian Gerst <brgerst@gmail.com> wrote:

> 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

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

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [tip:x86/asm] x86/compat: Remove compat_ni_syscall()
  2015-03-04  3:31 ` [PATCH 1/5] x86: Remove compat_ni_syscall() Brian Gerst
@ 2015-03-04  5:27   ` tip-bot for Brian Gerst
  0 siblings, 0 replies; 16+ messages in thread
From: tip-bot for Brian Gerst @ 2015-03-04  5:27 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, tglx, bp, torvalds, mingo, hpa, brgerst

Commit-ID:  29a5ff97fa0d8045d262a772c3853e3ef1ed98d8
Gitweb:     http://git.kernel.org/tip/29a5ff97fa0d8045d262a772c3853e3ef1ed98d8
Author:     Brian Gerst <brgerst@gmail.com>
AuthorDate: Tue, 3 Mar 2015 22:31:32 -0500
Committer:  Ingo Molnar <mingo@kernel.org>
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().

Signed-off-by: Brian Gerst <brgerst@gmail.com>
Cc: Borislav Petkov <bp@alien8.de>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: http://lkml.kernel.org/r/1425439896-8322-2-git-send-email-brgerst@gmail.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
 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(-)

diff --git a/arch/x86/ia32/Makefile b/arch/x86/ia32/Makefile
index e785b42..e66d850 100644
--- a/arch/x86/ia32/Makefile
+++ b/arch/x86/ia32/Makefile
@@ -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
 
diff --git a/arch/x86/ia32/nosyscall.c b/arch/x86/ia32/nosyscall.c
deleted file mode 100644
index 51ecd5b..0000000
--- a/arch/x86/ia32/nosyscall.c
+++ /dev/null
@@ -1,7 +0,0 @@
-#include <linux/kernel.h>
-#include <linux/errno.h>
-
-long compat_ni_syscall(void)
-{
-	return -ENOSYS;
-}
diff --git a/arch/x86/ia32/syscall_ia32.c b/arch/x86/ia32/syscall_ia32.c
index 4754ba0..3429b14 100644
--- a/arch/x86/ia32/syscall_ia32.c
+++ b/arch/x86/ia32/syscall_ia32.c
@@ -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>
 };

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [tip:x86/asm] x86/compat: Merge native and compat 32-bit syscall tables
  2015-03-04  3:31 ` [PATCH 2/5] x86: Merge native and compat 32-bit syscall tables Brian Gerst
@ 2015-03-04  5:27   ` tip-bot for Brian Gerst
  0 siblings, 0 replies; 16+ messages in thread
From: tip-bot for Brian Gerst @ 2015-03-04  5:27 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: torvalds, tglx, brgerst, hpa, mingo, bp, linux-kernel

Commit-ID:  2aa4a710928863e84cb71e60b7c839d12403f5ca
Gitweb:     http://git.kernel.org/tip/2aa4a710928863e84cb71e60b7c839d12403f5ca
Author:     Brian Gerst <brgerst@gmail.com>
AuthorDate: Tue, 3 Mar 2015 22:31:33 -0500
Committer:  Ingo Molnar <mingo@kernel.org>
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.

Signed-off-by: Brian Gerst <brgerst@gmail.com>
Cc: Borislav Petkov <bp@alien8.de>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: http://lkml.kernel.org/r/1425439896-8322-3-git-send-email-brgerst@gmail.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
 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(-)

diff --git a/arch/x86/ia32/Makefile b/arch/x86/ia32/Makefile
index e66d850..bb635c6 100644
--- a/arch/x86/ia32/Makefile
+++ b/arch/x86/ia32/Makefile
@@ -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
 
diff --git a/arch/x86/ia32/syscall_ia32.c b/arch/x86/ia32/syscall_ia32.c
deleted file mode 100644
index 3429b14..0000000
--- a/arch/x86/ia32/syscall_ia32.c
+++ /dev/null
@@ -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>
-};
diff --git a/arch/x86/kernel/Makefile b/arch/x86/kernel/Makefile
index 5d4502c..62fbe71 100644
--- a/arch/x86/kernel/Makefile
+++ b/arch/x86/kernel/Makefile
@@ -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
diff --git a/arch/x86/kernel/syscall_32.c b/arch/x86/kernel/syscall_32.c
index e9bcd57..3777189 100644
--- a/arch/x86/kernel/syscall_32.c
+++ b/arch/x86/kernel/syscall_32.c
@@ -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>
 };

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [tip:x86/asm] x86/compat: Remove sys32_vm86_warning
  2015-03-04  3:31 ` [PATCH 3/5] x86: Remove sys32_vm86_warning Brian Gerst
@ 2015-03-04  5:28   ` tip-bot for Brian Gerst
  0 siblings, 0 replies; 16+ messages in thread
From: tip-bot for Brian Gerst @ 2015-03-04  5:28 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, torvalds, brgerst, hpa, bp, tglx, mingo

Commit-ID:  7e8e385aaf6ed5b64b5d9108081cfcdcdd021b78
Gitweb:     http://git.kernel.org/tip/7e8e385aaf6ed5b64b5d9108081cfcdcdd021b78
Author:     Brian Gerst <brgerst@gmail.com>
AuthorDate: Tue, 3 Mar 2015 22:31:34 -0500
Committer:  Ingo Molnar <mingo@kernel.org>
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.

Signed-off-by: Brian Gerst <brgerst@gmail.com>
Cc: Borislav Petkov <bp@alien8.de>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: http://lkml.kernel.org/r/1425439896-8322-4-git-send-email-brgerst@gmail.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
 arch/x86/ia32/sys_ia32.c         | 14 --------------
 arch/x86/syscalls/syscall_32.tbl |  4 ++--
 2 files changed, 2 insertions(+), 16 deletions(-)

diff --git a/arch/x86/ia32/sys_ia32.c b/arch/x86/ia32/sys_ia32.c
index 8e0ceec..719cd70 100644
--- a/arch/x86/ia32/sys_ia32.c
+++ b/arch/x86/ia32/sys_ia32.c
@@ -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)
 {
diff --git a/arch/x86/syscalls/syscall_32.tbl b/arch/x86/syscalls/syscall_32.tbl
index b3560ec..ef8187f 100644
--- a/arch/x86/syscalls/syscall_32.tbl
+++ b/arch/x86/syscalls/syscall_32.tbl
@@ -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

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* Re: [PATCH 0/5] x86: IA32 emulation cleanups
  2015-03-04  5:24 ` [PATCH 0/5] x86: IA32 emulation cleanups Ingo Molnar
@ 2015-03-04  6:22   ` Brian Gerst
  2015-03-05 22:38     ` H. Peter Anvin
  0 siblings, 1 reply; 16+ messages in thread
From: Brian Gerst @ 2015-03-04  6:22 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: the arch/x86 maintainers, Linux Kernel Mailing List,
	H. Peter Anvin, Borislav Petkov, Linus Torvalds

On Wed, Mar 4, 2015 at 12:24 AM, Ingo Molnar <mingo@kernel.org> wrote:
>
> * Brian Gerst <brgerst@gmail.com> wrote:
>
>> 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
>
> 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

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

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 4/5] x86: Use generic compat audit code
  2015-03-04  5:14   ` Ingo Molnar
@ 2015-03-04  6:39     ` Brian Gerst
  2015-03-04  7:09       ` Ingo Molnar
  2015-03-04 14:52       ` David Drysdale
  0 siblings, 2 replies; 16+ messages in thread
From: Brian Gerst @ 2015-03-04  6:39 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: the arch/x86 maintainers, Linux Kernel Mailing List,
	H. Peter Anvin, drysdale

On Wed, Mar 4, 2015 at 12:14 AM, Ingo Molnar <mingo@kernel.org> wrote:
>
> * Brian Gerst <brgerst@gmail.com> wrote:
>
>> Use the generic compat syscall audit code instead of an x86 specific
>> implementation.
>>
>> Signed-off-by: Brian Gerst <brgerst@gmail.com>
>> ---
>>  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

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

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 4/5] x86: Use generic compat audit code
  2015-03-04  6:39     ` Brian Gerst
@ 2015-03-04  7:09       ` Ingo Molnar
  2015-03-04 14:52       ` David Drysdale
  1 sibling, 0 replies; 16+ messages in thread
From: Ingo Molnar @ 2015-03-04  7:09 UTC (permalink / raw)
  To: Brian Gerst
  Cc: the arch/x86 maintainers, Linux Kernel Mailing List,
	H. Peter Anvin, drysdale


* Brian Gerst <brgerst@gmail.com> wrote:

> On Wed, Mar 4, 2015 at 12:14 AM, Ingo Molnar <mingo@kernel.org> wrote:
> >
> > * Brian Gerst <brgerst@gmail.com> wrote:
> >
> >> Use the generic compat syscall audit code instead of an x86 specific
> >> implementation.
> >>
> >> Signed-off-by: Brian Gerst <brgerst@gmail.com>
> >> ---
> >>  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
> 
> 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.

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

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 4/5] x86: Use generic compat audit code
  2015-03-04  6:39     ` Brian Gerst
  2015-03-04  7:09       ` Ingo Molnar
@ 2015-03-04 14:52       ` David Drysdale
  1 sibling, 0 replies; 16+ messages in thread
From: David Drysdale @ 2015-03-04 14:52 UTC (permalink / raw)
  To: Brian Gerst
  Cc: Ingo Molnar, the arch/x86 maintainers, Linux Kernel Mailing List,
	H. Peter Anvin

On Wed, Mar 4, 2015 at 6:39 AM, Brian Gerst <brgerst@gmail.com> wrote:
>
> On Wed, Mar 4, 2015 at 12:14 AM, Ingo Molnar <mingo@kernel.org> wrote:
> >
> > * Brian Gerst <brgerst@gmail.com> wrote:
> >
> >> Use the generic compat syscall audit code instead of an x86 specific
> >> implementation.
> >>
> >> Signed-off-by: Brian Gerst <brgerst@gmail.com>
> >> ---
> >>  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
>
> 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.

Sorry I missed that.  I'll send a patch (and cc: stable for 3.19).

> --
> Brian Gerst

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 0/5] x86: IA32 emulation cleanups
  2015-03-04  6:22   ` Brian Gerst
@ 2015-03-05 22:38     ` H. Peter Anvin
  0 siblings, 0 replies; 16+ messages in thread
From: H. Peter Anvin @ 2015-03-05 22:38 UTC (permalink / raw)
  To: Brian Gerst, Ingo Molnar
  Cc: the arch/x86 maintainers, Linux Kernel Mailing List,
	Borislav Petkov, Linus Torvalds

On 03/03/2015 10:22 PM, Brian Gerst wrote:
> 
> 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



^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2015-03-05 22:38 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-04  3:31 [PATCH 0/5] x86: IA32 emulation cleanups Brian Gerst
2015-03-04  3:31 ` [PATCH 1/5] x86: Remove compat_ni_syscall() Brian Gerst
2015-03-04  5:27   ` [tip:x86/asm] x86/compat: " tip-bot for Brian Gerst
2015-03-04  3:31 ` [PATCH 2/5] x86: Merge native and compat 32-bit syscall tables Brian Gerst
2015-03-04  5:27   ` [tip:x86/asm] x86/compat: " tip-bot for Brian Gerst
2015-03-04  3:31 ` [PATCH 3/5] x86: Remove sys32_vm86_warning Brian Gerst
2015-03-04  5:28   ` [tip:x86/asm] x86/compat: " tip-bot for Brian Gerst
2015-03-04  3:31 ` [PATCH 4/5] x86: Use generic compat audit code Brian Gerst
2015-03-04  5:14   ` Ingo Molnar
2015-03-04  6:39     ` Brian Gerst
2015-03-04  7:09       ` Ingo Molnar
2015-03-04 14:52       ` David Drysdale
2015-03-04  3:31 ` [PATCH 5/5] x86: Clean up ia32/Makefile Brian Gerst
2015-03-04  5:24 ` [PATCH 0/5] x86: IA32 emulation cleanups Ingo Molnar
2015-03-04  6:22   ` Brian Gerst
2015-03-05 22:38     ` H. Peter Anvin

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.