]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
Merge branch 'x86-kaslr-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git...
authorLinus Torvalds <torvalds@linux-foundation.org>
Mon, 20 Jan 2014 22:45:50 +0000 (14:45 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Mon, 20 Jan 2014 22:45:50 +0000 (14:45 -0800)
Pull x86 kernel address space randomization support from Peter Anvin:
 "This enables kernel address space randomization for x86"

* 'x86-kaslr-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  x86, kaslr: Clarify RANDOMIZE_BASE_MAX_OFFSET
  x86, kaslr: Remove unused including <linux/version.h>
  x86, kaslr: Use char array to gain sizeof sanity
  x86, kaslr: Add a circular multiply for better bit diffusion
  x86, kaslr: Mix entropy sources together as needed
  x86/relocs: Add percpu fixup for GNU ld 2.23
  x86, boot: Rename get_flags() and check_flags() to *_cpuflags()
  x86, kaslr: Raise the maximum virtual address to -1 GiB on x86_64
  x86, kaslr: Report kernel offset on panic
  x86, kaslr: Select random position from e820 maps
  x86, kaslr: Provide randomness functions
  x86, kaslr: Return location from decompress_kernel
  x86, boot: Move CPU flags out of cpucheck
  x86, relocs: Add more per-cpu gold special cases

1  2 
Documentation/kernel-parameters.txt
arch/x86/Kconfig
arch/x86/boot/Makefile
arch/x86/boot/compressed/Makefile
arch/x86/kernel/setup.c

index 092cfd1390658d2aaf132cd89d991c0f49665958,773fc4c077b4d8ac51d91f149ee83b519861bcab..4252af6ffda18da2559054fdb9b42316afe6e891
@@@ -774,15 -774,6 +774,15 @@@ bytes respectively. Such letter suffixe
        disable=        [IPV6]
                        See Documentation/networking/ipv6.txt.
  
 +      disable_cpu_apicid= [X86,APIC,SMP]
 +                      Format: <int>
 +                      The number of initial APIC ID for the
 +                      corresponding CPU to be disabled at boot,
 +                      mostly used for the kdump 2nd kernel to
 +                      disable BSP to wake up multiple CPUs without
 +                      causing system reset or hang due to sending
 +                      INIT from AP to BSP.
 +
        disable_ddw     [PPC/PSERIES]
                        Disable Dynamic DMA Window support. Use this if
                        to workaround buggy firmware.
  
        earlyprintk=    [X86,SH,BLACKFIN,ARM]
                        earlyprintk=vga
 +                      earlyprintk=efi
                        earlyprintk=xen
                        earlyprintk=serial[,ttySn[,baudrate]]
                        earlyprintk=serial[,0x...[,baudrate]]
                        Append ",keep" to not disable it when the real console
                        takes over.
  
 -                      Only vga or serial or usb debug port at a time.
 +                      Only one of vga, efi, serial, or usb debug port can
 +                      be used at a time.
  
                        Currently only ttyS0 and ttyS1 may be specified by
                        name.  Other I/O ports may be explicitly specified
                        Interaction with the standard serial driver is not
                        very good.
  
 -                      The VGA output is eventually overwritten by the real
 -                      console.
 +                      The VGA and EFI output is eventually overwritten by
 +                      the real console.
  
                        The xen output can only be used by Xen PV guests.
  
 +      edac_report=    [HW,EDAC] Control how to report EDAC event
 +                      Format: {"on" | "off" | "force"}
 +                      on: enable EDAC to report H/W event. May be overridden
 +                      by other higher priority error reporting module.
 +                      off: disable H/W event reporting through EDAC.
 +                      force: enforce the use of EDAC to report H/W event.
 +                      default: on.
 +
        ekgdboc=        [X86,KGDB] Allow early kernel console debugging
                        ekgdboc=kbd
  
        edd=            [EDD]
                        Format: {"off" | "on" | "skip[mbr]"}
  
 +      efi=            [EFI]
 +                      Format: { "old_map" }
 +                      old_map [X86-64]: switch to the old ioremap-based EFI
 +                      runtime services mapping. 32-bit still uses this one by
 +                      default.
 +
        efi_no_storage_paranoia [EFI; X86]
                        Using this parameter you can use more than 50% of
                        your efi variable storage. Use this parameter only if
                                VIA, nVidia)
                        verbose: show contents of HPET registers during setup
  
 +      hpet_mmap=      [X86, HPET_MMAP] Allow userspace to mmap HPET
 +                      registers.  Default set by CONFIG_HPET_MMAP_DEFAULT.
 +
        hugepages=      [HW,X86-32,IA-64] HugeTLB pages to allocate at boot.
        hugepagesz=     [HW,IA-64,PPC,X86-64] The size of the HugeTLB pages.
                        On x86-64 and powerpc, this option can be specified
                        owned by uid=0.
  
        ima_hash=       [IMA]
 -                      Format: { "sha1" | "md5" }
 +                      Format: { md5 | sha1 | rmd160 | sha256 | sha384
 +                                 | sha512 | ... }
                        default: "sha1"
  
 +                      The list of supported hash algorithms is defined
 +                      in crypto/hash_info.h.
 +
        ima_tcb         [IMA]
                        Load a policy which meets the needs of the Trusted
                        Computing Base.  This means IMA will measure all
                        programs exec'd, files mmap'd for exec, and all files
                        opened for read by uid=0.
  
 +      ima_template=   [IMA]
 +                      Select one of defined IMA measurements template formats.
 +                      Formats: { "ima" | "ima-ng" }
 +                      Default: "ima-ng"
 +
        init=           [KNL]
                        Format: <full_path>
                        Run specified binary instead of /sbin/init as init
  
                        * atapi_dmadir: Enable ATAPI DMADIR bridge support
  
 +                      * disable: Disable this device.
 +
                        If there are multiple matching configurations changing
                        the same attribute, the last one is used.
  
                        that the amount of memory usable for all allocations
                        is not too small.
  
 +      movable_node    [KNL,X86] Boot-time switch to enable the effects
 +                      of CONFIG_MOVABLE_NODE=y. See mm/Kconfig for details.
 +
        MTD_Partition=  [MTD]
                        Format: <name>,<region-number>,<size>,<offset>
  
        noapic          [SMP,APIC] Tells the kernel to not make use of any
                        IOAPICs that may be present in the system.
  
