lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Mon, 20 Mar 2017 09:33:50 -0700
From:   tip-bot for Kyle Huey <tipbot@...or.com>
To:     linux-tip-commits@...r.kernel.org
Cc:     shuah@...nel.org, me@...ehuey.com, robert@...llahan.org,
        khuey@...ehuey.com, dsafonov@...tuozzo.com,
        grzegorz.andrejczuk@...el.com, nadav.amit@...il.com,
        dmatlack@...gle.com, bp@...e.de, boris.ostrovsky@...cle.com,
        richard@....at, pbonzini@...hat.com, luto@...nel.org,
        jdike@...toit.com, peterz@...radead.org, andi@...stfloor.org,
        linux-kernel@...r.kernel.org, tglx@...utronix.de,
        viro@...iv.linux.org.uk, rafael.j.wysocki@...el.com,
        len.brown@...el.com, rkrcmar@...hat.com, hpa@...or.com,
        mingo@...nel.org, dave.hansen@...ux.intel.com
Subject: [tip:x86/process] x86/syscalls/32: Wire up arch_prctl on x86-32

Commit-ID:  79170fda313ed5be2394f87aa2a00d597f8ed4a1
Gitweb:     http://git.kernel.org/tip/79170fda313ed5be2394f87aa2a00d597f8ed4a1
Author:     Kyle Huey <me@...ehuey.com>
AuthorDate: Mon, 20 Mar 2017 01:16:24 -0700
Committer:  Thomas Gleixner <tglx@...utronix.de>
CommitDate: Mon, 20 Mar 2017 16:10:33 +0100

x86/syscalls/32: Wire up arch_prctl on x86-32

Hook up arch_prctl to call do_arch_prctl() on x86-32, and in 32 bit compat
mode on x86-64. This allows to have arch_prctls that are not specific to 64
bits.

On UML, simply stub out this syscall.

Signed-off-by: Kyle Huey <khuey@...ehuey.com>
Cc: Grzegorz Andrejczuk <grzegorz.andrejczuk@...el.com>
Cc: kvm@...r.kernel.org
Cc: Radim Krčmář <rkrcmar@...hat.com>
Cc: Peter Zijlstra <peterz@...radead.org>
Cc: Dave Hansen <dave.hansen@...ux.intel.com>
Cc: Andi Kleen <andi@...stfloor.org>
Cc: linux-kselftest@...r.kernel.org
Cc: Nadav Amit <nadav.amit@...il.com>
Cc: Robert O'Callahan <robert@...llahan.org>
Cc: Richard Weinberger <richard@....at>
Cc: "Rafael J. Wysocki" <rafael.j.wysocki@...el.com>
Cc: Borislav Petkov <bp@...e.de>
Cc: Andy Lutomirski <luto@...nel.org>
Cc: Len Brown <len.brown@...el.com>
Cc: Shuah Khan <shuah@...nel.org>
Cc: user-mode-linux-devel@...ts.sourceforge.net
Cc: Jeff Dike <jdike@...toit.com>
Cc: Alexander Viro <viro@...iv.linux.org.uk>
Cc: user-mode-linux-user@...ts.sourceforge.net
Cc: David Matlack <dmatlack@...gle.com>
Cc: Boris Ostrovsky <boris.ostrovsky@...cle.com>
Cc: Dmitry Safonov <dsafonov@...tuozzo.com>
Cc: linux-fsdevel@...r.kernel.org
Cc: Paolo Bonzini <pbonzini@...hat.com>
Link: http://lkml.kernel.org/r/20170320081628.18952-7-khuey@kylehuey.com
Signed-off-by: Thomas Gleixner <tglx@...utronix.de>

---
 arch/x86/entry/syscalls/syscall_32.tbl | 1 +
 arch/x86/kernel/process_32.c           | 7 +++++++
 arch/x86/kernel/process_64.c           | 7 +++++++
 arch/x86/um/Makefile                   | 2 +-
 arch/x86/um/syscalls_32.c              | 7 +++++++
 include/linux/compat.h                 | 2 ++
 6 files changed, 25 insertions(+), 1 deletion(-)

