Merge branches 'fixes' and 'misc' into for-linus
authorRussell King (Oracle) <rmk+kernel@armlinux.org.uk>
Fri, 1 Apr 2022 15:12:31 +0000 (16:12 +0100)
committerRussell King (Oracle) <rmk+kernel@armlinux.org.uk>
Fri, 1 Apr 2022 15:12:31 +0000 (16:12 +0100)
arch/arm/include/asm/assembler.h
arch/arm/include/asm/processor.h
arch/arm/include/asm/uaccess.h
arch/arm/kernel/kgdb.c
arch/arm/kernel/setup.c
arch/arm/kernel/stacktrace.c
arch/arm/mach-s3c/mach-jive.c
arch/arm/mm/mmu.c
arch/arm/probes/kprobes/Makefile
lib/Kconfig

index 7d23d4b..6fe6796 100644 (file)
  */
 #define ALT_UP(instr...)                                       \
        .pushsection ".alt.smp.init", "a"                       ;\
+       .align  2                                               ;\
        .long   9998b - .                                       ;\
 9997:  instr                                                   ;\
        .if . - 9997b == 2                                      ;\
        .popsection
 #define ALT_UP_B(label)                                        \
        .pushsection ".alt.smp.init", "a"                       ;\
+       .align  2                                               ;\
        .long   9998b - .                                       ;\
        W(b)    . + (label - 9998b)                                     ;\
        .popsection
index 6af68ed..bdc35c0 100644 (file)
@@ -96,6 +96,7 @@ unsigned long __get_wchan(struct task_struct *p);
 #define __ALT_SMP_ASM(smp, up)                                         \
        "9998:  " smp "\n"                                              \
        "       .pushsection \".alt.smp.init\", \"a\"\n"                \
+       "       .align  2\n"                                            \
        "       .long   9998b - .\n"                                    \
        "       " up "\n"                                               \
        "       .popsection\n"
index 36fbc33..32dbfd8 100644 (file)
@@ -11,6 +11,7 @@
 #include <linux/string.h>
 #include <asm/memory.h>
 #include <asm/domain.h>
+#include <asm/unaligned.h>
 #include <asm/unified.h>
 #include <asm/compiler.h>
 
@@ -497,7 +498,10 @@ do {                                                                       \
        }                                                               \
        default: __err = __get_user_bad(); break;                       \
        }                                                               \
-       *(type *)(dst) = __val;                                         \
+       if (IS_ENABLED(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS))         \
+               put_unaligned(__val, (type *)(dst));                    \
+       else                                                            \
+               *(type *)(dst) = __val; /* aligned by caller */         \
        if (__err)                                                      \
                goto err_label;                                         \
 } while (0)