+       nokaslr         [X86]
+                       Disable kernel base offset ASLR (Address Space
+                       Layout Randomization) if built into the kernel.
        noautogroup     Disable scheduler automatic task group creation.
  
        nobats          [PPC] Do not use BATs for mapping kernel lowmem
        ramdisk_size=   [RAM] Sizes of RAM disks in kilobytes
                        See Documentation/blockdev/ramdisk.txt.
  
 -      rcu_nocbs=      [KNL,BOOT]
 +      rcu_nocbs=      [KNL]
                        In kernels built with CONFIG_RCU_NOCB_CPU=y, set
                        the specified list of CPUs to be no-callback CPUs.
                        Invocation of these CPUs' RCU callbacks will
                        for RCU-preempt, and "s" for RCU-sched, and "N"
                        is the CPU number.  This reduces OS jitter on the
                        offloaded CPUs, which can be useful for HPC and
 -
                        real-time workloads.  It can also improve energy
                        efficiency for asymmetric multiprocessors.
  
 -      rcu_nocb_poll   [KNL,BOOT]
 +      rcu_nocb_poll   [KNL]
                        Rather than requiring that offloaded CPUs
                        (specified by rcu_nocbs= above) explicitly
                        awaken the corresponding "rcuoN" kthreads,
                        energy efficiency by requiring that the kthreads
                        periodically wake up to do the polling.
  
 -      rcutree.blimit= [KNL,BOOT]
 -                      Set maximum number of finished RCU callbacks to process
 -                      in one batch.
 +      rcutree.blimit= [KNL]
 +                      Set maximum number of finished RCU callbacks to
 +                      process in one batch.
  
 -      rcutree.fanout_leaf=    [KNL,BOOT]
 +      rcutree.rcu_fanout_leaf= [KNL]
                        Increase the number of CPUs assigned to each
                        leaf rcu_node structure.  Useful for very large
                        systems.
  
 -      rcutree.jiffies_till_first_fqs= [KNL,BOOT]
 +      rcutree.jiffies_till_first_fqs= [KNL]
                        Set delay from grace-period initialization to
                        first attempt to force quiescent states.
                        Units are jiffies, minimum value is zero,
                        and maximum value is HZ.
  
 -      rcutree.jiffies_till_next_fqs= [KNL,BOOT]
 +      rcutree.jiffies_till_next_fqs= [KNL]
                        Set delay between subsequent attempts to force
                        quiescent states.  Units are jiffies, minimum
                        value is one, and maximum value is HZ.
  
 -      rcutree.qhimark=        [KNL,BOOT]
 -                      Set threshold of queued
 -                      RCU callbacks over which batch limiting is disabled.
 +      rcutree.qhimark= [KNL]
 +                      Set threshold of queued RCU callbacks beyond which
 +                      batch limiting is disabled.
  
 -      rcutree.qlowmark=       [KNL,BOOT]
 +      rcutree.qlowmark= [KNL]
                        Set threshold of queued RCU callbacks below which
                        batch limiting is re-enabled.
  
 -      rcutree.rcu_cpu_stall_suppress= [KNL,BOOT]
 -                      Suppress RCU CPU stall warning messages.
 -
 -      rcutree.rcu_cpu_stall_timeout= [KNL,BOOT]
 -                      Set timeout for RCU CPU stall warning messages.
 -
 -      rcutree.rcu_idle_gp_delay=      [KNL,BOOT]
 +      rcutree.rcu_idle_gp_delay= [KNL]
                        Set wakeup interval for idle CPUs that have
                        RCU callbacks (RCU_FAST_NO_HZ=y).
  
 -      rcutree.rcu_idle_lazy_gp_delay= [KNL,BOOT]
 +      rcutree.rcu_idle_lazy_gp_delay= [KNL]
                        Set wakeup interval for idle CPUs that have
                        only "lazy" RCU callbacks (RCU_FAST_NO_HZ=y).
                        Lazy RCU callbacks are those which RCU can
                        prove do nothing more than free memory.
  
 -      rcutorture.fqs_duration= [KNL,BOOT]
 +      rcutorture.fqs_duration= [KNL]
                        Set duration of force_quiescent_state bursts.
  
 -      rcutorture.fqs_holdoff= [KNL,BOOT]
 +      rcutorture.fqs_holdoff= [KNL]
                        Set holdoff time within force_quiescent_state bursts.
  
 -      rcutorture.fqs_stutter= [KNL,BOOT]
 +      rcutorture.fqs_stutter= [KNL]
                        Set wait time between force_quiescent_state bursts.
  
 -      rcutorture.irqreader= [KNL,BOOT]
 -                      Test RCU readers from irq handlers.
 +      rcutorture.gp_exp= [KNL]
 +                      Use expedited update-side primitives.
  
 -      rcutorture.n_barrier_cbs= [KNL,BOOT]
 +      rcutorture.gp_normal= [KNL]
 +                      Use normal (non-expedited) update-side primitives.
 +                      If both gp_exp and gp_normal are set, do both.
 +                      If neither gp_exp nor gp_normal are set, still
 +                      do both.
 +
 +      rcutorture.n_barrier_cbs= [KNL]
                        Set callbacks/threads for rcu_barrier() testing.
  
 -      rcutorture.nfakewriters= [KNL,BOOT]
 +      rcutorture.nfakewriters= [KNL]
                        Set number of concurrent RCU writers.  These just
                        stress RCU, they don't participate in the actual
                        test, hence the "fake".
  
 -      rcutorture.nreaders= [KNL,BOOT]
 +      rcutorture.nreaders= [KNL]
                        Set number of RCU readers.
  
 -      rcutorture.onoff_holdoff= [KNL,BOOT]
 +      rcutorture.object_debug= [KNL]
 +                      Enable debug-object double-call_rcu() testing.
 +
 +      rcutorture.onoff_holdoff= [KNL]
                        Set time (s) after boot for CPU-hotplug testing.
  
 -      rcutorture.onoff_interval= [KNL,BOOT]
 +      rcutorture.onoff_interval= [KNL]
                        Set time (s) between CPU-hotplug operations, or
                        zero to disable CPU-hotplug testing.
  
 -      rcutorture.shuffle_interval= [KNL,BOOT]
 +      rcutorture.rcutorture_runnable= [BOOT]
 +                      Start rcutorture running at boot time.
 +
 +      rcutorture.shuffle_interval= [KNL]
                        Set task-shuffle interval (s).  Shuffling tasks
                        allows some CPUs to go into dyntick-idle mode
                        during the rcutorture test.
  
 -      rcutorture.shutdown_secs= [KNL,BOOT]
 +      rcutorture.shutdown_secs= [KNL]
                        Set time (s) after boot system shutdown.  This
                        is useful for hands-off automated testing.
  
 -      rcutorture.stall_cpu= [KNL,BOOT]
 +      rcutorture.stall_cpu= [KNL]
                        Duration of CPU stall (s) to test RCU CPU stall
                        warnings, zero to disable.
  
 -      rcutorture.stall_cpu_holdoff= [KNL,BOOT]
 +      rcutorture.stall_cpu_holdoff= [KNL]
                        Time to wait (s) after boot before inducing stall.
  
 -      rcutorture.stat_interval= [KNL,BOOT]
 +      rcutorture.stat_interval= [KNL]
                        Time (s) between statistics printk()s.
  
 -      rcutorture.stutter= [KNL,BOOT]
 +      rcutorture.stutter= [KNL]
                        Time (s) to stutter testing, for example, specifying
                        five seconds causes the test to run for five seconds,
                        wait for five seconds, and so on.  This tests RCU's
                        ability to transition abruptly to and from idle.
  
 -      rcutorture.test_boost= [KNL,BOOT]
 +      rcutorture.test_boost= [KNL]
                        Test RCU priority boosting?  0=no, 1=maybe, 2=yes.
                        "Maybe" means test if the RCU implementation
                        under test support RCU priority boosting.
  
 -      rcutorture.test_boost_duration= [KNL,BOOT]
 +      rcutorture.test_boost_duration= [KNL]
                        Duration (s) of each individual boost test.
  
 -      rcutorture.test_boost_interval= [KNL,BOOT]
 +      rcutorture.test_boost_interval= [KNL]
                        Interval (s) between each boost test.
  
 -      rcutorture.test_no_idle_hz= [KNL,BOOT]
 +      rcutorture.test_no_idle_hz= [KNL]
                        Test RCU's dyntick-idle handling.  See also the
                        rcutorture.shuffle_interval parameter.
  
 -      rcutorture.torture_type= [KNL,BOOT]
 +      rcutorture.torture_type= [KNL]
                        Specify the RCU implementation to test.
  
 -      rcutorture.verbose= [KNL,BOOT]
 +      rcutorture.verbose= [KNL]
                        Enable additional printk() statements.
  
 +      rcupdate.rcu_expedited= [KNL]
 +                      Use expedited grace-period primitives, for
 +                      example, synchronize_rcu_expedited() instead
 +                      of synchronize_rcu().  This reduces latency,
 +                      but can increase CPU utilization, degrade
 +                      real-time latency, and degrade energy efficiency.
 +
 +      rcupdate.rcu_cpu_stall_suppress= [KNL]
 +                      Suppress RCU CPU stall warning messages.
 +
 +      rcupdate.rcu_cpu_stall_timeout= [KNL]
 +                      Set timeout for RCU CPU stall warning messages.
 +
        rdinit=         [KNL]
                        Format: <full_path>
                        Run specified binary instead of /init from the ramdisk,
                        default x2apic cluster mode on platforms
                        supporting x2apic.
  
 -      x86_mrst_timer= [X86-32,APBT]
 -                      Choose timer option for x86 Moorestown MID platform.
 +      x86_intel_mid_timer= [X86-32,APBT]
 +                      Choose timer option for x86 Intel MID platform.
                        Two valid options are apbt timer only and lapic timer
                        plus one apbt timer for broadcast timer.
 -                      x86_mrst_timer=apbt_only | lapic_and_apbt
 +                      x86_intel_mid_timer=apbt_only | lapic_and_apbt
  
        xen_emul_unplug=                [HW,X86,XEN]
                        Unplug Xen emulated devices
