Merge tag 'for-linus' of git://git.armlinux.org.uk/~rmk/linux-arm
authorLinus Torvalds <torvalds@linux-foundation.org>
Sun, 3 Apr 2022 17:17:48 +0000 (10:17 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Sun, 3 Apr 2022 17:17:48 +0000 (10:17 -0700)
Pull ARM fixes from Russell King:

 - avoid unnecessary rebuilds for library objects

 - fix return value of __setup handlers

 - fix invalid input check for "crashkernel=" kernel option

 - silence KASAN warnings in unwind_frame

* tag 'for-linus' of git://git.armlinux.org.uk/~rmk/linux-arm:
  ARM: 9191/1: arm/stacktrace, kasan: Silence KASAN warnings in unwind_frame()
  ARM: 9190/1: kdump: add invalid input check for 'crashkernel=0'
  ARM: 9187/1: JIVE: fix return value of __setup handler
  ARM: 9189/1: decompressor: fix unneeded rebuilds of library objects

1  2 
arch/arm/boot/compressed/Makefile
arch/arm/kernel/setup.c
arch/arm/kernel/stacktrace.c

index 187a187706cbeb2b5d2339611b5c0a71420221ff,e65c7ad5dd4ca62519512c30952dc3deac4a32cc..41bcbb460fac459c70261a2cb384b13c56ef9058
@@@ -92,13 -92,19 +92,15 @@@ ifeq ($(CONFIG_USE_OF),y
  OBJS  += $(libfdt_objs) fdt_check_mem_start.o
  endif
  
 -# -fstack-protector-strong triggers protection checks in this code,
 -# but it is being used too early to link to meaningful stack_chk logic.
 -$(foreach o, $(libfdt_objs) atags_to_fdt.o fdt_check_mem_start.o, \
 -      $(eval CFLAGS_$(o) := -I $(srctree)/scripts/dtc/libfdt -fno-stack-protector))
 -
+ OBJS  += lib1funcs.o ashldi3.o bswapsdi2.o
  targets       := vmlinux vmlinux.lds piggy_data piggy.o \
                 head.o $(OBJS)
  
  KBUILD_CFLAGS += -DDISABLE_BRANCH_PROFILING
  
  ccflags-y := -fpic $(call cc-option,-mno-single-pic-base,) -fno-builtin \
 +           -I$(srctree)/scripts/dtc/libfdt -fno-stack-protector \
             -I$(obj) $(DISABLE_ARM_SSP_PER_TASK_PLUGIN)
  ccflags-remove-$(CONFIG_FUNCTION_TRACER) += -pg
  asflags-y := -DZIMAGE
@@@ -126,8 -132,6 +128,6 @@@ endi
  # Next argument is a linker script
  LDFLAGS_vmlinux += -T
  
- OBJS  += lib1funcs.o ashldi3.o bswapsdi2.o
  # We need to prevent any GOTOFF relocs being used with references
  # to symbols in the .bss section since we cannot relocate them
  # independently from the rest at run time.  This can be achieved by
diff --combined arch/arm/kernel/setup.c
index 039feb7cd590b8714f97704f36fb7231ac2be9b2,7646d3ade56cecb6d9f949804b8bb60501198918..1e8a50a97edf2e49dc2075b5b119a5d561010b86
@@@ -141,10 -141,10 +141,10 @@@ EXPORT_SYMBOL(outer_cache)
  int __cpu_architecture __read_mostly = CPU_ARCH_UNKNOWN;
  
  struct stack {
 -      u32 irq[3];
 -      u32 abt[3];
 -      u32 und[3];
 -      u32 fiq[3];
 +      u32 irq[4];
 +      u32 abt[4];
 +      u32 und[4];
 +      u32 fiq[4];
  } ____cacheline_aligned;
  
  #ifndef CONFIG_CPU_V7M
@@@ -1004,7 -1004,8 +1004,8 @@@ static void __init reserve_crashkernel(
        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 b5efecb3d73079e04718033dd914fe7ed1805690,f0c390e9d3cee4040f5cce2ae1ae0f00cceb2b83..d0fa2037460ac7906ab5bef26e5e1ad518e15d1c
@@@ -54,17 -54,17 +54,17 @@@ int notrace unwind_frame(struct stackfr
                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))
@@@ -160,8 -160,7 +160,8 @@@ static noinline void __save_stack_trace
                frame.fp = (unsigned long)__builtin_frame_address(0);
                frame.sp = current_stack_pointer;
                frame.lr = (unsigned long)__builtin_return_address(0);
 -              frame.pc = (unsigned long)__save_stack_trace;
 +here:
 +              frame.pc = (unsigned long)&&here;
        }
  #ifdef CONFIG_KRETPROBES
        frame.kr_cur = NULL;