@@ -507,7 +511,9 @@ do {                                                                        \
        const type *__pk_ptr = (dst);                                   \
        unsigned long __dst = (unsigned long)__pk_ptr;                  \
        int __err = 0;                                                  \
-       type __val = *(type *)src;                                      \
+       type __val = IS_ENABLED(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS) \
+                    ? get_unaligned((type *)(src))                     \
+                    : *(type *)(src);  /* aligned by caller */         \
        switch (sizeof(type)) {                                         \
        case 1: __put_user_asm_byte(__val, __dst, __err, ""); break;    \
        case 2: __put_user_asm_half(__val, __dst, __err, ""); break;    \
index 7bd30c0..22f937e 100644 (file)
@@ -154,22 +154,38 @@ static int kgdb_compiled_brk_fn(struct pt_regs *regs, unsigned int instr)
        return 0;
 }
 
-static struct undef_hook kgdb_brkpt_hook = {
+static struct undef_hook kgdb_brkpt_arm_hook = {
        .instr_mask             = 0xffffffff,
        .instr_val              = KGDB_BREAKINST,
-       .cpsr_mask              = MODE_MASK,
+       .cpsr_mask              = PSR_T_BIT | MODE_MASK,
        .cpsr_val               = SVC_MODE,
        .fn                     = kgdb_brk_fn
 };
 
-static struct undef_hook kgdb_compiled_brkpt_hook = {
+static struct undef_hook kgdb_brkpt_thumb_hook = {
+       .instr_mask             = 0xffff,
+       .instr_val              = KGDB_BREAKINST & 0xffff,
+       .cpsr_mask              = PSR_T_BIT | MODE_MASK,
+       .cpsr_val               = PSR_T_BIT | SVC_MODE,
+       .fn                     = kgdb_brk_fn
+};
+
+static struct undef_hook kgdb_compiled_brkpt_arm_hook = {
        .instr_mask             = 0xffffffff,
        .instr_val              = KGDB_COMPILED_BREAK,
-       .cpsr_mask              = MODE_MASK,
+       .cpsr_mask              = PSR_T_BIT | MODE_MASK,
        .cpsr_val               = SVC_MODE,
        .fn                     = kgdb_compiled_brk_fn
 };
 
+static struct undef_hook kgdb_compiled_brkpt_thumb_hook = {
+       .instr_mask             = 0xffff,
+       .instr_val              = KGDB_COMPILED_BREAK & 0xffff,
+       .cpsr_mask              = PSR_T_BIT | MODE_MASK,
+       .cpsr_val               = PSR_T_BIT | SVC_MODE,
+       .fn                     = kgdb_compiled_brk_fn
+};
+
 static int __kgdb_notify(struct die_args *args, unsigned long cmd)
 {
        struct pt_regs *regs = args->regs;
@@ -210,8 +226,10 @@ int kgdb_arch_init(void)
        if (ret != 0)
                return ret;
 
-       register_undef_hook(&kgdb_brkpt_hook);
-       register_undef_hook(&kgdb_compiled_brkpt_hook);
+       register_undef_hook(&kgdb_brkpt_arm_hook);
+       register_undef_hook(&kgdb_brkpt_thumb_hook);
+       register_undef_hook(&kgdb_compiled_brkpt_arm_hook);
+       register_undef_hook(&kgdb_compiled_brkpt_thumb_hook);
 
        return 0;
 }
@@ -224,8 +242,10 @@ int kgdb_arch_init(void)
  */
 void kgdb_arch_exit(void)
 {
-       unregister_undef_hook(&kgdb_brkpt_hook);
-       unregister_undef_hook(&kgdb_compiled_brkpt_hook);
+       unregister_undef_hook(&kgdb_brkpt_arm_hook);
+       unregister_undef_hook(&kgdb_brkpt_thumb_hook);
+       unregister_undef_hook(&kgdb_compiled_brkpt_arm_hook);
+       unregister_undef_hook(&kgdb_compiled_brkpt_thumb_hook);
        unregister_die_notifier(&kgdb_notifier);
 }
 
index 284a80c..7646d3a 100644 (file)
@@ -1004,7 +1004,8 @@ static void __init reserve_crashkernel(void)
        total_mem = get_total_mem();
        ret = parse_crashkernel(boot_command_line, total_mem,
                                &crash_size, &crash_base);
-       if (ret)
+       /* invalid value specified or crashkernel=0 */
+       if (ret || !crash_size)
                return;
 
        if (crash_base <= 0) {
index 75e9055..f0c390e 100644 (file)
@@ -54,17 +54,17 @@ int notrace unwind_frame(struct stackframe *frame)
                return -EINVAL;
 
        frame->sp = frame->fp;
-       frame->fp = *(unsigned long *)(fp);
-       frame->pc = *(unsigned long *)(fp + 4);
+       frame->fp = READ_ONCE_NOCHECK(*(unsigned long *)(fp));
+       frame->pc = READ_ONCE_NOCHECK(*(unsigned long *)(fp + 4));
 #else
        /* check current frame pointer is within bounds */
        if (fp < low + 12 || fp > high - 4)
                return -EINVAL;
 
        /* restore the registers from the stack frame */
-       frame->fp = *(unsigned long *)(fp - 12);
-       frame->sp = *(unsigned long *)(fp - 8);
-       frame->pc = *(unsigned long *)(fp - 4);
+       frame->fp = READ_ONCE_NOCHECK(*(unsigned long *)(fp - 12));
+       frame->sp = READ_ONCE_NOCHECK(*(unsigned long *)(fp - 8));
+       frame->pc = READ_ONCE_NOCHECK(*(unsigned long *)(fp - 4));
 #endif
 #ifdef CONFIG_KRETPROBES
        if (is_kretprobe_trampoline(frame->pc))
index 285e1f0..0d7d408 100644 (file)
@@ -236,11 +236,11 @@ static int __init jive_mtdset(char *options)
        unsigned long set;
 
        if (options == NULL || options[0] == '\0')
-               return 0;
+               return 1;
 
        if (kstrtoul(options, 10, &set)) {
                printk(KERN_ERR "failed to parse mtdset=%s\n", options);
-               return 0;
+               return 1;
        }
 
        switch (set) {
@@ -256,7 +256,7 @@ static int __init jive_mtdset(char *options)
                       "using default.", set);
        }
 
-       return 0;
+       return 1;
 }
 
 /* parse the mtdset= option given to the kernel command line */
index 274e4f7..5e2be37 100644 (file)
@@ -212,12 +212,14 @@ early_param("ecc", early_ecc);
 static int __init early_cachepolicy(char *p)
 {
        pr_warn("cachepolicy kernel parameter not supported without cp15\n");
+       return 0;
 }
 early_param("cachepolicy", early_cachepolicy);
 
 static int __init noalign_setup(char *__unused)
 {
        pr_warn("noalign kernel parameter not supported without cp15\n");
+       return 1;
 }
 __setup("noalign", noalign_setup);
 
index 14db56f..6159010 100644 (file)
@@ -1,4 +1,7 @@
 # SPDX-License-Identifier: GPL-2.0
+KASAN_SANITIZE_actions-common.o := n
+KASAN_SANITIZE_actions-arm.o := n
+KASAN_SANITIZE_actions-thumb.o := n
 obj-$(CONFIG_KPROBES)          += core.o actions-common.o checkers-common.o
 obj-$(CONFIG_ARM_KPROBES_TEST) += test-kprobes.o
 test-kprobes-objs              := test-core.o
index c80fde8..9b5a692 100644 (file)
@@ -45,7 +45,6 @@ config BITREVERSE
 config HAVE_ARCH_BITREVERSE
        bool
        default n
-       depends on BITREVERSE
        help
          This option enables the use of hardware bit-reversal instructions on
          architectures which support such operations.