diff --combined arch/x86/Kconfig
index 5216e283820dce4f2fc3ad91941ed863dcf0e093,5c9e19dccf2faf9e4c59bc114af437a7e7a64d60..cd18b8393400343aea897ef45de4d11610c05c10
@@@ -22,11 -22,9 +22,11 @@@ config X86_6
  config X86
        def_bool y
        select ARCH_HAS_DEBUG_STRICT_USER_COPY_CHECKS
 +      select ARCH_MIGHT_HAVE_PC_PARPORT
        select HAVE_AOUT if X86_32
        select HAVE_UNSTABLE_SCHED_CLOCK
        select ARCH_SUPPORTS_NUMA_BALANCING
 +      select ARCH_SUPPORTS_INT128 if X86_64
        select ARCH_WANTS_PROT_NUMA_PROT_NONE
        select HAVE_IDE
        select HAVE_OPROFILE
@@@ -92,6 -90,7 +92,6 @@@
        select GENERIC_IRQ_SHOW
        select GENERIC_CLOCKEVENTS_MIN_ADJUST
        select IRQ_FORCED_THREADING
 -      select USE_GENERIC_SMP_HELPERS if SMP
        select HAVE_BPF_JIT if X86_64
        select HAVE_ARCH_TRANSPARENT_HUGEPAGE
        select CLKEVT_I8253
        select COMPAT_OLD_SIGACTION if IA32_EMULATION
        select RTC_LIB
        select HAVE_DEBUG_STACKOVERFLOW
 +      select HAVE_IRQ_EXIT_ON_IRQ_STACK if X86_64
 +      select HAVE_CC_STACKPROTECTOR
  
  config INSTRUCTION_DECODER
        def_bool y
