Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/livep...
authorLinus Torvalds <torvalds@linux-foundation.org>
Tue, 23 Jun 2015 21:07:26 +0000 (14:07 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Tue, 23 Jun 2015 21:07:26 +0000 (14:07 -0700)
Pull livepatching fixes from Jiri Kosina:

 - symbol lookup locking fix, from Miroslav Benes

 - error handling improvements in case of failure of the module coming
   notifier, from Minfei Huang

 - we were too pessimistic when kASLR has been enabled on x86 and were
   dropping address hints on the floor unnecessarily in such case.  Fix
   from Jiri Kosina

 - a few other small fixes and cleanups

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/livepatching:
  livepatch: add module locking around kallsyms calls
  livepatch: annotate klp_init() with __init
  livepatch: introduce patch/func-walking helpers
  livepatch: make kobject in klp_object statically allocated
  livepatch: Prevent patch inconsistencies if the coming module notifier fails
  livepatch: match return value to function signature
  x86: kaslr: fix build due to missing ALIGN definition
  livepatch: x86: make kASLR logic more accurate
  x86: introduce kaslr_offset()

1  2 
arch/x86/kernel/machine_kexec_64.c
arch/x86/kernel/setup.c

@@@ -17,7 -17,6 +17,7 @@@
  #include <linux/ftrace.h>
  #include <linux/io.h>
  #include <linux/suspend.h>
 +#include <linux/vmalloc.h>
  
  #include <asm/init.h>
  #include <asm/pgtable.h>
@@@ -26,6 -25,7 +26,7 @@@
  #include <asm/io_apic.h>
  #include <asm/debugreg.h>
  #include <asm/kexec-bzimage64.h>
+ #include <asm/setup.h>
  
  #ifdef CONFIG_KEXEC_FILE
  static struct kexec_file_ops *kexec_file_loaders[] = {
@@@ -335,7 -335,7 +336,7 @@@ void arch_crash_save_vmcoreinfo(void
        VMCOREINFO_LENGTH(node_data, MAX_NUMNODES);
  #endif
        vmcoreinfo_append_str("KERNELOFFSET=%lx\n",
-                             (unsigned long)&_text - __START_KERNEL);
+                             kaslr_offset());
  }
  
  /* arch-dependent functionality related to kexec file-based syscall */
diff --combined arch/x86/kernel/setup.c
@@@ -531,14 -531,12 +531,14 @@@ static void __init reserve_crashkernel_
        if (ret != 0) {
                /*
                 * two parts from lib/swiotlb.c:
 -               *      swiotlb size: user specified with swiotlb= or default.
 -               *      swiotlb overflow buffer: now is hardcoded to 32k.
 -               *              We round it to 8M for other buffers that
 -               *              may need to stay low too.
 +               * -swiotlb size: user-specified with swiotlb= or default.
 +               *
 +               * -swiotlb overflow buffer: now hardcoded to 32k. We round it
 +               * to 8M for other buffers that may need to stay low too. Also
 +               * make sure we allocate enough extra low memory so that we
 +               * don't run out of DMA buffers for 32-bit devices.
                 */
 -              low_size = swiotlb_size_or_default() + (8UL<<20);
 +              low_size = max(swiotlb_size_or_default() + (8UL<<20), 256UL<<20);
                auto_set = true;
        } else {
                /* passed with crashkernel=0,low ? */
@@@ -836,7 -834,7 +836,7 @@@ dump_kernel_offset(struct notifier_bloc
  {
        if (kaslr_enabled()) {
                pr_emerg("Kernel Offset: 0x%lx from 0x%lx (relocation range: 0x%lx-0x%lx)\n",
-                        (unsigned long)&_text - __START_KERNEL,
+                        kaslr_offset(),
                         __START_KERNEL,
                         __START_KERNEL_map,
                         MODULES_VADDR-1);
@@@ -1224,7 -1222,8 +1224,7 @@@ void __init setup_arch(char **cmdline_p
        init_cpu_to_node();
  
        init_apic_mappings();
 -      if (x86_io_apic_ops.init)
 -              x86_io_apic_ops.init();
 +      io_apic_init_mappings();
  
        kvm_guest_init();