Merge branch 'x86-irq-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git...
authorLinus Torvalds <torvalds@linux-foundation.org>
Mon, 6 May 2019 22:56:41 +0000 (15:56 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Mon, 6 May 2019 22:56:41 +0000 (15:56 -0700)
Pull x86 irq updates from Ingo Molnar:
 "Here are the main changes in this tree:

   - Introduce x86-64 IRQ/exception/debug stack guard pages to detect
     stack overflows immediately and deterministically.

   - Clean up over a decade worth of cruft accumulated.

  The outcome of this should be more clear-cut faults/crashes when any
  of the low level x86 CPU stacks overflow, instead of silent memory
  corruption and sporadic failures much later on"

* 'x86-irq-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (33 commits)
  x86/irq: Fix outdated comments
  x86/irq/64: Remove stack overflow debug code
  x86/irq/64: Remap the IRQ stack with guard pages
  x86/irq/64: Split the IRQ stack into its own pages
  x86/irq/64: Init hardirq_stack_ptr during CPU hotplug
  x86/irq/32: Handle irq stack allocation failure proper
  x86/irq/32: Invoke irq_ctx_init() from init_IRQ()
  x86/irq/64: Rename irq_stack_ptr to hardirq_stack_ptr
  x86/irq/32: Rename hard/softirq_stack to hard/softirq_stack_ptr
  x86/irq/32: Make irq stack a character array
  x86/irq/32: Define IRQ_STACK_SIZE
  x86/dumpstack/64: Speedup in_exception_stack()
  x86/exceptions: Split debug IST stack
  x86/exceptions: Enable IST guard pages
  x86/exceptions: Disconnect IST index and stack order
  x86/cpu: Remove orig_ist array
  x86/cpu: Prepare TSS.IST setup for guard pages
  x86/dumpstack/64: Use cpu_entry_area instead of orig_ist
  x86/irq/64: Use cpu entry area instead of orig_ist
  x86/traps: Use cpu_entry_area instead of orig_ist
  ...

1  2 
arch/x86/Kconfig
arch/x86/entry/entry_64.S
arch/x86/include/asm/stacktrace.h
arch/x86/kernel/cpu/common.c
arch/x86/kernel/vmlinux.lds.S
arch/x86/tools/relocs.c
mm/slab.c

diff --combined arch/x86/Kconfig
@@@ -14,6 -14,7 +14,7 @@@ config X86_3
        select ARCH_WANT_IPC_PARSE_VERSION
        select CLKSRC_I8253
        select CLONE_BACKWARDS
+       select HAVE_DEBUG_STACKOVERFLOW
        select MODULES_USE_ELF_REL
        select OLD_SIGACTION
  
@@@ -28,6 -29,7 +29,6 @@@ config X86_6
        select MODULES_USE_ELF_RELA
        select NEED_DMA_MAP_STATE
        select SWIOTLB
 -      select X86_DEV_DMA_OPS
        select ARCH_HAS_SYSCALL_WRAPPER
  
  #
@@@ -73,7 -75,6 +74,7 @@@ config X8
        select ARCH_MIGHT_HAVE_ACPI_PDC         if ACPI
        select ARCH_MIGHT_HAVE_PC_PARPORT
        select ARCH_MIGHT_HAVE_PC_SERIO
 +      select ARCH_STACKWALK
        select ARCH_SUPPORTS_ACPI
        select ARCH_SUPPORTS_ATOMIC_RMW
        select ARCH_SUPPORTS_NUMA_BALANCING     if X86_64
        select HAVE_COPY_THREAD_TLS
        select HAVE_C_RECORDMCOUNT
        select HAVE_DEBUG_KMEMLEAK
-       select HAVE_DEBUG_STACKOVERFLOW
        select HAVE_DMA_CONTIGUOUS
        select HAVE_DYNAMIC_FTRACE
        select HAVE_DYNAMIC_FTRACE_WITH_REGS
        select HAVE_PERF_REGS
        select HAVE_PERF_USER_STACK_DUMP
        select HAVE_RCU_TABLE_FREE              if PARAVIRT
 -      select HAVE_RCU_TABLE_INVALIDATE        if HAVE_RCU_TABLE_FREE
        select HAVE_REGS_AND_STACK_ACCESS_API
        select HAVE_RELIABLE_STACKTRACE         if X86_64 && (UNWINDER_FRAME_POINTER || UNWINDER_ORC) && STACK_VALIDATION
        select HAVE_FUNCTION_ARG_ACCESS_API
@@@ -267,6 -268,9 +267,6 @@@ config ARCH_MAY_HAVE_PC_FD
        def_bool y
        depends on ISA_DMA_API
  
 -config RWSEM_XCHGADD_ALGORITHM
 -      def_bool y
 -
  config GENERIC_CALIBRATE_DELAY
        def_bool y
  
@@@ -699,6 -703,8 +699,6 @@@ config STA2X1
        bool "STA2X11 Companion Chip Support"
        depends on X86_32_NON_STANDARD && PCI
        select ARCH_HAS_PHYS_TO_DMA
 -      select X86_DEV_DMA_OPS
 -      select X86_DMA_REMAP
        select SWIOTLB
        select MFD_STA2X11
        select GPIOLIB
@@@ -777,6 -783,14 +777,6 @@@ config PARAVIRT_SPINLOCK
  
          If you are unsure how to answer this question, answer Y.
  
 -config QUEUED_LOCK_STAT
 -      bool "Paravirt queued spinlock statistics"
 -      depends on PARAVIRT_SPINLOCKS && DEBUG_FS
 -      ---help---
 -        Enable the collection of statistical data on the slowpath
 -        behavior of paravirtualized queued spinlocks and report
 -        them on debugfs.
 -
  source "arch/x86/xen/Kconfig"
  
  config KVM_GUEST
@@@ -1485,7 -1499,7 +1485,7 @@@ config X86_CPA_STATISTIC
        depends on DEBUG_FS
        ---help---
          Expose statistics about the Change Page Attribute mechanims, which
 -        helps to determine the effectivness of preserving large and huge
 +        helps to determine the effectiveness of preserving large and huge
          page mappings when mapping protections are changed.
  
  config ARCH_HAS_MEM_ENCRYPT
@@@ -2864,6 -2878,11 +2864,6 @@@ config HAVE_ATOMIC_IOMA
  
  config X86_DEV_DMA_OPS
        bool
 -      depends on X86_64 || STA2X11
 -
 -config X86_DMA_REMAP
 -      bool
 -      depends on STA2X11
  
  config HAVE_GENERIC_GUP
        def_bool y
@@@ -298,7 -298,7 +298,7 @@@ ENTRY(__switch_to_asm
  
  #ifdef CONFIG_STACKPROTECTOR
        movq    TASK_stack_canary(%rsi), %rbx
-       movq    %rbx, PER_CPU_VAR(irq_stack_union)+stack_canary_offset
+       movq    %rbx, PER_CPU_VAR(fixed_percpu_data) + stack_canary_offset
  #endif
  
  #ifdef CONFIG_RETPOLINE
@@@ -430,8 -430,8 +430,8 @@@ END(irq_entries_start
         * it before we actually move ourselves to the IRQ stack.
         */
  
-       movq    \old_rsp, PER_CPU_VAR(irq_stack_union + IRQ_STACK_SIZE - 8)
-       movq    PER_CPU_VAR(irq_stack_ptr), %rsp
+       movq    \old_rsp, PER_CPU_VAR(irq_stack_backing_store + IRQ_STACK_SIZE - 8)
+       movq    PER_CPU_VAR(hardirq_stack_ptr), %rsp
  
  #ifdef CONFIG_DEBUG_ENTRY
        /*
@@@ -645,9 -645,10 +645,9 @@@ retint_kernel
        /* Check if we need preemption */
        btl     $9, EFLAGS(%rsp)                /* were interrupts off? */
        jnc     1f
 -0:    cmpl    $0, PER_CPU_VAR(__preempt_count)
 +      cmpl    $0, PER_CPU_VAR(__preempt_count)
        jnz     1f
        call    preempt_schedule_irq
 -      jmp     0b
  1:
  #endif
        /*
@@@ -840,7 -841,7 +840,7 @@@ apicinterrupt IRQ_WORK_VECTOR                      irq_wor
  /*
   * Exception entry points.
   */
- #define CPU_TSS_IST(x) PER_CPU_VAR(cpu_tss_rw) + (TSS_ist + ((x) - 1) * 8)
+ #define CPU_TSS_IST(x) PER_CPU_VAR(cpu_tss_rw) + (TSS_ist + (x) * 8)
  
  /**
   * idtentry - Generate an IDT entry stub
   * @paranoid == 2 is special: the stub will never switch stacks.  This is for
   * #DF: if the thread stack is somehow unusable, we'll still get a useful OOPS.
   */
- .macro idtentry sym do_sym has_error_code:req paranoid=0 shift_ist=-1
+ .macro idtentry sym do_sym has_error_code:req paranoid=0 shift_ist=-1 ist_offset=0
  ENTRY(\sym)
        UNWIND_HINT_IRET_REGS offset=\has_error_code*8
  
        .endif
  
        .if \shift_ist != -1
-       subq    $EXCEPTION_STKSZ, CPU_TSS_IST(\shift_ist)
+       subq    $\ist_offset, CPU_TSS_IST(\shift_ist)
        .endif
  
        call    \do_sym
  
        .if \shift_ist != -1
-       addq    $EXCEPTION_STKSZ, CPU_TSS_IST(\shift_ist)
+       addq    $\ist_offset, CPU_TSS_IST(\shift_ist)
        .endif
  
        /* these procedures expect "no swapgs" flag in ebx */
@@@ -1128,7 -1129,7 +1128,7 @@@ apicinterrupt3 HYPERV_STIMER0_VECTOR 
        hv_stimer0_callback_vector hv_stimer0_vector_handler
  #endif /* CONFIG_HYPERV */
  
- idtentry debug                        do_debug                has_error_code=0        paranoid=1 shift_ist=DEBUG_STACK
+ idtentry debug                        do_debug                has_error_code=0        paranoid=1 shift_ist=IST_INDEX_DB ist_offset=DB_STACK_OFFSET
  idtentry int3                 do_int3                 has_error_code=0
  idtentry stack_segment                do_stack_segment        has_error_code=1
  
@@@ -9,6 -9,8 +9,8 @@@
  
  #include <linux/uaccess.h>
  #include <linux/ptrace.h>
+ #include <asm/cpu_entry_area.h>
  #include <asm/switch_to.h>
  
  enum stack_type {
@@@ -98,6 -100,19 +100,6 @@@ struct stack_frame_ia32 
      u32 return_address;
  };
  
 -static inline unsigned long caller_frame_pointer(void)
 -{
 -      struct stack_frame *frame;
 -
 -      frame = __builtin_frame_address(0);
 -
 -#ifdef CONFIG_FRAME_POINTER
 -      frame = frame->next_frame;
 -#endif
 -
 -      return (unsigned long)frame;
 -}
 -
  void show_opcodes(struct pt_regs *regs, const char *loglvl);
  void show_ip(struct pt_regs *regs, const char *loglvl);
  #endif /* _ASM_X86_STACKTRACE_H */
@@@ -507,19 -507,6 +507,6 @@@ void load_percpu_segment(int cpu
  DEFINE_PER_CPU(struct cpu_entry_area *, cpu_entry_area);
  #endif
  
- #ifdef CONFIG_X86_64
- /*
-  * Special IST stacks which the CPU switches to when it calls
-  * an IST-marked descriptor entry. Up to 7 stacks (hardware
-  * limit), all of them are 4K, except the debug stack which
-  * is 8K.
-  */
- static const unsigned int exception_stack_sizes[N_EXCEPTION_STACKS] = {
-         [0 ... N_EXCEPTION_STACKS - 1]        = EXCEPTION_STKSZ,
-         [DEBUG_STACK - 1]                     = DEBUG_STKSZ
- };
- #endif
  /* Load the original GDT from the per-cpu structure */
  void load_direct_gdt(int cpu)
  {
@@@ -1511,9 -1498,9 +1498,9 @@@ static __init int setup_clearcpuid(cha
  __setup("clearcpuid=", setup_clearcpuid);
  
  #ifdef CONFIG_X86_64
- DEFINE_PER_CPU_FIRST(union irq_stack_union,
-                    irq_stack_union) __aligned(PAGE_SIZE) __visible;
- EXPORT_PER_CPU_SYMBOL_GPL(irq_stack_union);
+ DEFINE_PER_CPU_FIRST(struct fixed_percpu_data,
+                    fixed_percpu_data) __aligned(PAGE_SIZE) __visible;
+ EXPORT_PER_CPU_SYMBOL_GPL(fixed_percpu_data);
  
  /*
   * The following percpu variables are hot.  Align current_task to
@@@ -1523,9 -1510,7 +1510,7 @@@ DEFINE_PER_CPU(struct task_struct *, cu
        &init_task;
  EXPORT_PER_CPU_SYMBOL(current_task);
  
- DEFINE_PER_CPU(char *, irq_stack_ptr) =
-       init_per_cpu_var(irq_stack_union.irq_stack) + IRQ_STACK_SIZE;
+ DEFINE_PER_CPU(struct irq_stack *, hardirq_stack_ptr);
  DEFINE_PER_CPU(unsigned int, irq_count) __visible = -1;
  
  DEFINE_PER_CPU(int, __preempt_count) = INIT_PREEMPT_COUNT;
@@@ -1562,23 -1547,7 +1547,7 @@@ void syscall_init(void
               X86_EFLAGS_IOPL|X86_EFLAGS_AC|X86_EFLAGS_NT);
  }
  
- /*
-  * Copies of the original ist values from the tss are only accessed during
-  * debugging, no special alignment required.
-  */
- DEFINE_PER_CPU(struct orig_ist, orig_ist);
- static DEFINE_PER_CPU(unsigned long, debug_stack_addr);
  DEFINE_PER_CPU(int, debug_stack_usage);
- int is_debug_stack(unsigned long addr)
- {
-       return __this_cpu_read(debug_stack_usage) ||
-               (addr <= __this_cpu_read(debug_stack_addr) &&
-                addr > (__this_cpu_read(debug_stack_addr) - DEBUG_STKSZ));
- }
- NOKPROBE_SYMBOL(is_debug_stack);
  DEFINE_PER_CPU(u32, debug_idt_ctr);
  
  void debug_stack_set_zero(void)
@@@ -1668,7 -1637,7 +1637,7 @@@ static void setup_getcpu(int cpu
        unsigned long cpudata = vdso_encode_cpunode(cpu, early_cpu_to_node(cpu));
        struct desc_struct d = { };
  
 -      if (static_cpu_has(X86_FEATURE_RDTSCP))
 +      if (boot_cpu_has(X86_FEATURE_RDTSCP))
                write_rdtscp_aux(cpudata);
  
        /* Store CPU and node number in limit. */
   * initialized (naturally) in the bootstrap process, such as the GDT
   * and IDT. We reload them nevertheless, this function acts as a
   * 'CPU state barrier', nothing should get across.
-  * A lot of state is already set up in PDA init for 64 bit
   */
  #ifdef CONFIG_X86_64
  
  void cpu_init(void)
  {
-       struct orig_ist *oist;
+       int cpu = raw_smp_processor_id();
        struct task_struct *me;
        struct tss_struct *t;
-       unsigned long v;
-       int cpu = raw_smp_processor_id();
        int i;
  
        wait_for_master_cpu(cpu);
                load_ucode_ap();
  
        t = &per_cpu(cpu_tss_rw, cpu);
-       oist = &per_cpu(orig_ist, cpu);
  
  #ifdef CONFIG_NUMA
        if (this_cpu_read(numa_node) == 0 &&
        /*
         * set up and load the per-CPU TSS
         */
-       if (!oist->ist[0]) {
-               char *estacks = get_cpu_entry_area(cpu)->exception_stacks;
-               for (v = 0; v < N_EXCEPTION_STACKS; v++) {
-                       estacks += exception_stack_sizes[v];
-                       oist->ist[v] = t->x86_tss.ist[v] =
-                                       (unsigned long)estacks;
-                       if (v == DEBUG_STACK-1)
-                               per_cpu(debug_stack_addr, cpu) = (unsigned long)estacks;
-               }
+       if (!t->x86_tss.ist[0]) {
+               t->x86_tss.ist[IST_INDEX_DF] = __this_cpu_ist_top_va(DF);
+               t->x86_tss.ist[IST_INDEX_NMI] = __this_cpu_ist_top_va(NMI);
+               t->x86_tss.ist[IST_INDEX_DB] = __this_cpu_ist_top_va(DB);
+               t->x86_tss.ist[IST_INDEX_MCE] = __this_cpu_ist_top_va(MCE);
        }
  
        t->x86_tss.io_bitmap_base = IO_BITMAP_OFFSET;
@@@ -362,7 -362,7 +362,7 @@@ SECTION
        .bss : AT(ADDR(.bss) - LOAD_OFFSET) {
                __bss_start = .;
                *(.bss..page_aligned)
 -              *(.bss)
 +              *(BSS_MAIN)
                BSS_DECRYPTED
                . = ALIGN(PAGE_SIZE);
                __bss_stop = .;
   */
  #define INIT_PER_CPU(x) init_per_cpu__##x = ABSOLUTE(x) + __per_cpu_load
  INIT_PER_CPU(gdt_page);
- INIT_PER_CPU(irq_stack_union);
+ INIT_PER_CPU(fixed_percpu_data);
+ INIT_PER_CPU(irq_stack_backing_store);
  
  /*
   * Build-time check on the image size:
           "kernel image bigger than KERNEL_IMAGE_SIZE");
  
  #ifdef CONFIG_SMP
- . = ASSERT((irq_stack_union == 0),
-            "irq_stack_union is not at start of per-cpu area");
+ . = ASSERT((fixed_percpu_data == 0),
+            "fixed_percpu_data is not at start of per-cpu area");
  #endif
  
  #endif /* CONFIG_X86_32 */
diff --combined arch/x86/tools/relocs.c
@@@ -11,9 -11,7 +11,9 @@@
  #define Elf_Shdr              ElfW(Shdr)
  #define Elf_Sym                       ElfW(Sym)
  
 -static Elf_Ehdr ehdr;
 +static Elf_Ehdr               ehdr;
 +static unsigned long  shnum;
 +static unsigned int   shstrndx;
  
  struct relocs {
        uint32_t        *offset;
@@@ -243,9 -241,9 +243,9 @@@ static const char *sec_name(unsigned sh
  {
        const char *sec_strtab;
        const char *name;
 -      sec_strtab = secs[ehdr.e_shstrndx].strtab;
 +      sec_strtab = secs[shstrndx].strtab;
        name = "<noname>";
 -      if (shndx < ehdr.e_shnum) {
 +      if (shndx < shnum) {
                name = sec_strtab + secs[shndx].shdr.sh_name;
        }
        else if (shndx == SHN_ABS) {
@@@ -273,7 -271,7 +273,7 @@@ static const char *sym_name(const char 
  static Elf_Sym *sym_lookup(const char *symname)
  {
        int i;
 -      for (i = 0; i < ehdr.e_shnum; i++) {
 +      for (i = 0; i < shnum; i++) {
                struct section *sec = &secs[i];
                long nsyms;
                char *strtab;
@@@ -368,41 -366,27 +368,41 @@@ static void read_ehdr(FILE *fp
        ehdr.e_shnum     = elf_half_to_cpu(ehdr.e_shnum);
        ehdr.e_shstrndx  = elf_half_to_cpu(ehdr.e_shstrndx);
  
 -      if ((ehdr.e_type != ET_EXEC) && (ehdr.e_type != ET_DYN)) {
 +      shnum = ehdr.e_shnum;
 +      shstrndx = ehdr.e_shstrndx;
 +
 +      if ((ehdr.e_type != ET_EXEC) && (ehdr.e_type != ET_DYN))
                die("Unsupported ELF header type\n");
 -      }
 -      if (ehdr.e_machine != ELF_MACHINE) {
 +      if (ehdr.e_machine != ELF_MACHINE)
                die("Not for %s\n", ELF_MACHINE_NAME);
 -      }
 -      if (ehdr.e_version != EV_CURRENT) {
 +      if (ehdr.e_version != EV_CURRENT)
                die("Unknown ELF version\n");
 -      }
 -      if (ehdr.e_ehsize != sizeof(Elf_Ehdr)) {
 +      if (ehdr.e_ehsize != sizeof(Elf_Ehdr))
                die("Bad Elf header size\n");
 -      }
 -      if (ehdr.e_phentsize != sizeof(Elf_Phdr)) {
 +      if (ehdr.e_phentsize != sizeof(Elf_Phdr))
                die("Bad program header entry\n");
 -      }
 -      if (ehdr.e_shentsize != sizeof(Elf_Shdr)) {
 +      if (ehdr.e_shentsize != sizeof(Elf_Shdr))
                die("Bad section header entry\n");
 +
 +
 +      if (shnum == SHN_UNDEF || shstrndx == SHN_XINDEX) {
 +              Elf_Shdr shdr;
 +
 +              if (fseek(fp, ehdr.e_shoff, SEEK_SET) < 0)
 +                      die("Seek to %d failed: %s\n", ehdr.e_shoff, strerror(errno));
 +
 +              if (fread(&shdr, sizeof(shdr), 1, fp) != 1)
 +                      die("Cannot read initial ELF section header: %s\n", strerror(errno));
 +
 +              if (shnum == SHN_UNDEF)
 +                      shnum = elf_xword_to_cpu(shdr.sh_size);
 +
 +              if (shstrndx == SHN_XINDEX)
 +                      shstrndx = elf_word_to_cpu(shdr.sh_link);
        }
 -      if (ehdr.e_shstrndx >= ehdr.e_shnum) {
 +
 +      if (shstrndx >= shnum)
                die("String table index out of bounds\n");
 -      }
  }
  
  static void read_shdrs(FILE *fp)
        int i;
        Elf_Shdr shdr;
  
 -      secs = calloc(ehdr.e_shnum, sizeof(struct section));
 +      secs = calloc(shnum, sizeof(struct section));
        if (!secs) {
                die("Unable to allocate %d section headers\n",
 -                  ehdr.e_shnum);
 +                  shnum);
        }
        if (fseek(fp, ehdr.e_shoff, SEEK_SET) < 0) {
                die("Seek to %d failed: %s\n",
                        ehdr.e_shoff, strerror(errno));
        }
 -      for (i = 0; i < ehdr.e_shnum; i++) {
 +      for (i = 0; i < shnum; i++) {
                struct section *sec = &secs[i];
                if (fread(&shdr, sizeof(shdr), 1, fp) != 1)
                        die("Cannot read ELF section headers %d/%d: %s\n",
 -                          i, ehdr.e_shnum, strerror(errno));
 +                          i, shnum, strerror(errno));
                sec->shdr.sh_name      = elf_word_to_cpu(shdr.sh_name);
                sec->shdr.sh_type      = elf_word_to_cpu(shdr.sh_type);
                sec->shdr.sh_flags     = elf_xword_to_cpu(shdr.sh_flags);
                sec->shdr.sh_info      = elf_word_to_cpu(shdr.sh_info);
                sec->shdr.sh_addralign = elf_xword_to_cpu(shdr.sh_addralign);
                sec->shdr.sh_entsize   = elf_xword_to_cpu(shdr.sh_entsize);
 -              if (sec->shdr.sh_link < ehdr.e_shnum)
 +              if (sec->shdr.sh_link < shnum)
                        sec->link = &secs[sec->shdr.sh_link];
        }
  
  static void read_strtabs(FILE *fp)
  {
        int i;
 -      for (i = 0; i < ehdr.e_shnum; i++) {
 +      for (i = 0; i < shnum; i++) {
                struct section *sec = &secs[i];
                if (sec->shdr.sh_type != SHT_STRTAB) {
                        continue;
  static void read_symtabs(FILE *fp)
  {
        int i,j;
 -      for (i = 0; i < ehdr.e_shnum; i++) {
 +      for (i = 0; i < shnum; i++) {
                struct section *sec = &secs[i];
                if (sec->shdr.sh_type != SHT_SYMTAB) {
                        continue;
  static void read_relocs(FILE *fp)
  {
        int i,j;
 -      for (i = 0; i < ehdr.e_shnum; i++) {
 +      for (i = 0; i < shnum; i++) {
                struct section *sec = &secs[i];
                if (sec->shdr.sh_type != SHT_REL_TYPE) {
                        continue;
@@@ -544,7 -528,7 +544,7 @@@ static void print_absolute_symbols(void
  
        printf("Absolute symbols\n");
        printf(" Num:    Value Size  Type       Bind        Visibility  Name\n");
 -      for (i = 0; i < ehdr.e_shnum; i++) {
 +      for (i = 0; i < shnum; i++) {
                struct section *sec = &secs[i];
                char *sym_strtab;
                int j;
@@@ -582,7 -566,7 +582,7 @@@ static void print_absolute_relocs(void
        else
                format = "%08"PRIx32" %08"PRIx32" %10s %08"PRIx32"  %s\n";
  
 -      for (i = 0; i < ehdr.e_shnum; i++) {
 +      for (i = 0; i < shnum; i++) {
                struct section *sec = &secs[i];
                struct section *sec_applies, *sec_symtab;
                char *sym_strtab;
@@@ -666,7 -650,7 +666,7 @@@ static void walk_relocs(int (*process)(
  {
        int i;
        /* Walk through the relocations */
 -      for (i = 0; i < ehdr.e_shnum; i++) {
 +      for (i = 0; i < shnum; i++) {
                char *sym_strtab;
                Elf_Sym *sh_symtab;
                struct section *sec_applies, *sec_symtab;
@@@ -722,7 -706,7 +722,7 @@@ static Elf_Addr per_cpu_load_addr
  static void percpu_init(void)
  {
        int i;
 -      for (i = 0; i < ehdr.e_shnum; i++) {
 +      for (i = 0; i < shnum; i++) {
                ElfW(Sym) *sym;
                if (strcmp(sec_name(i), ".data..percpu"))
                        continue;
   *    __per_cpu_load
   *
   * The "gold" linker incorrectly associates:
-  *    init_per_cpu__irq_stack_union
+  *    init_per_cpu__fixed_percpu_data
   *    init_per_cpu__gdt_page
   */
  static int is_percpu_sym(ElfW(Sym) *sym, const char *symname)
diff --combined mm/slab.c
+++ b/mm/slab.c
@@@ -1467,53 -1467,17 +1467,17 @@@ static bool is_debug_pagealloc_cache(st
  }
  
  #ifdef CONFIG_DEBUG_PAGEALLOC
- static void store_stackinfo(struct kmem_cache *cachep, unsigned long *addr,
-                           unsigned long caller)
- {
-       int size = cachep->object_size;
-       addr = (unsigned long *)&((char *)addr)[obj_offset(cachep)];
-       if (size < 5 * sizeof(unsigned long))
-               return;
-       *addr++ = 0x12345678;
-       *addr++ = caller;
-       *addr++ = smp_processor_id();
-       size -= 3 * sizeof(unsigned long);
-       {
-               unsigned long *sptr = &caller;
-               unsigned long svalue;
-               while (!kstack_end(sptr)) {
-                       svalue = *sptr++;
-                       if (kernel_text_address(svalue)) {
-                               *addr++ = svalue;
-                               size -= sizeof(unsigned long);
-                               if (size <= sizeof(unsigned long))
-                                       break;
-                       }
-               }
-       }
-       *addr++ = 0x87654321;
- }
- static void slab_kernel_map(struct kmem_cache *cachep, void *objp,
-                               int map, unsigned long caller)
+ static void slab_kernel_map(struct kmem_cache *cachep, void *objp, int map)
  {
        if (!is_debug_pagealloc_cache(cachep))
                return;
  
-       if (caller)
-               store_stackinfo(cachep, objp, caller);
        kernel_map_pages(virt_to_page(objp), cachep->size / PAGE_SIZE, map);
  }
  
  #else
  static inline void slab_kernel_map(struct kmem_cache *cachep, void *objp,
-                               int map, unsigned long caller) {}
+                               int map) {}
  
  #endif
  
@@@ -1661,7 -1625,7 +1625,7 @@@ static void slab_destroy_debugcheck(str
  
                if (cachep->flags & SLAB_POISON) {
                        check_poison_obj(cachep, objp);
-                       slab_kernel_map(cachep, objp, 1, 0);
+                       slab_kernel_map(cachep, objp, 1);
                }
                if (cachep->flags & SLAB_RED_ZONE) {
                        if (*dbg_redzone1(cachep, objp) != RED_INACTIVE)
@@@ -2374,6 -2338,7 +2338,6 @@@ static void *alloc_slabmgmt(struct kmem
                /* Slab management obj is off-slab. */
                freelist = kmem_cache_alloc_node(cachep->freelist_cache,
                                              local_flags, nodeid);
 -              freelist = kasan_reset_tag(freelist);
                if (!freelist)
                        return NULL;
        } else {
@@@ -2433,7 -2398,7 +2397,7 @@@ static void cache_init_objs_debug(struc
                /* need to poison the objs? */
                if (cachep->flags & SLAB_POISON) {
                        poison_obj(cachep, objp, POISON_FREE);
-                       slab_kernel_map(cachep, objp, 0, 0);
+                       slab_kernel_map(cachep, objp, 0);
                }
        }
  #endif
@@@ -2812,7 -2777,7 +2776,7 @@@ static void *cache_free_debugcheck(stru
  
        if (cachep->flags & SLAB_POISON) {
                poison_obj(cachep, objp, POISON_FREE);
-               slab_kernel_map(cachep, objp, 0, caller);
+               slab_kernel_map(cachep, objp, 0);
        }
        return objp;
  }
@@@ -3076,7 -3041,7 +3040,7 @@@ static void *cache_alloc_debugcheck_aft
                return objp;
        if (cachep->flags & SLAB_POISON) {
                check_poison_obj(cachep, objp);
-               slab_kernel_map(cachep, objp, 1, 0);
+               slab_kernel_map(cachep, objp, 1);
                poison_obj(cachep, objp, POISON_INUSE);
        }
        if (cachep->flags & SLAB_STORE_USER)