@@@ -257,6 -254,10 +257,6 @@@ config ARCH_HWEIGHT_CFLAG
        default "-fcall-saved-ecx -fcall-saved-edx" if X86_32
        default "-fcall-saved-rdi -fcall-saved-rsi -fcall-saved-rdx -fcall-saved-rcx -fcall-saved-r8 -fcall-saved-r9 -fcall-saved-r10 -fcall-saved-r11" if X86_64
  
 -config ARCH_CPU_PROBE_RELEASE
 -      def_bool y
 -      depends on HOTPLUG_CPU
 -
  config ARCH_SUPPORTS_UPROBES
        def_bool y
  
@@@ -439,26 -440,42 +439,26 @@@ config X86_INTEL_C
          This option compiles in support for the CE4100 SOC for settop
          boxes and media devices.
  
 -config X86_WANT_INTEL_MID
 +config X86_INTEL_MID
        bool "Intel MID platform support"
        depends on X86_32
        depends on X86_EXTENDED_PLATFORM
 -      ---help---
 -        Select to build a kernel capable of supporting Intel MID platform
 -        systems which do not have the PCI legacy interfaces (Moorestown,
 -        Medfield). If you are building for a PC class system say N here.
 -
 -if X86_WANT_INTEL_MID
 -
 -config X86_INTEL_MID
 -      bool
 -
 -config X86_MDFLD
 -       bool "Medfield MID platform"
        depends on PCI
        depends on PCI_GOANY
        depends on X86_IO_APIC
 -      select X86_INTEL_MID
        select SFI
 +      select I2C
        select DW_APB_TIMER
        select APB_TIMER
 -      select I2C
 -      select SPI
        select INTEL_SCU_IPC
 -      select X86_PLATFORM_DEVICES
        select MFD_INTEL_MSIC
        ---help---
 -        Medfield is Intel's Low Power Intel Architecture (LPIA) based Moblin
 -        Internet Device(MID) platform. 
 -        Unlike standard x86 PCs, Medfield does not have many legacy devices
 -        nor standard legacy replacement devices/features. e.g. Medfield does
 -        not contain i8259, i8254, HPET, legacy BIOS, most of the io ports.
 +        Select to build a kernel capable of supporting Intel MID (Mobile
 +        Internet Device) platform systems which do not have the PCI legacy
 +        interfaces. If you are building for a PC class system say N here.
  
 -endif
 +        Intel MID platforms are based on an Intel processor and chipset which
 +        consume less power than most of the x86 derivatives.
  
  config X86_INTEL_LPSS
        bool "Intel Low Power Subsystem Support"
