aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKyle Huey <me@kylehuey.com>2017-03-20 04:16:23 -0400
committerThomas Gleixner <tglx@linutronix.de>2017-03-20 11:10:33 -0400
commitb0b9b014016d16ca7a192da986aa8ebae21bb995 (patch)
tree385c876b068fbe8fa3fc13d88bebd7ea484d8ad9
parent17a6e1b8e8e8539f89156643f8c3073f09ec446a (diff)
x86/arch_prctl: Add do_arch_prctl_common()
Add do_arch_prctl_common() to handle arch_prctls that are not specific to 64 bit mode. Call it from the syscall entry point, but not any of the other callsites in the kernel, which all want one of the existing 64 bit only arch_prctls. Signed-off-by: Kyle Huey <khuey@kylehuey.com> Cc: Grzegorz Andrejczuk <grzegorz.andrejczuk@intel.com> Cc: kvm@vger.kernel.org Cc: Radim Krčmář <rkrcmar@redhat.com> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Dave Hansen <dave.hansen@linux.intel.com> Cc: Andi Kleen <andi@firstfloor.org> Cc: linux-kselftest@vger.kernel.org Cc: Nadav Amit <nadav.amit@gmail.com> Cc: Robert O'Callahan <robert@ocallahan.org> Cc: Richard Weinberger <richard@nod.at> Cc: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com> Cc: Borislav Petkov <bp@suse.de> Cc: Andy Lutomirski <luto@kernel.org> Cc: Len Brown <len.brown@intel.com> Cc: Shuah Khan <shuah@kernel.org> Cc: user-mode-linux-devel@lists.sourceforge.net Cc: Jeff Dike <jdike@addtoit.com> Cc: Alexander Viro <viro@zeniv.linux.org.uk> Cc: user-mode-linux-user@lists.sourceforge.net Cc: David Matlack <dmatlack@google.com> Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com> Cc: Dmitry Safonov <dsafonov@virtuozzo.com> Cc: linux-fsdevel@vger.kernel.org Cc: Paolo Bonzini <pbonzini@redhat.com> Link: http://lkml.kernel.org/r/20170320081628.18952-6-khuey@kylehuey.com Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
-rw-r--r--arch/x86/include/asm/proto.h3
-rw-r--r--arch/x86/kernel/process.c6
-rw-r--r--arch/x86/kernel/process_64.c8
3 files changed, 16 insertions, 1 deletions
diff --git a/arch/x86/include/asm/proto.h b/arch/x86/include/asm/proto.h
index 4e276f6cb1c1..8d3964fc5f91 100644
--- a/arch/x86/include/asm/proto.h
+++ b/arch/x86/include/asm/proto.h
@@ -31,4 +31,7 @@ void x86_report_nx(void);
31 31
32extern int reboot_force; 32extern int reboot_force;
33 33
34long do_arch_prctl_common(struct task_struct *task, int option,
35 unsigned long cpuid_enabled);
36
34#endif /* _ASM_X86_PROTO_H */ 37#endif /* _ASM_X86_PROTO_H */
diff --git a/arch/x86/kernel/process.c b/arch/x86/kernel/process.c
index 366db7782fc6..b12e95eceb83 100644
--- a/arch/x86/kernel/process.c
+++ b/arch/x86/kernel/process.c
@@ -545,3 +545,9 @@ out:
545 put_task_stack(p); 545 put_task_stack(p);
546 return ret; 546 return ret;
547} 547}
548
549long do_arch_prctl_common(struct task_struct *task, int option,
550 unsigned long cpuid_enabled)
551{
552 return -EINVAL;
553}
diff --git a/arch/x86/kernel/process_64.c b/arch/x86/kernel/process_64.c
index e37f764c11cc..d81b0a60a45c 100644
--- a/arch/x86/kernel/process_64.c
+++ b/arch/x86/kernel/process_64.c
@@ -626,7 +626,13 @@ long do_arch_prctl_64(struct task_struct *task, int option, unsigned long arg2)
626 626
627SYSCALL_DEFINE2(arch_prctl, int, option, unsigned long, arg2) 627SYSCALL_DEFINE2(arch_prctl, int, option, unsigned long, arg2)
628{ 628{
629 return do_arch_prctl_64(current, option, arg2); 629 long ret;
630
631 ret = do_arch_prctl_64(current, option, arg2);
632 if (ret == -EINVAL)
633 ret = do_arch_prctl_common(current, option, arg2);
634
635 return ret;
630} 636}
631 637
632unsigned long KSTK_ESP(struct task_struct *task) 638unsigned long KSTK_ESP(struct task_struct *task)