x86/arch_prctl: Add do_arch_prctl_common()
authorKyle Huey <[email protected]>
Mon, 20 Mar 2017 08:16:23 +0000 (01:16 -0700)
committerThomas Gleixner <[email protected]>
Mon, 20 Mar 2017 15:10:33 +0000 (16:10 +0100)
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 <[email protected]>
Cc: Grzegorz Andrejczuk <[email protected]>
Cc: [email protected]
Cc: Radim Krčmář <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Dave Hansen <[email protected]>
Cc: Andi Kleen <[email protected]>
Cc: [email protected]
Cc: Nadav Amit <[email protected]>
Cc: Robert O'Callahan <[email protected]>
Cc: Richard Weinberger <[email protected]>
Cc: "Rafael J. Wysocki" <[email protected]>
Cc: Borislav Petkov <[email protected]>
Cc: Andy Lutomirski <[email protected]>
Cc: Len Brown <[email protected]>
Cc: Shuah Khan <[email protected]>
Cc: [email protected]
Cc: Jeff Dike <[email protected]>
Cc: Alexander Viro <[email protected]>
Cc: [email protected]
Cc: David Matlack <[email protected]>
Cc: Boris Ostrovsky <[email protected]>
Cc: Dmitry Safonov <[email protected]>
Cc: [email protected]
Cc: Paolo Bonzini <[email protected]>
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Thomas Gleixner <[email protected]>
arch/x86/include/asm/proto.h
arch/x86/kernel/process.c
arch/x86/kernel/process_64.c

index 4e276f6cb1c1fa6ae074c409bca17c5ad1e0d977..8d3964fc5f915c37ec7bf74706446adc8ad2e93b 100644 (file)
@@ -31,4 +31,7 @@ void x86_report_nx(void);
 
 extern int reboot_force;
 
+long do_arch_prctl_common(struct task_struct *task, int option,
+                         unsigned long cpuid_enabled);
+
 #endif /* _ASM_X86_PROTO_H */
index 366db7782fc60d0b6cd83f8f4c4b83887377f7c0..b12e95eceb83d76c2fb71cded930dc47be16fe3e 100644 (file)
@@ -545,3 +545,9 @@ out:
        put_task_stack(p);
        return ret;
 }
+
+long do_arch_prctl_common(struct task_struct *task, int option,
+                         unsigned long cpuid_enabled)
+{
+       return -EINVAL;
+}
index e37f764c11cc89da82bc420e71217a748b7790f7..d81b0a60a45ccf3de1b673d7f7a7e825e9ee97e3 100644 (file)
@@ -626,7 +626,13 @@ long do_arch_prctl_64(struct task_struct *task, int option, unsigned long arg2)
 
 SYSCALL_DEFINE2(arch_prctl, int, option, unsigned long, arg2)
 {
-       return do_arch_prctl_64(current, option, arg2);
+       long ret;
+
+       ret = do_arch_prctl_64(current, option, arg2);
+       if (ret == -EINVAL)
+               ret = do_arch_prctl_common(current, option, arg2);
+
+       return ret;
 }
 
 unsigned long KSTK_ESP(struct task_struct *task)