@@@ -621,10 -638,10 +621,10 @@@ config PARAVIRT_SPINLOCK
          spinlock implementation with something virtualization-friendly
          (for example, block the virtual CPU rather than spinning).
  
 -        Unfortunately the downside is an up to 5% performance hit on
 -        native kernels, with various workloads.
 +        It has a minimal impact on native kernels and gives a nice performance
 +        benefit on paravirtualized KVM / Xen kernels.
  
 -        If you are unsure how to answer this question, answer N.
 +        If you are unsure how to answer this question, answer Y.
  
  source "arch/x86/xen/Kconfig"
  
@@@ -739,25 -756,20 +739,25 @@@ config DM
          BIOS code.
  
  config GART_IOMMU
 -      bool "GART IOMMU support" if EXPERT
 -      default y
 +      bool "Old AMD GART IOMMU support"
        select SWIOTLB
        depends on X86_64 && PCI && AMD_NB
        ---help---
 -        Support for full DMA access of devices with 32bit memory access only
 -        on systems with more than 3GB. This is usually needed for USB,
 -        sound, many IDE/SATA chipsets and some other devices.
 -        Provides a driver for the AMD Athlon64/Opteron/Turion/Sempron GART
 -        based hardware IOMMU and a software bounce buffer based IOMMU used
 -        on Intel systems and as fallback.
 -        The code is only active when needed (enough memory and limited
 -        device) unless CONFIG_IOMMU_DEBUG or iommu=force is specified
 -        too.
 +        Provides a driver for older AMD Athlon64/Opteron/Turion/Sempron
 +        GART based hardware IOMMUs.
 +
 +        The GART supports full DMA access for devices with 32-bit access
 +        limitations, on systems with more than 3 GB. This is usually needed
 +        for USB, sound, many IDE/SATA chipsets and some other devices.
 +
 +        Newer systems typically have a modern AMD IOMMU, supported via
 +        the CONFIG_AMD_IOMMU=y config option.
 +
 +        In normal configurations this driver is only active when needed:
 +        there's more than 3 GB of memory and the system contains a
 +        32-bit limited device.
 +
 +        If unsure, say Y.
  
  config CALGARY_IOMMU
        bool "IBM Calgary IOMMU support"
@@@ -813,16 -825,14 +813,16 @@@ config MAXSM
  config NR_CPUS
        int "Maximum number of CPUs" if SMP && !MAXSMP
        range 2 8 if SMP && X86_32 && !X86_BIGSMP
 -      range 2 512 if SMP && !MAXSMP
 +      range 2 512 if SMP && !MAXSMP && !CPUMASK_OFFSTACK
 +      range 2 8192 if SMP && !MAXSMP && CPUMASK_OFFSTACK && X86_64
        default "1" if !SMP
 -      default "4096" if MAXSMP
 +      default "8192" if MAXSMP
        default "32" if SMP && (X86_NUMAQ || X86_SUMMIT || X86_BIGSMP || X86_ES7000)
        default "8" if SMP
        ---help---
          This allows you to specify the maximum number of CPUs which this
 -        kernel will support.  The maximum supported value is 512 and the
 +        kernel will support.  If CPUMASK_OFFSTACK is enabled, the maximum
 +        supported value is 4096, otherwise the maximum value is 512.  The
          minimum value which makes sense is 2.
  
          This is purely to save memory - each supported CPU adds
@@@ -850,7 -860,7 +850,7 @@@ source "kernel/Kconfig.preempt
  
  config X86_UP_APIC
        bool "Local APIC support on uniprocessors"
 -      depends on X86_32 && !SMP && !X86_32_NON_STANDARD
 +      depends on X86_32 && !SMP && !X86_32_NON_STANDARD && !PCI_MSI
        ---help---
          A local APIC (Advanced Programmable Interrupt Controller) is an
          integrated interrupt controller in the CPU. If you have a single-CPU
@@@ -875,11 -885,11 +875,11 @@@ config X86_UP_IOAPI
  
  config X86_LOCAL_APIC
        def_bool y
 -      depends on X86_64 || SMP || X86_32_NON_STANDARD || X86_UP_APIC
 +      depends on X86_64 || SMP || X86_32_NON_STANDARD || X86_UP_APIC || PCI_MSI
  
  config X86_IO_APIC
        def_bool y
 -      depends on X86_64 || SMP || X86_32_NON_STANDARD || X86_UP_IOAPIC
 +      depends on X86_64 || SMP || X86_32_NON_STANDARD || X86_UP_IOAPIC || PCI_MSI
  
  config X86_VISWS_APIC
        def_bool y
@@@ -1023,7 -1033,6 +1023,7 @@@ config X86_REBOOTFIXUP
  
  config MICROCODE
        tristate "CPU microcode loading support"
 +      depends on CPU_SUP_AMD || CPU_SUP_INTEL
        select FW_LOADER
        ---help---
  
