]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/commitdiff
Merge branch 'x86/urgent' into x86/asm, to pick up dependent fixes
authorIngo Molnar <mingo@kernel.org>
Mon, 23 Oct 2017 11:30:47 +0000 (13:30 +0200)
committerIngo Molnar <mingo@kernel.org>
Mon, 23 Oct 2017 11:30:47 +0000 (13:30 +0200)
Signed-off-by: Ingo Molnar <mingo@kernel.org>
19 files changed:
Documentation/x86/orc-unwinder.txt
Makefile
arch/x86/Kconfig
arch/x86/Kconfig.debug
arch/x86/configs/tiny.config
arch/x86/configs/x86_64_defconfig
arch/x86/include/asm/archrandom.h
arch/x86/include/asm/bitops.h
arch/x86/include/asm/module.h
arch/x86/include/asm/percpu.h
arch/x86/include/asm/rmwcc.h
arch/x86/include/asm/syscalls.h
arch/x86/include/asm/unwind.h
arch/x86/kernel/Makefile
arch/x86/kernel/ldt.c
arch/x86/um/ldt.c
include/asm-generic/vmlinux.lds.h
lib/Kconfig.debug
scripts/Makefile.build

index af0c9a4c65a6dab9d5b806dadb011209de718c33..cd4b29be29af1e84162f06b86f306183b1df5d22 100644 (file)
@@ -4,7 +4,7 @@ ORC unwinder
 Overview
 --------
 
-The kernel CONFIG_ORC_UNWINDER option enables the ORC unwinder, which is
+The kernel CONFIG_UNWINDER_ORC option enables the ORC unwinder, which is
 similar in concept to a DWARF unwinder.  The difference is that the
 format of the ORC data is much simpler than DWARF, which in turn allows
 the ORC unwinder to be much simpler and faster.
index 46bfb0ed22570cf7f1736eeb7ffd10e500c923e4..369eea08a572ce3fd1c25e074c58d8e9dbce462c 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -933,8 +933,8 @@ ifdef CONFIG_STACK_VALIDATION
   ifeq ($(has_libelf),1)
     objtool_target := tools/objtool FORCE
   else
-    ifdef CONFIG_ORC_UNWINDER
-      $(error "Cannot generate ORC metadata for CONFIG_ORC_UNWINDER=y, please install libelf-dev, libelf-devel or elfutils-libelf-devel")
+    ifdef CONFIG_UNWINDER_ORC
+      $(error "Cannot generate ORC metadata for CONFIG_UNWINDER_ORC=y, please install libelf-dev, libelf-devel or elfutils-libelf-devel")
     else
       $(warning "Cannot use CONFIG_STACK_VALIDATION=y, please install libelf-dev, libelf-devel or elfutils-libelf-devel")
     endif
index 971feac135060d371e130680b54034f9dd39556a..6b94ca0aa585c675a5b3afdd814ea962c25e0ebf 100644 (file)
@@ -170,7 +170,7 @@ config X86
        select HAVE_PERF_USER_STACK_DUMP
        select HAVE_RCU_TABLE_FREE
        select HAVE_REGS_AND_STACK_ACCESS_API
-       select HAVE_RELIABLE_STACKTRACE         if X86_64 && FRAME_POINTER_UNWINDER && STACK_VALIDATION
+       select HAVE_RELIABLE_STACKTRACE         if X86_64 && UNWINDER_FRAME_POINTER && STACK_VALIDATION
        select HAVE_STACK_VALIDATION            if X86_64
        select HAVE_SYSCALL_TRACEPOINTS
        select HAVE_UNSTABLE_SCHED_CLOCK
index 71a48a30fc849059a418866a8ad4d10d7a922bf3..a4ff214fb76037b6105e9aae7e34cc79d7c355f3 100644 (file)
@@ -358,28 +358,14 @@ config PUNIT_ATOM_DEBUG
 
 choice
        prompt "Choose kernel unwinder"
-       default FRAME_POINTER_UNWINDER
+       default UNWINDER_ORC if X86_64
+       default UNWINDER_FRAME_POINTER if X86_32
        ---help---
          This determines which method will be used for unwinding kernel stack
          traces for panics, oopses, bugs, warnings, perf, /proc/<pid>/stack,
          livepatch, lockdep, and more.
 