diff --git a/arch/x86/entry/syscalls/syscall_32.tbl b/arch/x86/entry/syscalls/syscall_32.tbl
index 9ba050f..0af59fa 100644
--- a/arch/x86/entry/syscalls/syscall_32.tbl
+++ b/arch/x86/entry/syscalls/syscall_32.tbl
@@ -390,3 +390,4 @@
 381	i386	pkey_alloc		sys_pkey_alloc
 382	i386	pkey_free		sys_pkey_free
 383	i386	statx			sys_statx
+384	i386	arch_prctl		sys_arch_prctl			compat_sys_arch_prctl
diff --git a/arch/x86/kernel/process_32.c b/arch/x86/kernel/process_32.c
index 4c818f8..ff40e74 100644
--- a/arch/x86/kernel/process_32.c
+++ b/arch/x86/kernel/process_32.c
@@ -37,6 +37,7 @@
 #include <linux/uaccess.h>
 #include <linux/io.h>
 #include <linux/kdebug.h>
+#include <linux/syscalls.h>
 
 #include <asm/pgtable.h>
 #include <asm/ldt.h>
@@ -56,6 +57,7 @@
 #include <asm/switch_to.h>
 #include <asm/vm86.h>
 #include <asm/intel_rdt.h>
+#include <asm/proto.h>
 
 void __show_regs(struct pt_regs *regs, int all)
 {
@@ -304,3 +306,8 @@ __switch_to(struct task_struct *prev_p, struct task_struct *next_p)
 
 	return prev_p;
 }
+
+SYSCALL_DEFINE2(arch_prctl, int, option, unsigned long, arg2)
+{
+	return do_arch_prctl_common(current, option, arg2);
+}
diff --git a/arch/x86/kernel/process_64.c b/arch/x86/kernel/process_64.c
index d81b0a6..ea1a618 100644
--- a/arch/x86/kernel/process_64.c
+++ b/arch/x86/kernel/process_64.c
@@ -635,6 +635,13 @@ SYSCALL_DEFINE2(arch_prctl, int, option, unsigned long, arg2)
 	return ret;
 }
 
+#ifdef CONFIG_IA32_EMULATION
+COMPAT_SYSCALL_DEFINE2(arch_prctl, int, option, unsigned long, arg2)
+{
+	return do_arch_prctl_common(current, option, arg2);
+}
+#endif
+
 unsigned long KSTK_ESP(struct task_struct *task)
 {
 	return task_pt_regs(task)->sp;
diff --git a/arch/x86/um/Makefile b/arch/x86/um/Makefile
index e7e7055..69f0827 100644
--- a/arch/x86/um/Makefile
+++ b/arch/x86/um/Makefile
@@ -16,7 +16,7 @@ obj-y = bug.o bugs_$(BITS).o delay.o fault.o ldt.o \
 
 ifeq ($(CONFIG_X86_32),y)
 
-obj-y += checksum_32.o
+obj-y += checksum_32.o syscalls_32.o
 obj-$(CONFIG_ELF_CORE) += elfcore.o
 
 subarch-y = ../lib/string_32.o ../lib/atomic64_32.o ../lib/atomic64_cx8_32.o
diff --git a/arch/x86/um/syscalls_32.c b/arch/x86/um/syscalls_32.c
new file mode 100644
index 0000000..627d688
--- /dev/null
+++ b/arch/x86/um/syscalls_32.c
@@ -0,0 +1,7 @@
+#include <linux/syscalls.h>
+#include <os.h>
+
+SYSCALL_DEFINE2(arch_prctl, int, option, unsigned long, arg2)
+{
+	return -EINVAL;
+}
diff --git a/include/linux/compat.h b/include/linux/compat.h
index aef47be..af9dbc4 100644
--- a/include/linux/compat.h
+++ b/include/linux/compat.h
@@ -723,6 +723,8 @@ asmlinkage long compat_sys_sched_rr_get_interval(compat_pid_t pid,
 asmlinkage long compat_sys_fanotify_mark(int, unsigned int, __u32, __u32,
 					    int, const char __user *);
 
+asmlinkage long compat_sys_arch_prctl(int option, unsigned long arg2);
+
 /*
  * For most but not all architectures, "am I in a compat syscall?" and
  * "am I a compat task?" are the same question.  For architectures on which

Powered by blists - more mailing lists