@@@ -1065,6 -1074,10 +1065,6 @@@ config MICROCODE_OLD_INTERFAC
        def_bool y
        depends on MICROCODE
  
 -config MICROCODE_INTEL_LIB
 -      def_bool y
 -      depends on MICROCODE_INTEL
 -
  config MICROCODE_INTEL_EARLY
        def_bool n
  
@@@ -1580,7 -1593,7 +1580,7 @@@ config EFI_STU
            This kernel feature allows a bzImage to be loaded directly
          by EFI firmware without the use of a bootloader.
  
 -        See Documentation/x86/efi-stub.txt for more information.
 +        See Documentation/efi-stub.txt for more information.
  
  config SECCOMP
        def_bool y
  
          If unsure, say Y. Only embedded should say N here.
  
 -config CC_STACKPROTECTOR
 -      bool "Enable -fstack-protector buffer overflow detection"
 -      ---help---
 -        This option turns on the -fstack-protector GCC feature. This
 -        feature puts, at the beginning of functions, a canary value on
 -        the stack just before the return address, and validates
 -        the value just before actually returning.  Stack based buffer
 -        overflows (that need to overwrite this return address) now also
 -        overwrite the canary, which gets detected and the attack is then
 -        neutralized via a kernel panic.
 -
 -        This feature requires gcc version 4.2 or above, or a distribution
 -        gcc with the feature backported. Older versions are automatically
 -        detected and for those versions, this configuration option is
 -        ignored. (and a warning is printed during bootup)
 -
  source kernel/Kconfig.hz
  
  config KEXEC
@@@ -1693,16 -1722,67 +1693,67 @@@ config RELOCATABL
  
          Note: If CONFIG_RELOCATABLE=y, then the kernel runs from the address
          it has been loaded at and the compile time physical address
-         (CONFIG_PHYSICAL_START) is ignored.
+         (CONFIG_PHYSICAL_START) is used as the minimum location.
  
- # Relocation on x86-32 needs some additional build support
+ config RANDOMIZE_BASE
+       bool "Randomize the address of the kernel image"
+       depends on RELOCATABLE
+       depends on !HIBERNATION
+       default n
+       ---help---
+          Randomizes the physical and virtual address at which the
+          kernel image is decompressed, as a security feature that
+          deters exploit attempts relying on knowledge of the location
+          of kernel internals.
+          Entropy is generated using the RDRAND instruction if it is
+          supported. If RDTSC is supported, it is used as well. If
+          neither RDRAND nor RDTSC are supported, then randomness is
+          read from the i8254 timer.
+          The kernel will be offset by up to RANDOMIZE_BASE_MAX_OFFSET,
+          and aligned according to PHYSICAL_ALIGN. Since the kernel is
+          built using 2GiB addressing, and PHYSICAL_ALGIN must be at a
+          minimum of 2MiB, only 10 bits of entropy is theoretically
+          possible. At best, due to page table layouts, 64-bit can use
+          9 bits of entropy and 32-bit uses 8 bits.
+          If unsure, say N.
+ config RANDOMIZE_BASE_MAX_OFFSET
+       hex "Maximum kASLR offset allowed" if EXPERT
+       depends on RANDOMIZE_BASE
+       range 0x0 0x20000000 if X86_32
+       default "0x20000000" if X86_32
+       range 0x0 0x40000000 if X86_64
+       default "0x40000000" if X86_64
+       ---help---
+         The lesser of RANDOMIZE_BASE_MAX_OFFSET and available physical
+         memory is used to determine the maximal offset in bytes that will
+         be applied to the kernel when kernel Address Space Layout
+         Randomization (kASLR) is active. This must be a multiple of
+         PHYSICAL_ALIGN.
+         On 32-bit this is limited to 512MiB by page table layouts. The
+         default is 512MiB.
+         On 64-bit this is limited by how the kernel fixmap page table is
+         positioned, so this cannot be larger than 1GiB currently. Without
+         RANDOMIZE_BASE, there is a 512MiB to 1.5GiB split between kernel
+         and modules. When RANDOMIZE_BASE_MAX_OFFSET is above 512MiB, the
+         modules area will shrink to compensate, up to the current maximum
+         1GiB to 1GiB split. The default is 1GiB.
+         If unsure, leave at the default value.
+ # Relocation on x86 needs some additional build support
  config X86_NEED_RELOCS
        def_bool y
-       depends on X86_32 && RELOCATABLE
+       depends on RANDOMIZE_BASE || (X86_32 && RELOCATABLE)
  
  config PHYSICAL_ALIGN
        hex "Alignment value to which kernel should be aligned"
-       default "0x1000000"
+       default "0x200000"
        range 0x2000 0x1000000 if X86_32
        range 0x200000 0x1000000 if X86_64
        ---help---
@@@ -1851,10 -1931,6 +1902,10 @@@ config USE_PERCPU_NUMA_NODE_I
        def_bool y
        depends on NUMA
  
 +config ARCH_ENABLE_SPLIT_PMD_PTLOCK
 +      def_bool y
 +      depends on X86_64 || X86_PAE
 +
  menu "Power management and ACPI options"
  
  config ARCH_HIBERNATION_HEADER