-config FRAME_POINTER_UNWINDER
-       bool "Frame pointer unwinder"
-       select FRAME_POINTER
-       ---help---
-         This option enables the frame pointer unwinder for unwinding kernel
-         stack traces.
-
-         The unwinder itself is fast and it uses less RAM than the ORC
-         unwinder, but the kernel text size will grow by ~3% and the kernel's
-         overall performance will degrade by roughly 5-10%.
-
-         This option is recommended if you want to use the livepatch
-         consistency model, as this is currently the only way to get a
-         reliable stack trace (CONFIG_HAVE_RELIABLE_STACKTRACE).
-
-config ORC_UNWINDER
+config UNWINDER_ORC
        bool "ORC unwinder"
        depends on X86_64
        select STACK_VALIDATION
@@ -395,7 +381,22 @@ config ORC_UNWINDER
          Enabling this option will increase the kernel's runtime memory usage
          by roughly 2-4MB, depending on your kernel config.
 
-config GUESS_UNWINDER
+config UNWINDER_FRAME_POINTER
+       bool "Frame pointer unwinder"
+       select FRAME_POINTER
+       ---help---
+         This option enables the frame pointer unwinder for unwinding kernel
+         stack traces.
+
+         The unwinder itself is fast and it uses less RAM than the ORC
+         unwinder, but the kernel text size will grow by ~3% and the kernel's
+         overall performance will degrade by roughly 5-10%.
+
+         This option is recommended if you want to use the livepatch
+         consistency model, as this is currently the only way to get a
+         reliable stack trace (CONFIG_HAVE_RELIABLE_STACKTRACE).
+
+config UNWINDER_GUESS
        bool "Guess unwinder"
        depends on EXPERT
        ---help---
@@ -410,7 +411,7 @@ config GUESS_UNWINDER
 endchoice
 
 config FRAME_POINTER
-       depends on !ORC_UNWINDER && !GUESS_UNWINDER
+       depends on !UNWINDER_ORC && !UNWINDER_GUESS
        bool
 
 endmenu
index 550cd5012b7354efd1d1eb3eaeebffd8cd7e30eb..66c9e2aab16cc31932c68ba08d484876ccf53ddc 100644 (file)
@@ -1,5 +1,5 @@
 CONFIG_NOHIGHMEM=y
 # CONFIG_HIGHMEM4G is not set
 # CONFIG_HIGHMEM64G is not set
-CONFIG_GUESS_UNWINDER=y
-# CONFIG_FRAME_POINTER_UNWINDER is not set
+CONFIG_UNWINDER_GUESS=y
+# CONFIG_UNWINDER_FRAME_POINTER is not set
index 4a4b16e56d354f3d48bcf8ba8a6ac21127f4cf13..e32fc1f274d854d48e1175a27210b87ccfaf509c 100644 (file)
@@ -299,6 +299,7 @@ CONFIG_DEBUG_STACKOVERFLOW=y
 # CONFIG_DEBUG_RODATA_TEST is not set
 CONFIG_DEBUG_BOOT_PARAMS=y
 CONFIG_OPTIMIZE_INLINING=y
+CONFIG_UNWINDER_ORC=y
 CONFIG_SECURITY=y
 CONFIG_SECURITY_NETWORK=y
 CONFIG_SECURITY_SELINUX=y