@@@ -2358,14 -2434,6 +2409,14 @@@ config X86_DMA_REMA
        bool
        depends on STA2X11
  
 +config IOSF_MBI
 +      bool
 +      depends on PCI
 +      ---help---
 +        To be selected by modules requiring access to the Intel OnChip System
 +        Fabric (IOSF) Sideband MailBox Interface (MBI). For MBI platforms
 +        enumerable by PCI.
 +
  source "net/Kconfig"
  
  source "drivers/Kconfig"
diff --combined arch/x86/boot/Makefile
index d9c11956fce0e9128bfa5432ee3c752f2acd4999,0da2e37b37c39a20e592f9cf6e0325e2f9940c70..de70669180052163de7a34a21e92302b4c50128e
@@@ -20,7 -20,7 +20,7 @@@ targets               := vmlinux.bin setup.bin setup
  targets               += fdimage fdimage144 fdimage288 image.iso mtools.conf
  subdir-               := compressed
  
- setup-y               += a20.o bioscall.o cmdline.o copy.o cpu.o cpucheck.o
+ setup-y               += a20.o bioscall.o cmdline.o copy.o cpu.o cpuflags.o cpucheck.o
  setup-y               += early_serial_console.o edd.o header.o main.o mca.o memory.o
  setup-y               += pm.o pmjump.o printf.o regs.o string.o tty.o video.o
  setup-y               += video-mode.o version.o
@@@ -53,26 -53,25 +53,26 @@@ $(obj)/cpustr.h: $(obj)/mkcpustr FORC
  
  # How to compile the 16-bit code.  Note we always compile for -march=i386,
  # that way we can complain to the user if the CPU is insufficient.
 -KBUILD_CFLAGS := $(USERINCLUDE) -g -Os -D_SETUP -D__KERNEL__ \
 +KBUILD_CFLAGS := $(USERINCLUDE) -m32 -g -Os -D_SETUP -D__KERNEL__ \
                   -DDISABLE_BRANCH_PROFILING \
                   -Wall -Wstrict-prototypes \
                   -march=i386 -mregparm=3 \
                   -include $(srctree)/$(src)/code16gcc.h \
                   -fno-strict-aliasing -fomit-frame-pointer -fno-pic \
 +                 -mno-mmx -mno-sse \
                   $(call cc-option, -ffreestanding) \
                   $(call cc-option, -fno-toplevel-reorder,\
 -                      $(call cc-option, -fno-unit-at-a-time)) \
 +                 $(call cc-option, -fno-unit-at-a-time)) \
                   $(call cc-option, -fno-stack-protector) \
                   $(call cc-option, -mpreferred-stack-boundary=2)
 -KBUILD_CFLAGS += $(call cc-option, -m32)
  KBUILD_AFLAGS := $(KBUILD_CFLAGS) -D__ASSEMBLY__
  GCOV_PROFILE := n
  
  $(obj)/bzImage: asflags-y  := $(SVGA_MODE)
  
  quiet_cmd_image = BUILD   $@
 -cmd_image = $(obj)/tools/build $(obj)/setup.bin $(obj)/vmlinux.bin $(obj)/zoffset.h > $@
 +cmd_image = $(obj)/tools/build $(obj)/setup.bin $(obj)/vmlinux.bin \
 +                             $(obj)/zoffset.h $@
  
  $(obj)/bzImage: $(obj)/setup.bin $(obj)/vmlinux.bin $(obj)/tools/build FORCE
        $(call if_changed,image)
index c8a6792e78423ac2efcb091f8d2553a35fb34c68,ae8b5dbbd8c5c401ff63e6a188aac29e0b197ca1..0fcd9133790c566423b313fccef95a0768bd0d07
@@@ -13,7 -13,6 +13,7 @@@ KBUILD_CFLAGS += -DDISABLE_BRANCH_PROFI
  cflags-$(CONFIG_X86_32) := -march=i386
  cflags-$(CONFIG_X86_64) := -mcmodel=small
  KBUILD_CFLAGS += $(cflags-y)
 +KBUILD_CFLAGS += -mno-mmx -mno-sse
  KBUILD_CFLAGS += $(call cc-option,-ffreestanding)
  KBUILD_CFLAGS += $(call cc-option,-fno-stack-protector)
  
@@@ -28,7 -27,7 +28,7 @@@ HOST_EXTRACFLAGS += -I$(srctree)/tools/
  
  VMLINUX_OBJS = $(obj)/vmlinux.lds $(obj)/head_$(BITS).o $(obj)/misc.o \
        $(obj)/string.o $(obj)/cmdline.o $(obj)/early_serial_console.o \
-       $(obj)/piggy.o
+       $(obj)/piggy.o $(obj)/cpuflags.o $(obj)/aslr.o
  
  $(obj)/eboot.o: KBUILD_CFLAGS += -fshort-wchar -mno-red-zone
  
diff --combined arch/x86/kernel/setup.c
index 182b3f97dcf494582b7c0acad854a89d251b7b01,1708862fc40dd0fde25ff5f47057cf67db8d8091..06853e6703541f8349106e17330f86621fa984db
@@@ -295,8 -295,6 +295,8 @@@ static void __init reserve_brk(void
        _brk_start = 0;
  }
  
 +u64 relocated_ramdisk;
 +
  #ifdef CONFIG_BLK_DEV_INITRD
  
  static u64 __init get_ramdisk_image(void)
@@@ -323,24 -321,25 +323,24 @@@ static void __init relocate_initrd(void
        u64 ramdisk_image = get_ramdisk_image();
        u64 ramdisk_size  = get_ramdisk_size();
        u64 area_size     = PAGE_ALIGN(ramdisk_size);
 -      u64 ramdisk_here;
        unsigned long slop, clen, mapaddr;
        char *p, *q;
  
        /* We need to move the initrd down into directly mapped mem */
 -      ramdisk_here = memblock_find_in_range(0, PFN_PHYS(max_pfn_mapped),
 -                                               area_size, PAGE_SIZE);
 +      relocated_ramdisk = memblock_find_in_range(0, PFN_PHYS(max_pfn_mapped),
 +                                                 area_size, PAGE_SIZE);
  
 -      if (!ramdisk_here)
 +      if (!relocated_ramdisk)
                panic("Cannot find place for new RAMDISK of size %lld\n",
 -                       ramdisk_size);
 +                    ramdisk_size);
  
        /* Note: this includes all the mem currently occupied by
           the initrd, we rely on that fact to keep the data intact. */
 -      memblock_reserve(ramdisk_here, area_size);
 -      initrd_start = ramdisk_here + PAGE_OFFSET;
 +      memblock_reserve(relocated_ramdisk, area_size);
 +      initrd_start = relocated_ramdisk + PAGE_OFFSET;
        initrd_end   = initrd_start + ramdisk_size;
        printk(KERN_INFO "Allocated new RAMDISK: [mem %#010llx-%#010llx]\n",
 -                       ramdisk_here, ramdisk_here + ramdisk_size - 1);
 +             relocated_ramdisk, relocated_ramdisk + ramdisk_size - 1);
  
        q = (char *)initrd_start;
  
        printk(KERN_INFO "Move RAMDISK from [mem %#010llx-%#010llx] to"
                " [mem %#010llx-%#010llx]\n",
                ramdisk_image, ramdisk_image + ramdisk_size - 1,
 -              ramdisk_here, ramdisk_here + ramdisk_size - 1);
 +              relocated_ramdisk, relocated_ramdisk + ramdisk_size - 1);
  }
  
  static void __init early_reserve_initrd(void)
@@@ -448,9 -447,6 +448,9 @@@ static void __init parse_setup_data(voi
                case SETUP_DTB:
                        add_dtb(pa_data);
                        break;
 +              case SETUP_EFI:
 +                      parse_efi_setup(pa_data, data_len);
 +                      break;
                default:
                        break;
                }
@@@ -827,6 -823,20 +827,20 @@@ static void __init trim_low_memory_rang
        memblock_reserve(0, ALIGN(reserve_low, PAGE_SIZE));
  }
        
+ /*
+  * Dump out kernel offset information on panic.
+  */
+ static int
+ dump_kernel_offset(struct notifier_block *self, unsigned long v, void *p)
+ {
+       pr_emerg("Kernel Offset: 0x%lx from 0x%lx "
+                "(relocation range: 0x%lx-0x%lx)\n",
+                (unsigned long)&_text - __START_KERNEL, __START_KERNEL,
+                __START_KERNEL_map, MODULES_VADDR-1);
+       return 0;
+ }
  /*
   * Determine if we were loaded by an EFI loader.  If so, then we have also been
   * passed the efi memmap, systab, etc., so we should use these data structures
@@@ -928,6 -938,8 +942,6 @@@ void __init setup_arch(char **cmdline_p
        iomem_resource.end = (1ULL << boot_cpu_data.x86_phys_bits) - 1;
        setup_memory_map();
        parse_setup_data();
 -      /* update the e820_saved too */
 -      e820_reserve_setup_data();
  
        copy_edd();
  
                early_dump_pci_devices();
  #endif
  
 +      /* update the e820_saved too */
 +      e820_reserve_setup_data();
        finish_e820_parsing();
  
        if (efi_enabled(EFI_BOOT))
                efi_init();
  
        dmi_scan_machine();
 +      dmi_memdev_walk();
        dmi_set_dump_stack_arch_desc();
  
        /*
        acpi_initrd_override((void *)initrd_start, initrd_end - initrd_start);
  #endif
  
 -      reserve_crashkernel();
 -
        vsmp_init();
  
        io_delay_init();
        early_acpi_boot_init();
  
        initmem_init();
 +
 +      /*
 +       * Reserve memory for crash kernel after SRAT is parsed so that it
 +       * won't consume hotpluggable memory.
 +       */
 +      reserve_crashkernel();
 +
        memblock_find_dma_reserve();
  
  #ifdef CONFIG_KVM_GUEST
@@@ -1252,3 -1256,15 +1266,15 @@@ void __init i386_reserve_resources(void
  }
  
  #endif /* CONFIG_X86_32 */
+ static struct notifier_block kernel_offset_notifier = {
+       .notifier_call = dump_kernel_offset
+ };
+ static int __init register_kernel_offset_dumper(void)
+ {
+       atomic_notifier_chain_register(&panic_notifier_list,
+                                       &kernel_offset_notifier);
+       return 0;
+ }
+ __initcall(register_kernel_offset_dumper);