index 5b0579abb39829ce3c6a1b4f00e73dd9295c26dc..3ac991d81e74d9c7293d66c19a0f66eb1ca7b436 100644 (file)
@@ -45,7 +45,7 @@ static inline bool rdrand_long(unsigned long *v)
        bool ok;
        unsigned int retry = RDRAND_RETRY_LOOPS;
        do {
-               asm volatile(RDRAND_LONG "\n\t"
+               asm volatile(RDRAND_LONG
                             CC_SET(c)
                             : CC_OUT(c) (ok), "=a" (*v));
                if (ok)
@@ -59,7 +59,7 @@ static inline bool rdrand_int(unsigned int *v)
        bool ok;
        unsigned int retry = RDRAND_RETRY_LOOPS;
        do {
-               asm volatile(RDRAND_INT "\n\t"
+               asm volatile(RDRAND_INT
                             CC_SET(c)
                             : CC_OUT(c) (ok), "=a" (*v));
                if (ok)
@@ -71,7 +71,7 @@ static inline bool rdrand_int(unsigned int *v)
 static inline bool rdseed_long(unsigned long *v)
 {
        bool ok;
-       asm volatile(RDSEED_LONG "\n\t"
+       asm volatile(RDSEED_LONG
                     CC_SET(c)
                     : CC_OUT(c) (ok), "=a" (*v));
        return ok;
@@ -80,7 +80,7 @@ static inline bool rdseed_long(unsigned long *v)
 static inline bool rdseed_int(unsigned int *v)
 {
        bool ok;
-       asm volatile(RDSEED_INT "\n\t"
+       asm volatile(RDSEED_INT
                     CC_SET(c)
                     : CC_OUT(c) (ok), "=a" (*v));
        return ok;
index 854022772c5be4d49d2697bd2b66b454f49c9e6f..8cee8db6dffbdfc72c151a9e8c475435b6f10dd7 100644 (file)
@@ -142,7 +142,7 @@ static __always_inline void __clear_bit(long nr, volatile unsigned long *addr)
 static __always_inline bool clear_bit_unlock_is_negative_byte(long nr, volatile unsigned long *addr)
 {
        bool negative;
-       asm volatile(LOCK_PREFIX "andb %2,%1\n\t"
+       asm volatile(LOCK_PREFIX "andb %2,%1"
                CC_SET(s)
                : CC_OUT(s) (negative), ADDR
                : "ir" ((char) ~(1 << nr)) : "memory");
@@ -245,7 +245,7 @@ static __always_inline bool __test_and_set_bit(long nr, volatile unsigned long *
 {
        bool oldbit;
 
-       asm("bts %2,%1\n\t"
+       asm("bts %2,%1"
            CC_SET(c)
            : CC_OUT(c) (oldbit), ADDR
            : "Ir" (nr));
@@ -285,7 +285,7 @@ static __always_inline bool __test_and_clear_bit(long nr, volatile unsigned long
 {
        bool oldbit;
 
-       asm volatile("btr %2,%1\n\t"
+       asm volatile("btr %2,%1"
                     CC_SET(c)
                     : CC_OUT(c) (oldbit), ADDR
                     : "Ir" (nr));
@@ -297,7 +297,7 @@ static __always_inline bool __test_and_change_bit(long nr, volatile unsigned lon
 {
        bool oldbit;
 
-       asm volatile("btc %2,%1\n\t"
+       asm volatile("btc %2,%1"
                     CC_SET(c)
                     : CC_OUT(c) (oldbit), ADDR
                     : "Ir" (nr) : "memory");
@@ -328,7 +328,7 @@ static __always_inline bool variable_test_bit(long nr, volatile const unsigned l
 {
        bool oldbit;
 
-       asm volatile("bt %2,%1\n\t"
+       asm volatile("bt %2,%1"
                     CC_SET(c)
                     : CC_OUT(c) (oldbit)
                     : "m" (*(unsigned long *)addr), "Ir" (nr));
index 9eb7c718aaf8bdcd3ba6c3fc18e38d04a8228440..9f05a1002aa94c922b722c9c57c5485f58851711 100644 (file)
@@ -5,7 +5,7 @@
 #include <asm/orc_types.h>
 
 struct mod_arch_specific {
-#ifdef CONFIG_ORC_UNWINDER
+#ifdef CONFIG_UNWINDER_ORC
        unsigned int num_orcs;
        int *orc_unwind_ip;
        struct orc_entry *orc_unwind;
index 9fa03604b2b37bcdd9b40df0bf841e36dcc569cd..b21a475fd7ed6aea7d3514829817a59a3fd7ef68 100644 (file)
@@ -525,7 +525,7 @@ static inline bool x86_this_cpu_variable_test_bit(int nr,
 {
        bool oldbit;
 
-       asm volatile("bt "__percpu_arg(2)",%1\n\t"
+       asm volatile("bt "__percpu_arg(2)",%1"
                        CC_SET(c)
                        : CC_OUT(c) (oldbit)
                        : "m" (*(unsigned long __percpu *)addr), "Ir" (nr));
index 045f99211a9921cfd4eddb7250ff4ed56a602c2a..0c411c8bbdbd23164b3f8ed8b80bd777c978c027 100644 (file)
@@ -28,7 +28,7 @@ cc_label:                                                             \
 #define __GEN_RMWcc(fullop, var, cc, clobbers, ...)                    \
 do {                                                                   \
        bool c;                                                         \
-       asm volatile (fullop ";" CC_SET(cc)                             \
+       asm volatile (fullop CC_SET(cc)                                 \
                        : [counter] "+m" (var), CC_OUT(cc) (c)          \
                        : __VA_ARGS__ : clobbers);                      \
        return c;                                                       \
index 91dfcafe27a662cba41d162bf374d9632961406e..bad25bb80679fe79cec042a0644d1205db5498fc 100644 (file)
@@ -21,7 +21,7 @@ asmlinkage long sys_ioperm(unsigned long, unsigned long, int);
 asmlinkage long sys_iopl(unsigned int);
 
 /* kernel/ldt.c */
-asmlinkage int sys_modify_ldt(int, void __user *, unsigned long);
+asmlinkage long sys_modify_ldt(int, void __user *, unsigned long);
 
 /* kernel/signal.c */
 asmlinkage long sys_rt_sigreturn(void);
index e9f793e2df7a135f72a5dcbeee6a09a1d73fb383..35d67dc7b69fc88832b81a03a67453fc501e2a3b 100644 (file)
@@ -12,11 +12,11 @@ struct unwind_state {
        struct task_struct *task;
        int graph_idx;
        bool error;
-#if defined(CONFIG_ORC_UNWINDER)
+#if defined(CONFIG_UNWINDER_ORC)
        bool signal, full_regs;
        unsigned long sp, bp, ip;
        struct pt_regs *regs;
-#elif defined(CONFIG_FRAME_POINTER_UNWINDER)
+#elif defined(CONFIG_UNWINDER_FRAME_POINTER)
        bool got_irq;
        unsigned long *bp, *orig_sp, ip;
        struct pt_regs *regs;
@@ -50,7 +50,7 @@ void unwind_start(struct unwind_state *state, struct task_struct *task,
        __unwind_start(state, task, regs, first_frame);
 }
 
-#if defined(CONFIG_ORC_UNWINDER) || defined(CONFIG_FRAME_POINTER_UNWINDER)
+#if defined(CONFIG_UNWINDER_ORC) || defined(CONFIG_UNWINDER_FRAME_POINTER)
 static inline struct pt_regs *unwind_get_entry_regs(struct unwind_state *state)
 {
        if (unwind_done(state))
@@ -65,7 +65,7 @@ static inline struct pt_regs *unwind_get_entry_regs(struct unwind_state *state)
 }
 #endif
 
-#ifdef CONFIG_ORC_UNWINDER
+#ifdef CONFIG_UNWINDER_ORC
 void unwind_init(void);
 void unwind_module_init(struct module *mod, void *orc_ip, size_t orc_ip_size,
                        void *orc, size_t orc_size);
index fd0a7895b63f57bd77a4310936e6d239a45035d1..6209ab6deb50d91e20274dc3d4bfbcd80a94c605 100644 (file)
@@ -127,9 +127,9 @@ obj-$(CONFIG_PERF_EVENTS)           += perf_regs.o
 obj-$(CONFIG_TRACING)                  += tracepoint.o
 obj-$(CONFIG_SCHED_MC_PRIO)            += itmt.o
 
-obj-$(CONFIG_ORC_UNWINDER)             += unwind_orc.o
-obj-$(CONFIG_FRAME_POINTER_UNWINDER)   += unwind_frame.o
-obj-$(CONFIG_GUESS_UNWINDER)           += unwind_guess.o
+obj-$(CONFIG_UNWINDER_ORC)             += unwind_orc.o
+obj-$(CONFIG_UNWINDER_FRAME_POINTER)   += unwind_frame.o
+obj-$(CONFIG_UNWINDER_GUESS)           += unwind_guess.o
 
 ###
 # 64 bit specific files
index f0e64db18ac83db5f45e6bb7f531e1536d11522a..0402d44deb4d2b300828c9d7af3e2a09aa35d782 100644 (file)
@@ -12,6 +12,7 @@
 #include <linux/string.h>
 #include <linux/mm.h>
 #include <linux/smp.h>
+#include <linux/syscalls.h>
 #include <linux/slab.h>
 #include <linux/vmalloc.h>
 #include <linux/uaccess.h>
@@ -294,8 +295,8 @@ out:
        return error;
 }
 
-asmlinkage int sys_modify_ldt(int func, void __user *ptr,
-                             unsigned long bytecount)
+SYSCALL_DEFINE3(modify_ldt, int , func , void __user * , ptr ,
+               unsigned long , bytecount)
 {
        int ret = -ENOSYS;
 
@@ -313,5 +314,14 @@ asmlinkage int sys_modify_ldt(int func, void __user *ptr,
                ret = write_ldt(ptr, bytecount, 0);
                break;
        }
-       return ret;
+       /*
+        * The SYSCALL_DEFINE() macros give us an 'unsigned long'
+        * return type, but tht ABI for sys_modify_ldt() expects
+        * 'int'.  This cast gives us an int-sized value in %rax
+        * for the return code.  The 'unsigned' is necessary so
+        * the compiler does not try to sign-extend the negative
+        * return codes into the high half of the register when
+        * taking the value from int->long.
+        */
+       return (unsigned int)ret;
 }
index 836a1eb5df436bdad88fe3b4ae59b512f9573b19..3ee234b6234dd6eaf0a3e61b8d4d99677a5a7078 100644 (file)
@@ -6,6 +6,7 @@
 #include <linux/mm.h>
 #include <linux/sched.h>
 #include <linux/slab.h>
+#include <linux/syscalls.h>
 #include <linux/uaccess.h>
 #include <asm/unistd.h>
 #include <os.h>
@@ -369,7 +370,9 @@ void free_ldt(struct mm_context *mm)
        mm->arch.ldt.entry_count = 0;
 }
 
-int sys_modify_ldt(int func, void __user *ptr, unsigned long bytecount)
+SYSCALL_DEFINE3(modify_ldt, int , func , void __user * , ptr ,
+               unsigned long , bytecount)
 {
-       return do_modify_ldt_skas(func, ptr, bytecount);
+       /* See non-um modify_ldt() for why we do this cast */
+       return (unsigned int)do_modify_ldt_skas(func, ptr, bytecount);
 }
index 8acfc1e099e11079cde2ed23d028bd6d5fb79bc6..63e56f6c1877a44034f8981ad2381fe4b9d7130e 100644 (file)
 #define BUG_TABLE
 #endif
 
-#ifdef CONFIG_ORC_UNWINDER
+#ifdef CONFIG_UNWINDER_ORC
 #define ORC_UNWIND_TABLE                                               \
        . = ALIGN(4);                                                   \
        .orc_unwind_ip : AT(ADDR(.orc_unwind_ip) - LOAD_OFFSET) {       \
index dfdad67d8f6cce470171986addcad7b61c09f382..ff21b4dbb3922fd2046b3a3c62acd34e5c5a4f80 100644 (file)
@@ -376,7 +376,7 @@ config STACK_VALIDATION
          that runtime stack traces are more reliable.
 
          This is also a prerequisite for generation of ORC unwind data, which
-         is needed for CONFIG_ORC_UNWINDER.
+         is needed for CONFIG_UNWINDER_ORC.
 
          For more information, see
          tools/objtool/Documentation/stack-validation.txt.
index 061d0c3a420ad58084df157a143e76133f304dc2..f965f477832ede9ab6a77749e47bfb499cb93e1f 100644 (file)
@@ -258,7 +258,7 @@ ifneq ($(SKIP_STACK_VALIDATION),1)
 
 __objtool_obj := $(objtree)/tools/objtool/objtool
 
-objtool_args = $(if $(CONFIG_ORC_UNWINDER),orc generate,check)
+objtool_args = $(if $(CONFIG_UNWINDER_ORC),orc generate,check)
 
 ifndef CONFIG_FRAME_POINTER
 objtool_args += --no-fp