Merge git://git.infradead.org/users/eparis/audit
authorLinus Torvalds <torvalds@linux-foundation.org>
Sat, 12 Apr 2014 19:38:53 +0000 (12:38 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Sat, 12 Apr 2014 19:38:53 +0000 (12:38 -0700)
Pull audit updates from Eric Paris.

* git://git.infradead.org/users/eparis/audit: (28 commits)
  AUDIT: make audit_is_compat depend on CONFIG_AUDIT_COMPAT_GENERIC
  audit: renumber AUDIT_FEATURE_CHANGE into the 1300 range
  audit: do not cast audit_rule_data pointers pointlesly
  AUDIT: Allow login in non-init namespaces
  audit: define audit_is_compat in kernel internal header
  kernel: Use RCU_INIT_POINTER(x, NULL) in audit.c
  sched: declare pid_alive as inline
  audit: use uapi/linux/audit.h for AUDIT_ARCH declarations
  syscall_get_arch: remove useless function arguments
  audit: remove stray newline from audit_log_execve_info() audit_panic() call
  audit: remove stray newlines from audit_log_lost messages
  audit: include subject in login records
  audit: remove superfluous new- prefix in AUDIT_LOGIN messages
  audit: allow user processes to log from another PID namespace
  audit: anchor all pid references in the initial pid namespace
  audit: convert PPIDs to the inital PID namespace.
  pid: get pid_t ppid of task in init_pid_ns
  audit: rename the misleading audit_get_context() to audit_take_context()
  audit: Add generic compat syscall support
  audit: Add CONFIG_HAVE_ARCH_AUDITSYSCALL
  ...

23 files changed:
1  2 
arch/alpha/Kconfig
arch/arm/Kconfig
arch/ia64/Kconfig
arch/mips/include/asm/syscall.h
arch/mips/kernel/ptrace.c
arch/parisc/Kconfig
arch/powerpc/Kconfig
arch/s390/Kconfig
arch/sh/Kconfig
arch/sparc/Kconfig
arch/x86/Kconfig
fs/proc/base.c
include/linux/mm.h
include/linux/sched.h
init/Kconfig
kernel/audit.c
kernel/auditfilter.c
kernel/auditsc.c
kernel/seccomp.c
lib/Kconfig
lib/Makefile
mm/util.c
security/integrity/integrity_audit.c

diff --combined arch/alpha/Kconfig
@@@ -2,7 -2,6 +2,7 @@@ config ALPH
        bool
        default y
        select ARCH_MIGHT_HAVE_PC_PARPORT
 +      select ARCH_MIGHT_HAVE_PC_SERIO
        select HAVE_AOUT
        select HAVE_IDE
        select HAVE_OPROFILE
@@@ -22,6 -21,7 +22,7 @@@
        select GENERIC_SMP_IDLE_THREAD
        select GENERIC_STRNCPY_FROM_USER
        select GENERIC_STRNLEN_USER
+       select HAVE_ARCH_AUDITSYSCALL
        select HAVE_MOD_ARCH_SPECIFIC
        select MODULES_USE_ELF_RELA
        select ODD_RT_SIGACTION
@@@ -543,13 -543,13 +544,13 @@@ config SM
        depends on ALPHA_SABLE || ALPHA_LYNX || ALPHA_RAWHIDE || ALPHA_DP264 || ALPHA_WILDFIRE || ALPHA_TITAN || ALPHA_GENERIC || ALPHA_SHARK || ALPHA_MARVEL
        ---help---
          This enables support for systems with more than one CPU. If you have
 -        a system with only one CPU, like most personal computers, say N. If
 -        you have a system with more than one CPU, say Y.
 +        a system with only one CPU, say N. If you have a system with more
 +        than one CPU, say Y.
  
 -        If you say N here, the kernel will run on single and multiprocessor
 +        If you say N here, the kernel will run on uni- and multiprocessor
          machines, but will use only one CPU of a multiprocessor machine. If
          you say Y here, the kernel will run on many, but not all,
 -        singleprocessor machines. On a singleprocessor machine, the kernel
 +        uniprocessor machines. On a uniprocessor machine, the kernel
          will run faster if you say N here.
  
          See also the SMP-HOWTO available at
diff --combined arch/arm/Kconfig
@@@ -6,13 -6,12 +6,13 @@@ config AR
        select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST
        select ARCH_HAVE_CUSTOM_GPIO_H
        select ARCH_MIGHT_HAVE_PC_PARPORT
 +      select ARCH_USE_BUILTIN_BSWAP
        select ARCH_USE_CMPXCHG_LOCKREF
        select ARCH_WANT_IPC_PARSE_VERSION
        select BUILDTIME_EXTABLE_SORT if MMU
        select CLONE_BACKWARDS
        select CPU_PM if (SUSPEND || CPU_IDLE)
 -      select DCACHE_WORD_ACCESS if (CPU_V6 || CPU_V6K || CPU_V7) && !CPU_BIG_ENDIAN && MMU
 +      select DCACHE_WORD_ACCESS if HAVE_EFFICIENT_UNALIGNED_ACCESS
        select GENERIC_ATOMIC64 if (CPU_V7M || CPU_V6 || !CPU_32v6K || !AEABI)
        select GENERIC_CLOCKEVENTS_BROADCAST if SMP
        select GENERIC_IDLE_POLL_SETUP
@@@ -24,6 -23,7 +24,7 @@@
        select GENERIC_STRNCPY_FROM_USER
        select GENERIC_STRNLEN_USER
        select HARDIRQS_SW_RESEND
+       select HAVE_ARCH_AUDITSYSCALL if (AEABI && !OABI_COMPAT)
        select HAVE_ARCH_JUMP_LABEL if !XIP_KERNEL
        select HAVE_ARCH_KGDB
        select HAVE_ARCH_SECCOMP_FILTER if (AEABI && !OABI_COMPAT)
        select HAVE_BPF_JIT
        select HAVE_CONTEXT_TRACKING
        select HAVE_C_RECORDMCOUNT
 +      select HAVE_CC_STACKPROTECTOR
        select HAVE_DEBUG_KMEMLEAK
        select HAVE_DMA_API_DEBUG
        select HAVE_DMA_ATTRS
        select HAVE_DMA_CONTIGUOUS if MMU
        select HAVE_DYNAMIC_FTRACE if (!XIP_KERNEL)
 +      select HAVE_EFFICIENT_UNALIGNED_ACCESS if (CPU_V6 || CPU_V6K || CPU_V7) && MMU
        select HAVE_FTRACE_MCOUNT_RECORD if (!XIP_KERNEL)
        select HAVE_FUNCTION_GRAPH_TRACER if (!THUMB2_KERNEL)
        select HAVE_FUNCTION_TRACER if (!XIP_KERNEL)
@@@ -65,7 -63,6 +66,7 @@@
        select IRQ_FORCED_THREADING
        select KTIME_SCALAR
        select MODULES_USE_ELF_REL
 +      select NO_BOOTMEM
        select OLD_SIGACTION
        select OLD_SIGSUSPEND3
        select PERF_USE_VMALLOC
@@@ -113,6 -110,9 +114,6 @@@ config ARM_DMA_IOMMU_ALIGNMEN
  
  endif
  
 -config HAVE_PWM
 -      bool
 -
  config MIGHT_HAVE_PCI
        bool
  
@@@ -126,7 -126,7 +127,7 @@@ config HAVE_TC
  config HAVE_PROC_CPU
        bool
  
 -config NO_IOPORT
 +config NO_IOPORT_MAP
        bool
  
  config EISA
@@@ -204,9 -204,6 +205,9 @@@ config ZONE_DM
  config NEED_DMA_MAP_STATE
         def_bool y
  
 +config ARCH_SUPPORTS_UPROBES
 +      def_bool y
 +
  config ARCH_HAS_DMA_SET_COHERENT_MASK
        bool
  
@@@ -306,12 -303,9 +307,12 @@@ choic
  config ARCH_MULTIPLATFORM
        bool "Allow multiple platforms to be selected"
        depends on MMU
 +      select ARCH_WANT_OPTIONAL_GPIOLIB
 +      select ARM_HAS_SG_CHAIN
        select ARM_PATCH_PHYS_VIRT
        select AUTO_ZRELADDR
        select COMMON_CLK
 +      select GENERIC_CLOCKEVENTS
        select MULTI_IRQ_HANDLER
        select SPARSE_IRQ
        select USE_OF
@@@ -320,8 -314,6 +321,8 @@@ config ARCH_INTEGRATO
        bool "ARM Ltd. Integrator family"
        select ARCH_HAS_CPUFREQ
        select ARM_AMBA
 +      select ARM_PATCH_PHYS_VIRT
 +      select AUTO_ZRELADDR
        select COMMON_CLK
        select COMMON_CLK_VERSATILE
        select GENERIC_CLOCKEVENTS
@@@ -391,6 -383,8 +392,6 @@@ config ARCH_CLPS711
        select CPU_ARM720T
        select GENERIC_CLOCKEVENTS
        select MFD_SYSCON
 -      select MULTI_IRQ_HANDLER
 -      select SPARSE_IRQ
        help
          Support for Cirrus Logic 711x/721x/731x based boards.
  
@@@ -410,31 -404,13 +411,31 @@@ config ARCH_EBSA11
        select ISA
        select NEED_MACH_IO_H
        select NEED_MACH_MEMORY_H
 -      select NO_IOPORT
 +      select NO_IOPORT_MAP
        help
          This is an evaluation board for the StrongARM processor available
          from Digital. It has limited hardware on-board, including an
          Ethernet interface, two PCMCIA sockets, two serial ports and a
          parallel port.
  
 +config ARCH_EFM32
 +      bool "Energy Micro efm32"
 +      depends on !MMU
 +      select ARCH_REQUIRE_GPIOLIB
 +      select AUTO_ZRELADDR
 +      select ARM_NVIC
 +      select CLKSRC_OF
 +      select COMMON_CLK
 +      select CPU_V7M
 +      select GENERIC_CLOCKEVENTS
 +      select NO_DMA
 +      select NO_IOPORT_MAP
 +      select SPARSE_IRQ
 +      select USE_OF
 +      help
 +        Support for Energy Micro's (now Silicon Labs) efm32 Giant Gecko
 +        processors.
 +
  config ARCH_EP93XX
        bool "EP93xx-based"
        select ARCH_HAS_HOLES_MEMORYMODEL
@@@ -533,6 -509,7 +534,6 @@@ config ARCH_DOV
        select PINCTRL
        select PINCTRL_DOVE
        select PLAT_ORION_LEGACY
 -      select USB_ARCH_HAS_EHCI
        help
          Support for the Marvell Dove SoC 88AP510
  
@@@ -630,6 -607,8 +631,6 @@@ config ARCH_LPC32X
        select CPU_ARM926T
        select GENERIC_CLOCKEVENTS
        select HAVE_IDE
 -      select HAVE_PWM
 -      select USB_ARCH_HAS_OHCI
        select USE_OF
        help
          Support for the NXP LPC32XX family of processors
@@@ -654,8 -633,9 +655,8 @@@ config ARCH_PX
          Support for Intel/Marvell's PXA2xx/PXA3xx processor line.
  
  config ARCH_MSM
 -      bool "Qualcomm MSM"
 +      bool "Qualcomm MSM (non-multiplatform)"
        select ARCH_REQUIRE_GPIOLIB
 -      select CLKSRC_OF if OF
        select COMMON_CLK
        select GENERIC_CLOCKEVENTS
        help
          stack and controls some vital subsystems
          (clock and power control, etc).
  
 -config ARCH_SHMOBILE
 -      bool "Renesas SH-Mobile / R-Mobile"
 +config ARCH_SHMOBILE_LEGACY
 +      bool "Renesas ARM SoCs (non-multiplatform)"
 +      select ARCH_SHMOBILE
        select ARM_PATCH_PHYS_VIRT
        select CLKDEV_LOOKUP
        select GENERIC_CLOCKEVENTS
        select HAVE_SMP
        select MIGHT_HAVE_CACHE_L2X0
        select MULTI_IRQ_HANDLER
 -      select NO_IOPORT
 +      select NO_IOPORT_MAP
        select PINCTRL
        select PM_GENERIC_DOMAINS if PM
        select SPARSE_IRQ
        help
 -        Support for Renesas's SH-Mobile and R-Mobile ARM platforms.
 +        Support for Renesas ARM SoC platforms using a non-multiplatform
 +        kernel. This includes the SH-Mobile, R-Mobile, EMMA-Mobile, R-Car
 +        and RZ families.
  
  config ARCH_RPC
        bool "RiscPC"
        select ARCH_MAY_HAVE_PC_FDC
        select ARCH_SPARSEMEM_ENABLE
        select ARCH_USES_GETTIMEOFFSET
 +      select CPU_SA110
        select FIQ
        select HAVE_IDE
        select HAVE_PATA_PLATFORM
        select ISA_DMA_API
        select NEED_MACH_IO_H
        select NEED_MACH_MEMORY_H
 -      select NO_IOPORT
 +      select NO_IOPORT_MAP
        select VIRT_TO_BUS
        help
          On the Acorn Risc-PC, Linux can support the internal IDE disk and
@@@ -727,7 -703,6 +728,7 @@@ config ARCH_S3C24X
        bool "Samsung S3C24XX SoCs"
        select ARCH_HAS_CPUFREQ
        select ARCH_REQUIRE_GPIOLIB
 +      select ATAGS
        select CLKDEV_LOOKUP
        select CLKSRC_SAMSUNG_PWM
        select GENERIC_CLOCKEVENTS
        select HAVE_S3C2410_WATCHDOG if WATCHDOG
        select HAVE_S3C_RTC if RTC_CLASS
        select MULTI_IRQ_HANDLER
 -      select NEED_MACH_GPIO_H
        select NEED_MACH_IO_H
        select SAMSUNG_ATAGS
        help
@@@ -748,32 -724,32 +749,32 @@@ config ARCH_S3C64X
        bool "Samsung S3C64XX"
        select ARCH_HAS_CPUFREQ
        select ARCH_REQUIRE_GPIOLIB
 +      select ARM_AMBA
        select ARM_VIC
 +      select ATAGS
        select CLKDEV_LOOKUP
        select CLKSRC_SAMSUNG_PWM
        select COMMON_CLK
 -      select CPU_V6
 +      select CPU_V6K
        select GENERIC_CLOCKEVENTS
        select GPIO_SAMSUNG
        select HAVE_S3C2410_I2C if I2C
        select HAVE_S3C2410_WATCHDOG if WATCHDOG
        select HAVE_TCM
 -      select NEED_MACH_GPIO_H
 -      select NO_IOPORT
 +      select NO_IOPORT_MAP
        select PLAT_SAMSUNG
 -      select PM_GENERIC_DOMAINS
 +      select PM_GENERIC_DOMAINS if PM
        select S3C_DEV_NAND
        select S3C_GPIO_TRACK
        select SAMSUNG_ATAGS
 -      select SAMSUNG_GPIOLIB_4BIT
        select SAMSUNG_WAKEMASK
        select SAMSUNG_WDT_RESET
 -      select USB_ARCH_HAS_OHCI
        help
          Samsung S3C64XX series based systems
  
  config ARCH_S5P64X0
        bool "Samsung S5P6440 S5P6450"
 +      select ATAGS
        select CLKDEV_LOOKUP
        select CLKSRC_SAMSUNG_PWM
        select CPU_V6
  config ARCH_S5PC100
        bool "Samsung S5PC100"
        select ARCH_REQUIRE_GPIOLIB
 +      select ATAGS
        select CLKDEV_LOOKUP
        select CLKSRC_SAMSUNG_PWM
        select CPU_V7
@@@ -812,7 -787,6 +813,7 @@@ config ARCH_S5PV21
        select ARCH_HAS_CPUFREQ
        select ARCH_HAS_HOLES_MEMORYMODEL
        select ARCH_SPARSEMEM_ENABLE
 +      select ATAGS
        select CLKDEV_LOOKUP
        select CLKSRC_SAMSUNG_PWM
        select CPU_V7
@@@ -886,12 -860,6 +887,12 @@@ menu "Multiple platform selection
  
  comment "CPU Core family selection"
  
 +config ARCH_MULTI_V4
 +      bool "ARMv4 based platforms (FA526)"
 +      depends on !ARCH_MULTI_V6_V7
 +      select ARCH_MULTI_V4_V5
 +      select CPU_FA526
 +
  config ARCH_MULTI_V4T
        bool "ARMv4T based platforms (ARM720T, ARM920T, ...)"
        depends on !ARCH_MULTI_V6_V7
@@@ -904,7 -872,7 +905,7 @@@ config ARCH_MULTI_V
        bool "ARMv5 based platforms (ARM926T, XSCALE, PJ1, ...)"
        depends on !ARCH_MULTI_V6_V7
        select ARCH_MULTI_V4_V5
 -      select CPU_ARM926T if (!CPU_ARM946E || CPU_ARM1020 || \
 +      select CPU_ARM926T if !(CPU_ARM946E || CPU_ARM1020 || \
                CPU_ARM1020E || CPU_ARM1022 || CPU_ARM1026 || \
                CPU_XSCALE || CPU_XSC3 || CPU_MOHAWK || CPU_FEROCEON)
  
@@@ -914,18 -882,16 +915,18 @@@ config ARCH_MULTI_V4_V
  config ARCH_MULTI_V6
        bool "ARMv6 based platforms (ARM11)"
        select ARCH_MULTI_V6_V7
 -      select CPU_V6
 +      select CPU_V6K
  
  config ARCH_MULTI_V7
        bool "ARMv7 based platforms (Cortex-A, PJ4, Scorpion, Krait)"
        default y
        select ARCH_MULTI_V6_V7
        select CPU_V7
 +      select HAVE_SMP
  
  config ARCH_MULTI_V6_V7
        bool
 +      select MIGHT_HAVE_CACHE_L2X0
  
  config ARCH_MULTI_CPU_AUTO
        def_bool !(ARCH_MULTI_V4 || ARCH_MULTI_V4T || ARCH_MULTI_V6_V7)
  
  endmenu
  
 +config ARCH_VIRT
 +      bool "Dummy Virtual Machine" if ARCH_MULTI_V7
 +      select ARM_AMBA
 +      select ARM_GIC
 +      select ARM_PSCI
 +      select HAVE_ARM_ARCH_TIMER
 +
  #
  # This is sorted alphabetically by mach-* pathname.  However, plat-*
  # Kconfigs may be included either alphabetically (according to the
@@@ -951,7 -910,7 +952,7 @@@ source "arch/arm/mach-at91/Kconfig
  
  source "arch/arm/mach-bcm/Kconfig"
  
 -source "arch/arm/mach-bcm2835/Kconfig"
 +source "arch/arm/mach-berlin/Kconfig"
  
  source "arch/arm/mach-clps711x/Kconfig"
  
@@@ -969,8 -928,6 +970,8 @@@ source "arch/arm/mach-gemini/Kconfig
  
  source "arch/arm/mach-highbank/Kconfig"
  
 +source "arch/arm/mach-hisi/Kconfig"
 +
  source "arch/arm/mach-integrator/Kconfig"
  
  source "arch/arm/mach-iop32x/Kconfig"
@@@ -989,8 -946,6 +990,8 @@@ source "arch/arm/mach-ks8695/Kconfig
  
  source "arch/arm/mach-msm/Kconfig"
  
 +source "arch/arm/mach-moxart/Kconfig"
 +
  source "arch/arm/mach-mv78xx0/Kconfig"
  
  source "arch/arm/mach-imx/Kconfig"
@@@ -1018,8 -973,6 +1019,8 @@@ source "arch/arm/plat-pxa/Kconfig
  
  source "arch/arm/mach-mmp/Kconfig"
  
 +source "arch/arm/mach-qcom/Kconfig"
 +
  source "arch/arm/mach-realview/Kconfig"
  
  source "arch/arm/mach-rockchip/Kconfig"
@@@ -1063,6 -1016,8 +1064,6 @@@ source "arch/arm/mach-versatile/Kconfig
  source "arch/arm/mach-vexpress/Kconfig"
  source "arch/arm/plat-versatile/Kconfig"
  
 -source "arch/arm/mach-virt/Kconfig"
 -
  source "arch/arm/mach-vt8500/Kconfig"
  
  source "arch/arm/mach-w90x900/Kconfig"
@@@ -1099,8 -1054,6 +1100,8 @@@ config ARM_TIMER_SP80
        select CLKSRC_MMIO
        select CLKSRC_OF if OF
  
 +source "arch/arm/firmware/Kconfig"
 +
  source arch/arm/mm/Kconfig
  
  config ARM_NR_BANKS
@@@ -1483,14 -1436,14 +1484,14 @@@ config SM
        depends on MMU || ARM_MPU
        help
          This enables support for systems with more than one CPU. If you have
 -        a system with only one CPU, like most personal computers, say N. If
 -        you have a system with more than one CPU, say Y.
 +        a system with only one CPU, say N. If you have a system with more
 +        than one CPU, say Y.
  
 -        If you say N here, the kernel will run on single and multiprocessor
 +        If you say N here, the kernel will run on uni- and multiprocessor
          machines, but will use only one CPU of a multiprocessor machine. If
 -        you say Y here, the kernel will run on many, but not all, single
 -        processor machines. On a single processor machine, the kernel will
 -        run faster if you say N here.
 +        you say Y here, the kernel will run on many, but not all,
 +        uniprocessor machines. On a uniprocessor machine, the kernel
 +        will run faster if you say N here.
  
          See also <file:Documentation/x86/i386/IO-APIC.txt>,
          <file:Documentation/nmi_watchdog.txt> and the SMP-HOWTO available at
@@@ -1591,7 -1544,6 +1592,7 @@@ config BL_SWITCHER_DUMMY_I
  
  choice
        prompt "Memory split"
 +      depends on MMU
        default VMSPLIT_3G
        help
          Select the desired split between kernel and user memory.
@@@ -1609,7 -1561,6 +1610,7 @@@ endchoic
  
  config PAGE_OFFSET
        hex
 +      default PHYS_OFFSET if !MMU
        default 0x40000000 if VMSPLIT_1G
        default 0x80000000 if VMSPLIT_2G
        default 0xC0000000
@@@ -1643,7 -1594,7 +1644,7 @@@ config ARM_PSC
  config ARCH_NR_GPIO
        int
        default 1024 if ARCH_SHMOBILE || ARCH_TEGRA
 -      default 512 if ARCH_EXYNOS || ARCH_KEYSTONE || SOC_OMAP5 || SOC_DRA7XX
 +      default 512 if ARCH_EXYNOS || ARCH_KEYSTONE || SOC_OMAP5 || SOC_DRA7XX || ARCH_S3C24XX || ARCH_S3C64XX
        default 392 if ARCH_U8500
        default 352 if ARCH_VT8500
        default 288 if ARCH_SUNXI
@@@ -1661,7 -1612,7 +1662,7 @@@ config HZ_FIXE
        default 200 if ARCH_EBSA110 || ARCH_S3C24XX || ARCH_S5P64X0 || \
                ARCH_S5PV210 || ARCH_EXYNOS4
        default AT91_TIMER_HZ if ARCH_AT91
 -      default SHMOBILE_TIMER_HZ if ARCH_SHMOBILE
 +      default SHMOBILE_TIMER_HZ if ARCH_SHMOBILE_LEGACY
        default 0
  
  choice
@@@ -1701,6 -1652,9 +1702,6 @@@ config H
  config SCHED_HRTICK
        def_bool HIGH_RES_TIMERS
  
 -config SCHED_HRTICK
 -      def_bool HIGH_RES_TIMERS
 -
  config THUMB2_KERNEL
        bool "Compile the kernel in Thumb-2 mode" if !CPU_THUMBONLY
        depends on (CPU_V7 || CPU_V7M) && !CPU_V6 && !CPU_V6K
@@@ -1843,10 -1797,10 +1844,10 @@@ config ARCH_WANT_GENERAL_HUGETL
  source "mm/Kconfig"
  
  config FORCE_MAX_ZONEORDER
 -      int "Maximum zone order" if ARCH_SHMOBILE
 -      range 11 64 if ARCH_SHMOBILE
 +      int "Maximum zone order" if ARCH_SHMOBILE_LEGACY
 +      range 11 64 if ARCH_SHMOBILE_LEGACY
        default "12" if SOC_AM33XX
 -      default "9" if SA1111
 +      default "9" if SA1111 || ARCH_EFM32
        default "11"
        help
          The kernel memory allocator divides physically contiguous memory
@@@ -1903,6 -1857,18 +1904,6 @@@ config SECCOM
          and the task is only allowed to execute a few safe syscalls
          defined by each seccomp mode.
  
 -config CC_STACKPROTECTOR
 -      bool "Enable -fstack-protector buffer overflow detection (EXPERIMENTAL)"
 -      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.
 -
  config SWIOTLB
        def_bool y
  
@@@ -1918,10 -1884,8 +1919,10 @@@ config XE
        depends on ARM && AEABI && OF
        depends on CPU_V7 && !CPU_V6
        depends on !GENERIC_ATOMIC64
 +      depends on MMU
        select ARM_PSCI
        select SWIOTLB_XEN
 +      select ARCH_DMA_ADDR_T_64BIT
        help
          Say Y if you want to run Linux in a Virtual Machine on Xen on ARM.
  
@@@ -1934,7 -1898,6 +1935,7 @@@ config USE_O
        select IRQ_DOMAIN
        select OF
        select OF_EARLY_FLATTREE
 +      select OF_RESERVED_MEM
        help
          Include support for flattened device tree machine descriptions.
  
@@@ -1984,7 -1947,6 +1985,7 @@@ config ZBOOT_ROM_BS
  config ZBOOT_ROM
        bool "Compressed boot loader in ROM/flash"
        depends on ZBOOT_ROM_TEXT != ZBOOT_ROM_BSS
 +      depends on !ARM_APPENDED_DTB && !XIP_KERNEL && !AUTO_ZRELADDR
        help
          Say Y here if you intend to execute your compressed kernel image
          (zImage) directly from ROM or flash.  If unsure, say N.
@@@ -2020,7 -1982,7 +2021,7 @@@ endchoic
  
  config ARM_APPENDED_DTB
        bool "Use appended device tree blob to zImage (EXPERIMENTAL)"
 -      depends on OF && !ZBOOT_ROM
 +      depends on OF
        help
          With this option, the boot code will look for a device tree binary
          (DTB) appended to zImage
@@@ -2108,7 -2070,7 +2109,7 @@@ endchoic
  
  config XIP_KERNEL
        bool "Kernel Execute-In-Place from ROM"
 -      depends on !ZBOOT_ROM && !ARM_LPAE && !ARCH_MULTIPLATFORM
 +      depends on !ARM_LPAE && !ARCH_MULTIPLATFORM
        help
          Execute-In-Place allows the kernel to run from non-volatile storage
          directly addressable by the CPU, such as NOR flash. This saves RAM
@@@ -2171,6 -2133,7 +2172,6 @@@ config CRASH_DUM
  
  config AUTO_ZRELADDR
        bool "Auto calculation of the decompressed kernel image address"
 -      depends on !ZBOOT_ROM
        help
          ZRELADDR is the physical address where the decompressed kernel
          image will be placed. If AUTO_ZRELADDR is selected, the address
@@@ -2287,7 -2250,7 +2288,7 @@@ source "kernel/power/Kconfig
  config ARCH_SUSPEND_POSSIBLE
        depends on !ARCH_S5PC100
        depends on CPU_ARM920T || CPU_ARM926T || CPU_FEROCEON || CPU_SA1100 || \
 -              CPU_V6 || CPU_V6K || CPU_V7 || CPU_XSC3 || CPU_XSCALE || CPU_MOHAWK
 +              CPU_V6 || CPU_V6K || CPU_V7 || CPU_V7M || CPU_XSC3 || CPU_XSCALE || CPU_MOHAWK
        def_bool y
  
  config ARM_CPU_SUSPEND
diff --combined arch/ia64/Kconfig
@@@ -7,7 -7,6 +7,7 @@@ menu "Processor type and features
  config IA64
        bool
        select ARCH_MIGHT_HAVE_PC_PARPORT
 +      select ARCH_MIGHT_HAVE_PC_SERIO
        select PCI if (!IA64_HP_SIM)
        select ACPI if (!IA64_HP_SIM)
        select PM if (!IA64_HP_SIM)
@@@ -21,7 -20,6 +21,7 @@@
        select HAVE_FUNCTION_TRACER
        select HAVE_DMA_ATTRS
        select HAVE_KVM
 +      select TTY
        select HAVE_ARCH_TRACEHOOK
        select HAVE_DMA_API_DEBUG
        select HAVE_MEMBLOCK
@@@ -45,6 -43,7 +45,7 @@@
        select HAVE_MOD_ARCH_SPECIFIC
        select MODULES_USE_ELF_RELA
        select ARCH_USE_CMPXCHG_LOCKREF
+       select HAVE_ARCH_AUDITSYSCALL
        default y
        help
          The Itanium Processor Family is Intel's 64-bit successor to
@@@ -106,7 -105,6 +107,7 @@@ config HAVE_SETUP_PER_CPU_ARE
  config DMI
        bool
        default y
 +      select DMI_SCAN_MACHINE_NON_EFI_FALLBACK
  
  config EFI
        bool
@@@ -150,6 -148,9 +151,6 @@@ config PARAVIR
          over full virtualization.  However, when run without a hypervisor
          the kernel is theoretically slower and slightly larger.
  
 -
 -source "arch/ia64/xen/Kconfig"
 -
  endif
  
  choice
@@@ -175,6 -176,7 +176,6 @@@ config IA64_GENERI
          SGI-SN2               For SGI Altix systems
          SGI-UV                For SGI UV systems
          Ski-simulator         For the HP simulator <http://www.hpl.hp.com/research/linux/ski/>
 -        Xen-domU              For xen domU system
  
          If you don't know what to do, choose "generic".
  
@@@ -230,6 -232,14 +231,6 @@@ config IA64_HP_SI
        bool "Ski-simulator"
        select SWIOTLB
  
 -config IA64_XEN_GUEST
 -      bool "Xen guest"
 -      select SWIOTLB
 -      depends on XEN
 -      help
 -        Build a kernel that runs on Xen guest domain. At this moment only
 -        16KB page size in supported.
 -
  endchoice
  
  choice
  #ifndef __ASM_MIPS_SYSCALL_H
  #define __ASM_MIPS_SYSCALL_H
  
- #include <linux/audit.h>
 +#include <linux/compiler.h>
+ #include <uapi/linux/audit.h>
  #include <linux/elf-em.h>
  #include <linux/kernel.h>
  #include <linux/sched.h>
  #include <linux/uaccess.h>
  #include <asm/ptrace.h>
 +#include <asm/unistd.h>
 +
 +#ifndef __NR_syscall /* Only defined if _MIPS_SIM == _MIPS_SIM_ABI32 */
 +#define __NR_syscall 4000
 +#endif
  
  static inline long syscall_get_nr(struct task_struct *task,
                                  struct pt_regs *regs)
  {
 -      return regs->regs[2];
 +      /* O32 ABI syscall() - Either 64-bit with O32 or 32-bit */
 +      if ((config_enabled(CONFIG_32BIT) ||
 +          test_tsk_thread_flag(task, TIF_32BIT_REGS)) &&
 +          (regs->regs[2] == __NR_syscall))
 +              return regs->regs[4];
 +      else
 +              return regs->regs[2];
  }
  
  static inline unsigned long mips_get_syscall_arg(unsigned long *arg,
        struct task_struct *task, struct pt_regs *regs, unsigned int n)
  {
 -      unsigned long usp = regs->regs[29];
 +      unsigned long usp __maybe_unused = regs->regs[29];
  
        switch (n) {
        case 0: case 1: case 2: case 3:
  
  #ifdef CONFIG_32BIT
        case 4: case 5: case 6: case 7:
 -              return get_user(*arg, (int *)usp + 4 * n);
 +              return get_user(*arg, (int *)usp + n);
  #endif
  
  #ifdef CONFIG_64BIT
        case 4: case 5: case 6: case 7:
  #ifdef CONFIG_MIPS32_O32
                if (test_thread_flag(TIF_32BIT_REGS))
 -                      return get_user(*arg, (int *)usp + 4 * n);
 +                      return get_user(*arg, (int *)usp + n);
                else
  #endif
                        *arg = regs->regs[4 + n];
@@@ -69,8 -57,6 +69,8 @@@
        default:
                BUG();
        }
 +
 +      unreachable();
  }
  
  static inline long syscall_get_return_value(struct task_struct *task,
        return regs->regs[2];
  }
  
 +static inline void syscall_rollback(struct task_struct *task,
 +                                  struct pt_regs *regs)
 +{
 +      /* Do nothing */
 +}
 +
  static inline void syscall_set_return_value(struct task_struct *task,
                                            struct pt_regs *regs,
                                            int error, long val)
@@@ -103,17 -83,11 +103,17 @@@ static inline void syscall_get_argument
                                         unsigned int i, unsigned int n,
                                         unsigned long *args)
  {
 -      unsigned long arg;
        int ret;
 +      /* O32 ABI syscall() - Either 64-bit with O32 or 32-bit */
 +      if ((config_enabled(CONFIG_32BIT) ||
 +          test_tsk_thread_flag(task, TIF_32BIT_REGS)) &&
 +          (regs->regs[2] == __NR_syscall)) {
 +              i++;
 +              n++;
 +      }
  
        while (n--)
 -              ret |= mips_get_syscall_arg(&arg, task, regs, i++);
 +              ret |= mips_get_syscall_arg(args++, task, regs, i++);
  
        /*
         * No way to communicate an error because this is a void function.
@@@ -127,13 -101,11 +127,12 @@@ extern const unsigned long sys_call_tab
  extern const unsigned long sys32_call_table[];
  extern const unsigned long sysn32_call_table[];
  
- static inline int syscall_get_arch(struct task_struct *task,
-                                  struct pt_regs *regs)
+ static inline int syscall_get_arch(void)
  {
        int arch = EM_MIPS;
  #ifdef CONFIG_64BIT
-       if (!test_tsk_thread_flag(task, TIF_32BIT_REGS))
 -      arch |=  __AUDIT_ARCH_64BIT;
++      if (!test_thread_flag(TIF_32BIT_REGS))
 +              arch |= __AUDIT_ARCH_64BIT;
  #endif
  #if defined(__LITTLE_ENDIAN)
        arch |=  __AUDIT_ARCH_LE;
@@@ -114,30 -114,51 +114,30 @@@ int ptrace_setregs(struct task_struct *
  int ptrace_getfpregs(struct task_struct *child, __u32 __user *data)
  {
        int i;
 -      unsigned int tmp;
  
        if (!access_ok(VERIFY_WRITE, data, 33 * 8))
                return -EIO;
  
        if (tsk_used_math(child)) {
 -              fpureg_t *fregs = get_fpu_regs(child);
 +              union fpureg *fregs = get_fpu_regs(child);
                for (i = 0; i < 32; i++)
 -                      __put_user(fregs[i], i + (__u64 __user *) data);
 +                      __put_user(get_fpr64(&fregs[i], 0),
 +                                 i + (__u64 __user *)data);
        } else {
                for (i = 0; i < 32; i++)
                        __put_user((__u64) -1, i + (__u64 __user *) data);
        }
  
        __put_user(child->thread.fpu.fcr31, data + 64);
 -
 -      preempt_disable();
 -      if (cpu_has_fpu) {
 -              unsigned int flags;
 -
 -              if (cpu_has_mipsmt) {
 -                      unsigned int vpflags = dvpe();
 -                      flags = read_c0_status();
 -                      __enable_fpu();
 -                      __asm__ __volatile__("cfc1\t%0,$0" : "=r" (tmp));
 -                      write_c0_status(flags);
 -                      evpe(vpflags);
 -              } else {
 -                      flags = read_c0_status();
 -                      __enable_fpu();
 -                      __asm__ __volatile__("cfc1\t%0,$0" : "=r" (tmp));
 -                      write_c0_status(flags);
 -              }
 -      } else {
 -              tmp = 0;
 -      }
 -      preempt_enable();
 -      __put_user(tmp, data + 65);
 +      __put_user(current_cpu_data.fpu_id, data + 65);
  
        return 0;
  }
  
  int ptrace_setfpregs(struct task_struct *child, __u32 __user *data)
  {
 -      fpureg_t *fregs;
 +      union fpureg *fregs;
 +      u64 fpr_val;
        int i;
  
        if (!access_ok(VERIFY_READ, data, 33 * 8))
  
        fregs = get_fpu_regs(child);
  
 -      for (i = 0; i < 32; i++)
 -              __get_user(fregs[i], i + (__u64 __user *) data);
 +      for (i = 0; i < 32; i++) {
 +              __get_user(fpr_val, i + (__u64 __user *)data);
 +              set_fpr64(&fregs[i], 0, fpr_val);
 +      }
  
        __get_user(child->thread.fpu.fcr31, data + 64);
  
@@@ -281,27 -300,10 +281,27 @@@ static int fpr_get(struct task_struct *
                   unsigned int pos, unsigned int count,
                   void *kbuf, void __user *ubuf)
  {
 -      return user_regset_copyout(&pos, &count, &kbuf, &ubuf,
 -                                 &target->thread.fpu,
 -                                 0, sizeof(elf_fpregset_t));
 +      unsigned i;
 +      int err;
 +      u64 fpr_val;
 +
        /* XXX fcr31  */
 +
 +      if (sizeof(target->thread.fpu.fpr[i]) == sizeof(elf_fpreg_t))
 +              return user_regset_copyout(&pos, &count, &kbuf, &ubuf,
 +                                         &target->thread.fpu,
 +                                         0, sizeof(elf_fpregset_t));
 +
 +      for (i = 0; i < NUM_FPU_REGS; i++) {
 +              fpr_val = get_fpr64(&target->thread.fpu.fpr[i], 0);
 +              err = user_regset_copyout(&pos, &count, &kbuf, &ubuf,
 +                                        &fpr_val, i * sizeof(elf_fpreg_t),
 +                                        (i + 1) * sizeof(elf_fpreg_t));
 +              if (err)
 +                      return err;
 +      }
 +
 +      return 0;
  }
  
  static int fpr_set(struct task_struct *target,
                   unsigned int pos, unsigned int count,
                   const void *kbuf, const void __user *ubuf)
  {
 -      return user_regset_copyin(&pos, &count, &kbuf, &ubuf,
 -                                &target->thread.fpu,
 -                                0, sizeof(elf_fpregset_t));
 +      unsigned i;
 +      int err;
 +      u64 fpr_val;
 +
        /* XXX fcr31  */
 +
 +      if (sizeof(target->thread.fpu.fpr[i]) == sizeof(elf_fpreg_t))
 +              return user_regset_copyin(&pos, &count, &kbuf, &ubuf,
 +                                        &target->thread.fpu,
 +                                        0, sizeof(elf_fpregset_t));
 +
 +      for (i = 0; i < NUM_FPU_REGS; i++) {
 +              err = user_regset_copyin(&pos, &count, &kbuf, &ubuf,
 +                                       &fpr_val, i * sizeof(elf_fpreg_t),
 +                                       (i + 1) * sizeof(elf_fpreg_t));
 +              if (err)
 +                      return err;
 +              set_fpr64(&target->thread.fpu.fpr[i], 0, fpr_val);
 +      }
 +
 +      return 0;
  }
  
  enum mips_regset {
@@@ -423,7 -408,6 +423,7 @@@ long arch_ptrace(struct task_struct *ch
        /* Read the word at location addr in the USER area. */
        case PTRACE_PEEKUSR: {
                struct pt_regs *regs;
 +              union fpureg *fregs;
                unsigned long tmp = 0;
  
                regs = task_pt_regs(child);
                        tmp = regs->regs[addr];
                        break;
                case FPR_BASE ... FPR_BASE + 31:
 -                      if (tsk_used_math(child)) {
 -                              fpureg_t *fregs = get_fpu_regs(child);
 +                      if (!tsk_used_math(child)) {
 +                              /* FP not yet used */
 +                              tmp = -1;
 +                              break;
 +                      }
 +                      fregs = get_fpu_regs(child);
  
  #ifdef CONFIG_32BIT
 +                      if (test_thread_flag(TIF_32BIT_FPREGS)) {
                                /*
                                 * The odd registers are actually the high
                                 * order bits of the values stored in the even
                                 * registers - unless we're using r2k_switch.S.
                                 */
 -                              if (addr & 1)
 -                                      tmp = (unsigned long) (fregs[((addr & ~1) - 32)] >> 32);
 -                              else
 -                                      tmp = (unsigned long) (fregs[(addr - 32)] & 0xffffffff);
 -#endif
 -#ifdef CONFIG_64BIT
 -                              tmp = fregs[addr - FPR_BASE];
 -#endif
 -                      } else {
 -                              tmp = -1;       /* FP not yet used  */
 +                              tmp = get_fpr32(&fregs[(addr & ~1) - FPR_BASE],
 +                                              addr & 1);
 +                              break;
                        }
 +#endif
 +                      tmp = get_fpr32(&fregs[addr - FPR_BASE], 0);
                        break;
                case PC:
                        tmp = regs->cp0_epc;
                case FPC_CSR:
                        tmp = child->thread.fpu.fcr31;
                        break;
 -              case FPC_EIR: { /* implementation / version register */
 -                      unsigned int flags;
 -#ifdef CONFIG_MIPS_MT_SMTC
 -                      unsigned long irqflags;
 -                      unsigned int mtflags;
 -#endif /* CONFIG_MIPS_MT_SMTC */
 -
 -                      preempt_disable();
 -                      if (!cpu_has_fpu) {
 -                              preempt_enable();
 -                              break;
 -                      }
 -
 -#ifdef CONFIG_MIPS_MT_SMTC
 -                      /* Read-modify-write of Status must be atomic */
 -                      local_irq_save(irqflags);
 -                      mtflags = dmt();
 -#endif /* CONFIG_MIPS_MT_SMTC */
 -                      if (cpu_has_mipsmt) {
 -                              unsigned int vpflags = dvpe();
 -                              flags = read_c0_status();
 -                              __enable_fpu();
 -                              __asm__ __volatile__("cfc1\t%0,$0": "=r" (tmp));
 -                              write_c0_status(flags);
 -                              evpe(vpflags);
 -                      } else {
 -                              flags = read_c0_status();
 -                              __enable_fpu();
 -                              __asm__ __volatile__("cfc1\t%0,$0": "=r" (tmp));
 -                              write_c0_status(flags);
 -                      }
 -#ifdef CONFIG_MIPS_MT_SMTC
 -                      emt(mtflags);
 -                      local_irq_restore(irqflags);
 -#endif /* CONFIG_MIPS_MT_SMTC */
 -                      preempt_enable();
 +              case FPC_EIR:
 +                      /* implementation / version register */
 +                      tmp = current_cpu_data.fpu_id;
                        break;
 -              }
                case DSP_BASE ... DSP_BASE + 5: {
                        dspreg_t *dregs;
  
                        regs->regs[addr] = data;
                        break;
                case FPR_BASE ... FPR_BASE + 31: {
 -                      fpureg_t *fregs = get_fpu_regs(child);
 +                      union fpureg *fregs = get_fpu_regs(child);
  
                        if (!tsk_used_math(child)) {
                                /* FP not yet used  */
                                child->thread.fpu.fcr31 = 0;
                        }
  #ifdef CONFIG_32BIT
 -                      /*
 -                       * The odd registers are actually the high order bits
 -                       * of the values stored in the even registers - unless
 -                       * we're using r2k_switch.S.
 -                       */
 -                      if (addr & 1) {
 -                              fregs[(addr & ~1) - FPR_BASE] &= 0xffffffff;
 -                              fregs[(addr & ~1) - FPR_BASE] |= ((unsigned long long) data) << 32;
 -                      } else {
 -                              fregs[addr - FPR_BASE] &= ~0xffffffffLL;
 -                              fregs[addr - FPR_BASE] |= data;
 +                      if (test_thread_flag(TIF_32BIT_FPREGS)) {
 +                              /*
 +                               * The odd registers are actually the high
 +                               * order bits of the values stored in the even
 +                               * registers - unless we're using r2k_switch.S.
 +                               */
 +                              set_fpr32(&fregs[(addr & ~1) - FPR_BASE],
 +                                        addr & 1, data);
 +                              break;
                        }
  #endif
 -#ifdef CONFIG_64BIT
 -                      fregs[addr - FPR_BASE] = data;
 -#endif
 +                      set_fpr64(&fregs[addr - FPR_BASE], 0, data);
                        break;
                }
                case PC:
   * Notification of system call entry/exit
   * - triggered by current->work.syscall_trace
   */
 -asmlinkage void syscall_trace_enter(struct pt_regs *regs)
 +asmlinkage long syscall_trace_enter(struct pt_regs *regs, long syscall)
  {
        long ret = 0;
        user_exit();
  
 -      /* do the secure computing check first */
 -      secure_computing_strict(regs->regs[2]);
 +      if (secure_computing(syscall) == -1)
 +              return -1;
  
        if (test_thread_flag(TIF_SYSCALL_TRACE) &&
            tracehook_report_syscall_entry(regs))
        if (unlikely(test_thread_flag(TIF_SYSCALL_TRACEPOINT)))
                trace_sys_enter(regs, regs->regs[2]);
  
-       audit_syscall_entry(syscall_get_arch(current, regs),
+       audit_syscall_entry(syscall_get_arch(),
 -                          regs->regs[2],
 +                          syscall,
                            regs->regs[4], regs->regs[5],
                            regs->regs[6], regs->regs[7]);
 +      return syscall;
  }
  
  /*
diff --combined arch/parisc/Kconfig
@@@ -28,6 -28,7 +28,7 @@@ config PARIS
        select CLONE_BACKWARDS
        select TTY # Needed for pdc_cons.c
        select HAVE_DEBUG_STACKOVERFLOW
+       select HAVE_ARCH_AUDITSYSCALL
  
        help
          The PA-RISC microprocessor is designed by Hewlett-Packard and used
@@@ -229,13 -230,13 +230,13 @@@ config SM
        bool "Symmetric multi-processing support"
        ---help---
          This enables support for systems with more than one CPU. If you have
 -        a system with only one CPU, like most personal computers, say N. If
 -        you have a system with more than one CPU, say Y.
 +        a system with only one CPU, say N. If you have a system with more
 +        than one CPU, say Y.
  
 -        If you say N here, the kernel will run on single and multiprocessor
 +        If you say N here, the kernel will run on uni- and multiprocessor
          machines, but will use only one CPU of a multiprocessor machine. If
          you say Y here, the kernel will run on many, but not all,
 -        singleprocessor machines. On a singleprocessor machine, the kernel
 +        uniprocessor machines. On a uniprocessor machine, the kernel
          will run faster if you say N here.
  
          See also <file:Documentation/nmi_watchdog.txt> and the SMP-HOWTO
diff --combined arch/powerpc/Kconfig
@@@ -86,11 -86,9 +86,11 @@@ config PP
        bool
        default y
        select ARCH_MIGHT_HAVE_PC_PARPORT
 +      select ARCH_MIGHT_HAVE_PC_SERIO
        select BINFMT_ELF
        select OF
        select OF_EARLY_FLATTREE
 +      select OF_RESERVED_MEM
        select HAVE_FTRACE_MCOUNT_RECORD
        select HAVE_DYNAMIC_FTRACE
        select HAVE_FUNCTION_TRACER
        select GENERIC_CMOS_UPDATE
        select GENERIC_TIME_VSYSCALL_OLD
        select GENERIC_CLOCKEVENTS
 +      select GENERIC_CLOCKEVENTS_BROADCAST if SMP
 +      select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST
        select GENERIC_STRNCPY_FROM_USER
        select GENERIC_STRNLEN_USER
        select HAVE_MOD_ARCH_SPECIFIC
        select OLD_SIGACTION if PPC32
        select HAVE_DEBUG_STACKOVERFLOW
        select HAVE_IRQ_EXIT_ON_IRQ_STACK
 +      select ARCH_USE_CMPXCHG_LOCKREF if PPC64
+       select HAVE_ARCH_AUDITSYSCALL
  
  config GENERIC_CSUM
        def_bool CPU_LITTLE_ENDIAN
@@@ -152,10 -148,6 +153,10 @@@ config EARLY_PRINT
        bool
        default y
  
 +config PANIC_TIMEOUT
 +      int
 +      default 180
 +
  config COMPAT
        bool
        default y if PPC64
@@@ -218,6 -210,9 +219,6 @@@ config DEFAULT_UIMAG
          Used to allow a board to specify it wants a uImage built by default
        default n
  
 -config REDBOOT
 -      bool
 -
  config ARCH_HIBERNATION_POSSIBLE
        bool
        default y
@@@ -345,8 -340,6 +346,8 @@@ config PPC_TRANSACTIONAL_ME
         bool "Transactional Memory support for POWERPC"
         depends on PPC_BOOK3S_64
         depends on SMP
 +       select ALTIVEC
 +       select VSX
         default n
         ---help---
           Support user-mode Transactional Memory on POWERPC.
@@@ -387,12 -380,6 +388,12 @@@ config ARCH_HAS_WALK_MEMOR
  config ARCH_ENABLE_MEMORY_HOTREMOVE
        def_bool y
  
 +config PPC64_SUPPORTS_MEMORY_FAILURE
 +      bool "Add support for memory hwpoison"
 +      depends on PPC_BOOK3S_64
 +      default "y" if PPC_POWERNV
 +      select ARCH_SUPPORTS_MEMORY_FAILURE
 +
  config KEXEC
        bool "kexec system call"
        depends on (PPC_BOOK3S || FSL_BOOKE || (44x && !SMP))
  config CRASH_DUMP
        bool "Build a kdump crash kernel"
        depends on PPC64 || 6xx || FSL_BOOKE || (44x && !SMP)
 -      select RELOCATABLE if PPC64 || 44x
 -      select DYNAMIC_MEMSTART if FSL_BOOKE
 +      select RELOCATABLE if PPC64 || 44x || FSL_BOOKE
        help
          Build a kernel suitable for use as a kdump capture kernel.
          The same kernel binary can be used as production kernel and dump
@@@ -537,7 -525,6 +538,7 @@@ config PPC_16K_PAGE
  
  config PPC_64K_PAGES
        bool "64k page size" if 44x || PPC_STD_MMU_64 || PPC_BOOK3E_64
 +      depends on !PPC_FSL_BOOK3E
        select PPC_HAS_HASH_64K if PPC_STD_MMU_64
  
  config PPC_256K_PAGES
@@@ -621,15 -608,6 +622,15 @@@ config CMDLIN
          some command-line options at build time by entering them here.  In
          most cases you will need to specify the root device here.
  
 +config CMDLINE_FORCE
 +      bool "Always use the default kernel command string"
 +      depends on CMDLINE_BOOL
 +      help
 +        Always use the default kernel command string, even if the boot
 +        loader passes other arguments to the kernel.
 +        This is useful if you cannot or don't want to change the
 +        command-line options your boot loader passes to the kernel.
 +
  config EXTRA_TARGETS
        string "Additional default image types"
        help
@@@ -748,6 -726,10 +749,6 @@@ config FSL_LB
          controller.  Also contains some common code used by
          drivers for specific local bus peripherals.
  
 -config FSL_IFC
 -      bool
 -        depends on FSL_SOC
 -
  config FSL_GTM
        bool
        depends on PPC_83xx || QUICC_ENGINE || CPM2
@@@ -809,7 -791,7 +810,7 @@@ config HAS_RAPIDI
        default n
  
  config RAPIDIO
 -      bool "RapidIO support"
 +      tristate "RapidIO support"
        depends on HAS_RAPIDIO || PCI
        help
          If you say Y here, the kernel will include drivers and
  
  config FSL_RIO
        bool "Freescale Embedded SRIO Controller support"
 -      depends on RAPIDIO && HAS_RAPIDIO
 +      depends on RAPIDIO = y && HAS_RAPIDIO
        default "n"
        ---help---
          Include support for RapidIO controller on Freescale embedded
@@@ -900,7 -882,7 +901,7 @@@ config DYNAMIC_MEMSTAR
  
  config RELOCATABLE
        bool "Build a relocatable kernel"
 -      depends on ADVANCED_OPTIONS && FLATMEM && 44x
 +      depends on ADVANCED_OPTIONS && FLATMEM && (44x || FSL_BOOKE)
        select NONSTATIC_KERNEL
        help
          This builds a kernel image that is capable of running at the
@@@ -1056,6 -1038,11 +1057,6 @@@ config KEYS_COMPA
  
  source "crypto/Kconfig"
  
 -config PPC_CLOCK
 -      bool
 -      default n
 -      select HAVE_CLK
 -
  config PPC_LIB_RHEAP
        bool
  
diff --combined arch/s390/Kconfig
@@@ -52,7 -52,7 +52,7 @@@ config KEXE
  config AUDIT_ARCH
        def_bool y
  
 -config NO_IOPORT
 +config NO_IOPORT_MAP
        def_bool y
  
  config PCI_QUIRKS
@@@ -103,6 -103,7 +103,7 @@@ config S39
        select GENERIC_SMP_IDLE_THREAD
        select GENERIC_TIME_VSYSCALL
        select HAVE_ALIGNED_STRUCT_PAGE if SLUB
+       select HAVE_ARCH_AUDITSYSCALL
        select HAVE_ARCH_JUMP_LABEL if !MARCH_G5
        select HAVE_ARCH_SECCOMP_FILTER
        select HAVE_ARCH_TRACEHOOK
        select HAVE_FUNCTION_GRAPH_TRACER
        select HAVE_FUNCTION_TRACER
        select HAVE_FUNCTION_TRACE_MCOUNT_TEST
 +      select HAVE_FUTEX_CMPXCHG if FUTEX
        select HAVE_KERNEL_BZIP2
        select HAVE_KERNEL_GZIP
        select HAVE_KERNEL_LZ4
        select OLD_SIGACTION
        select OLD_SIGSUSPEND3
        select SYSCTL_EXCEPTION_TRACE
 +      select TTY
        select VIRT_CPU_ACCOUNTING
        select VIRT_TO_BUS
  
@@@ -336,10 -335,10 +337,10 @@@ config SM
          a system with only one CPU, like most personal computers, say N. If
          you have a system with more than one CPU, say Y.
  
 -        If you say N here, the kernel will run on single and multiprocessor
 +        If you say N here, the kernel will run on uni- and multiprocessor
          machines, but will use only one CPU of a multiprocessor machine. If
          you say Y here, the kernel will run on many, but not all,
 -        singleprocessor machines. On a singleprocessor machine, the kernel
 +        uniprocessor machines. On a uniprocessor machine, the kernel
          will run faster if you say N here.
  
          See also the SMP-HOWTO available at
@@@ -417,10 -416,6 +418,10 @@@ config ARCH_ENABLE_MEMORY_HOTPLU
  config ARCH_ENABLE_MEMORY_HOTREMOVE
        def_bool y
  
 +config ARCH_ENABLE_SPLIT_PMD_PTLOCK
 +      def_bool y
 +      depends on 64BIT
 +
  config FORCE_MAX_ZONEORDER
        int
        default "9"
@@@ -602,7 -597,7 +603,7 @@@ config CRASH_DUM
  config ZFCPDUMP
        def_bool n
        prompt "zfcpdump support"
 -      depends on SMP
 +      depends on 64BIT && SMP
        help
          Select this option if you want to build an zfcpdump enabled kernel.
          Refer to <file:Documentation/s390/zfcpdump.txt> for more details on this.
diff --combined arch/sh/Kconfig
@@@ -3,7 -3,7 +3,7 @@@ config SUPER
        select ARCH_MIGHT_HAVE_PC_PARPORT
        select EXPERT
        select CLKDEV_LOOKUP
 -      select HAVE_IDE if HAS_IOPORT
 +      select HAVE_IDE if HAS_IOPORT_MAP
        select HAVE_MEMBLOCK
        select HAVE_MEMBLOCK_NODE_MAP
        select ARCH_DISCARD_MEMBLOCK
@@@ -42,6 -42,7 +42,7 @@@
        select MODULES_USE_ELF_RELA
        select OLD_SIGSUSPEND
        select OLD_SIGACTION
+       select HAVE_ARCH_AUDITSYSCALL
        help
          The SuperH is a RISC processor targeted for use in embedded systems
          and consumer electronics; it was also used in the Sega Dreamcast
@@@ -66,7 -67,6 +67,7 @@@ config SUPERH3
        select PERF_EVENTS
        select ARCH_HIBERNATION_POSSIBLE if MMU
        select SPARSE_IRQ
 +      select HAVE_CC_STACKPROTECTOR
  
  config SUPERH64
        def_bool ARCH = "sh64"
@@@ -123,6 -123,15 +124,6 @@@ config SYS_SUPPORTS_NUM
  config SYS_SUPPORTS_PCI
        bool
  
 -config SYS_SUPPORTS_CMT
 -      bool
 -
 -config SYS_SUPPORTS_MTU2
 -      bool
 -
 -config SYS_SUPPORTS_TMU
 -      bool
 -
  config STACKTRACE_SUPPORT
        def_bool y
  
@@@ -138,7 -147,7 +139,7 @@@ config ARCH_HAS_ILOG2_U3
  config ARCH_HAS_ILOG2_U64
        def_bool n
  
 -config NO_IOPORT
 +config NO_IOPORT_MAP
        def_bool !PCI
        depends on !SH_CAYMAN && !SH_SH4202_MICRODEV && !SH_SHMIN && \
                   !SH_HP6XX && !SH_SOLUTION_ENGINE
@@@ -182,14 -191,14 +183,14 @@@ config CPU_SH
        bool
        select CPU_HAS_INTEVT
        select CPU_HAS_SR_RB
 -      select SYS_SUPPORTS_TMU
 +      select SYS_SUPPORTS_SH_TMU
  
  config CPU_SH4
        bool
        select CPU_HAS_INTEVT
        select CPU_HAS_SR_RB
        select CPU_HAS_FPU if !CPU_SH4AL_DSP
 -      select SYS_SUPPORTS_TMU
 +      select SYS_SUPPORTS_SH_TMU
        select SYS_SUPPORTS_HUGETLBFS if MMU
  
  config CPU_SH4A
@@@ -204,7 -213,7 +205,7 @@@ config CPU_SH4AL_DS
  config CPU_SH5
        bool
        select CPU_HAS_FPU
 -      select SYS_SUPPORTS_TMU
 +      select SYS_SUPPORTS_SH_TMU
        select SYS_SUPPORTS_HUGETLBFS if MMU
  
  config CPU_SHX2
@@@ -241,7 -250,7 +242,7 @@@ choic
  config CPU_SUBTYPE_SH7619
        bool "Support SH7619 processor"
        select CPU_SH2
 -      select SYS_SUPPORTS_CMT
 +      select SYS_SUPPORTS_SH_CMT
  
  # SH-2A Processor Support
  
@@@ -249,50 -258,50 +250,50 @@@ config CPU_SUBTYPE_SH720
        bool "Support SH7201 processor"
        select CPU_SH2A
        select CPU_HAS_FPU
 -      select SYS_SUPPORTS_MTU2
 +      select SYS_SUPPORTS_SH_MTU2
   
  config CPU_SUBTYPE_SH7203
        bool "Support SH7203 processor"
        select CPU_SH2A
        select CPU_HAS_FPU
 -      select SYS_SUPPORTS_CMT
 -      select SYS_SUPPORTS_MTU2
 +      select SYS_SUPPORTS_SH_CMT
 +      select SYS_SUPPORTS_SH_MTU2
        select ARCH_WANT_OPTIONAL_GPIOLIB
        select PINCTRL
  
  config CPU_SUBTYPE_SH7206
        bool "Support SH7206 processor"
        select CPU_SH2A
 -      select SYS_SUPPORTS_CMT
 -      select SYS_SUPPORTS_MTU2
 +      select SYS_SUPPORTS_SH_CMT
 +      select SYS_SUPPORTS_SH_MTU2
  
  config CPU_SUBTYPE_SH7263
        bool "Support SH7263 processor"
        select CPU_SH2A
        select CPU_HAS_FPU
 -      select SYS_SUPPORTS_CMT
 -      select SYS_SUPPORTS_MTU2
 +      select SYS_SUPPORTS_SH_CMT
 +      select SYS_SUPPORTS_SH_MTU2
  
  config CPU_SUBTYPE_SH7264
        bool "Support SH7264 processor"
        select CPU_SH2A
        select CPU_HAS_FPU
 -      select SYS_SUPPORTS_CMT
 -      select SYS_SUPPORTS_MTU2
 +      select SYS_SUPPORTS_SH_CMT
 +      select SYS_SUPPORTS_SH_MTU2
        select PINCTRL
  
  config CPU_SUBTYPE_SH7269
        bool "Support SH7269 processor"
        select CPU_SH2A
        select CPU_HAS_FPU
 -      select SYS_SUPPORTS_CMT
 -      select SYS_SUPPORTS_MTU2
 +      select SYS_SUPPORTS_SH_CMT
 +      select SYS_SUPPORTS_SH_MTU2
        select PINCTRL
  
  config CPU_SUBTYPE_MXG
        bool "Support MX-G processor"
        select CPU_SH2A
 -      select SYS_SUPPORTS_MTU2
 +      select SYS_SUPPORTS_SH_MTU2
        help
          Select MX-G if running on an R8A03022BG part.
  
@@@ -345,8 -354,9 +346,8 @@@ config CPU_SUBTYPE_SH772
        bool "Support SH7720 processor"
        select CPU_SH3
        select CPU_HAS_DSP
 -      select SYS_SUPPORTS_CMT
 +      select SYS_SUPPORTS_SH_CMT
        select ARCH_WANT_OPTIONAL_GPIOLIB
 -      select USB_ARCH_HAS_OHCI
        select USB_OHCI_SH if USB_OHCI_HCD
        select PINCTRL
        help
@@@ -356,7 -366,8 +357,7 @@@ config CPU_SUBTYPE_SH772
        bool "Support SH7721 processor"
        select CPU_SH3
        select CPU_HAS_DSP
 -      select SYS_SUPPORTS_CMT
 -      select USB_ARCH_HAS_OHCI
 +      select SYS_SUPPORTS_SH_CMT
        select USB_OHCI_SH if USB_OHCI_HCD
        help
          Select SH7721 if you have a SH3-DSP SH7721 CPU.
@@@ -411,7 -422,7 +412,7 @@@ config CPU_SUBTYPE_SH772
        select CPU_SHX2
        select ARCH_SHMOBILE
        select ARCH_SPARSEMEM_ENABLE
 -      select SYS_SUPPORTS_CMT
 +      select SYS_SUPPORTS_SH_CMT
        select ARCH_WANT_OPTIONAL_GPIOLIB
        select PINCTRL
        help
@@@ -423,7 -434,7 +424,7 @@@ config CPU_SUBTYPE_SH772
        select CPU_SHX2
        select ARCH_SHMOBILE
        select ARCH_SPARSEMEM_ENABLE
 -      select SYS_SUPPORTS_CMT
 +      select SYS_SUPPORTS_SH_CMT
        select ARCH_WANT_OPTIONAL_GPIOLIB
        select PINCTRL
        help
@@@ -434,6 -445,8 +435,6 @@@ config CPU_SUBTYPE_SH773
        select CPU_SH4A
        select CPU_SHX2
        select ARCH_WANT_OPTIONAL_GPIOLIB
 -      select USB_ARCH_HAS_OHCI
 -      select USB_ARCH_HAS_EHCI
        select PINCTRL
        help
          Select SH7734 if you have a SH4A SH7734 CPU.
@@@ -443,6 -456,8 +444,6 @@@ config CPU_SUBTYPE_SH775
        select CPU_SH4A
        select CPU_SHX2
        select ARCH_WANT_OPTIONAL_GPIOLIB
 -      select USB_ARCH_HAS_OHCI
 -      select USB_ARCH_HAS_EHCI
        select PINCTRL
        help
          Select SH7757 if you have a SH4A SH7757 CPU.
  config CPU_SUBTYPE_SH7763
        bool "Support SH7763 processor"
        select CPU_SH4A
 -      select USB_ARCH_HAS_OHCI
        select USB_OHCI_SH if USB_OHCI_HCD
        help
          Select SH7763 if you have a SH4A SH7763(R5S77631) CPU.
@@@ -478,7 -494,9 +479,7 @@@ config CPU_SUBTYPE_SH778
        select CPU_HAS_PTEAEX
        select GENERIC_CLOCKEVENTS_BROADCAST if SMP
        select ARCH_WANT_OPTIONAL_GPIOLIB
 -      select USB_ARCH_HAS_OHCI
        select USB_OHCI_SH if USB_OHCI_HCD
 -      select USB_ARCH_HAS_EHCI
        select USB_EHCI_SH if USB_EHCI_HCD
        select PINCTRL
  
@@@ -496,7 -514,7 +497,7 @@@ config CPU_SUBTYPE_SH734
        bool "Support SH7343 processor"
        select CPU_SH4AL_DSP
        select ARCH_SHMOBILE
 -      select SYS_SUPPORTS_CMT
 +      select SYS_SUPPORTS_SH_CMT
  
  config CPU_SUBTYPE_SH7722
        bool "Support SH7722 processor"
        select ARCH_SHMOBILE
        select ARCH_SPARSEMEM_ENABLE
        select SYS_SUPPORTS_NUMA
 -      select SYS_SUPPORTS_CMT
 +      select SYS_SUPPORTS_SH_CMT
        select ARCH_WANT_OPTIONAL_GPIOLIB
        select PINCTRL
  
@@@ -516,7 -534,7 +517,7 @@@ config CPU_SUBTYPE_SH736
        select ARCH_SHMOBILE
        select ARCH_SPARSEMEM_ENABLE
        select SYS_SUPPORTS_NUMA
 -      select SYS_SUPPORTS_CMT
 +      select SYS_SUPPORTS_SH_CMT
  
  endchoice
  
@@@ -549,6 -567,27 +550,6 @@@ source "arch/sh/boards/Kconfig
  
  menu "Timer and clock configuration"
  
 -config SH_TIMER_TMU
 -      bool "TMU timer driver"
 -      depends on SYS_SUPPORTS_TMU
 -      default y
 -      help
 -        This enables the build of the TMU timer driver.
 -
 -config SH_TIMER_CMT
 -      bool "CMT timer driver"
 -      depends on SYS_SUPPORTS_CMT
 -      default y
 -      help
 -        This enables build of the CMT timer driver.
 -
 -config SH_TIMER_MTU2
 -      bool "MTU2 timer driver"
 -      depends on SYS_SUPPORTS_MTU2
 -      default y
 -      help
 -        This enables build of the MTU2 timer driver.
 -
  config SH_PCLK_FREQ
        int "Peripheral clock frequency (in Hz)"
        depends on SH_CLK_CPG_LEGACY
@@@ -657,18 -696,32 +658,18 @@@ config SECCOM
  
          If unsure, say N.
  
 -config CC_STACKPROTECTOR
 -      bool "Enable -fstack-protector buffer overflow detection (EXPERIMENTAL)"
 -      depends on SUPERH32
 -      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.
 -
  config SMP
        bool "Symmetric multi-processing support"
        depends on SYS_SUPPORTS_SMP
        ---help---
          This enables support for systems with more than one CPU. If you have
 -        a system with only one CPU, like most personal computers, say N. If
 -        you have a system with more than one CPU, say Y.
 +        a system with only one CPU, say N. If you have a system with more
 +        than one CPU, say Y.
  
 -        If you say N here, the kernel will run on single and multiprocessor
 +        If you say N here, the kernel will run on uni- and multiprocessor
          machines, but will use only one CPU of a multiprocessor machine. If
          you say Y here, the kernel will run on many, but not all,
 -        singleprocessor machines. On a singleprocessor machine, the kernel
 +        uniprocessor machines. On a uniprocessor machine, the kernel
          will run faster if you say N here.
  
          People using multiprocessor machines who say Y here should also say
diff --combined arch/sparc/Kconfig
@@@ -13,7 -13,6 +13,7 @@@ config SPAR
        bool
        default y
        select ARCH_MIGHT_HAVE_PC_PARPORT if SPARC64 && PCI
 +      select ARCH_MIGHT_HAVE_PC_SERIO
        select OF
        select OF_PROMTREE
        select HAVE_IDE
@@@ -27,7 -26,7 +27,7 @@@
        select RTC_DRV_M48T59
        select HAVE_DMA_ATTRS
        select HAVE_DMA_API_DEBUG
 -      select HAVE_ARCH_JUMP_LABEL
 +      select HAVE_ARCH_JUMP_LABEL if SPARC64
        select GENERIC_IRQ_SHOW
        select ARCH_WANT_IPC_PARSE_VERSION
        select GENERIC_PCI_IOMAP
@@@ -77,6 -76,7 +77,7 @@@ config SPARC6
        select ARCH_HAVE_NMI_SAFE_CMPXCHG
        select HAVE_C_RECORDMCOUNT
        select NO_BOOTMEM
+       select HAVE_ARCH_AUDITSYSCALL
  
  config ARCH_DEFCONFIG
        string
@@@ -153,10 -153,10 +154,10 @@@ config SM
          a system with only one CPU, say N. If you have a system with more
          than one CPU, say Y.
  
 -        If you say N here, the kernel will run on single and multiprocessor
 +        If you say N here, the kernel will run on uni- and multiprocessor
          machines, but will use only one CPU of a multiprocessor machine. If
          you say Y here, the kernel will run on many, but not all,
 -        singleprocessor machines. On a singleprocessor machine, the kernel
 +        uniprocessor machines. On a uniprocessor machine, the kernel
          will run faster if you say N here.
  
          People using multiprocessor machines who say Y here should also say
diff --combined arch/x86/Kconfig
@@@ -23,7 -23,6 +23,7 @@@ config X8
        def_bool y
        select ARCH_HAS_DEBUG_STRICT_USER_COPY_CHECKS
        select ARCH_MIGHT_HAVE_PC_PARPORT
 +      select ARCH_MIGHT_HAVE_PC_SERIO
        select HAVE_AOUT if X86_32
        select HAVE_UNSTABLE_SCHED_CLOCK
        select ARCH_SUPPORTS_NUMA_BALANCING
@@@ -43,7 -42,6 +43,7 @@@
        select HAVE_DMA_ATTRS
        select HAVE_DMA_CONTIGUOUS if !SWIOTLB
        select HAVE_KRETPROBES
 +      select GENERIC_EARLY_IOREMAP
        select HAVE_OPTPROBES
        select HAVE_KPROBES_ON_FTRACE
        select HAVE_FTRACE_MCOUNT_RECORD
        select HAVE_ARCH_SOFT_DIRTY
        select CLOCKSOURCE_WATCHDOG
        select GENERIC_CLOCKEVENTS
 -      select ARCH_CLOCKSOURCE_DATA if X86_64
 +      select ARCH_CLOCKSOURCE_DATA
        select GENERIC_CLOCKEVENTS_BROADCAST if X86_64 || (X86_32 && X86_LOCAL_APIC)
 -      select GENERIC_TIME_VSYSCALL if X86_64
 +      select GENERIC_TIME_VSYSCALL
        select KTIME_SCALAR if X86_32
        select GENERIC_STRNCPY_FROM_USER
        select GENERIC_STRNLEN_USER
        select RTC_LIB
        select HAVE_DEBUG_STACKOVERFLOW
        select HAVE_IRQ_EXIT_ON_IRQ_STACK if X86_64
 +      select HAVE_CC_STACKPROTECTOR
 +      select GENERIC_CPU_AUTOPROBE
+       select HAVE_ARCH_AUDITSYSCALL
  
  config INSTRUCTION_DECODER
        def_bool y
@@@ -197,6 -194,9 +198,6 @@@ config ARCH_HAS_CPU_RELA
  config ARCH_HAS_CACHE_LINE_SIZE
        def_bool y
  
 -config ARCH_HAS_CPU_AUTOPROBE
 -      def_bool y
 -
  config HAVE_SETUP_PER_CPU_AREA
        def_bool y
  
@@@ -279,13 -279,13 +280,13 @@@ config SM
        bool "Symmetric multi-processing support"
        ---help---
          This enables support for systems with more than one CPU. If you have
 -        a system with only one CPU, like most personal computers, say N. If
 -        you have a system with more than one CPU, say Y.
 +        a system with only one CPU, say N. If you have a system with more
 +        than one CPU, say Y.
  
 -        If you say N here, the kernel will run on single and multiprocessor
 +        If you say N here, the kernel will run on uni- and multiprocessor
          machines, but will use only one CPU of a multiprocessor machine. If
          you say Y here, the kernel will run on many, but not all,
 -        singleprocessor machines. On a singleprocessor machine, the kernel
 +        uniprocessor machines. On a uniprocessor machine, the kernel
          will run faster if you say N here.
  
          Note that if you say Y here and choose architecture "586" or
@@@ -345,9 -345,12 +346,9 @@@ config X86_EXTENDED_PLATFOR
          for the following (non-PC) 32 bit x86 platforms:
                Goldfish (Android emulator)
                AMD Elan
 -              NUMAQ (IBM/Sequent)
                RDC R-321x SoC
                SGI 320/540 (Visual Workstation)
                STA2X11-based (e.g. Northville)
 -              Summit/EXA (IBM x440)
 -              Unisys ES7000 IA32 series
                Moorestown MID devices
  
          If you have one of these systems, or if you want to build a
@@@ -436,27 -439,42 +437,27 @@@ 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 X86_PLATFORM_DEVICES
        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"
@@@ -485,22 -503,49 +486,22 @@@ config X86_32_NON_STANDAR
        depends on X86_32 && SMP
        depends on X86_EXTENDED_PLATFORM
        ---help---
 -        This option compiles in the NUMAQ, Summit, bigsmp, ES7000,
 -        STA2X11, default subarchitectures.  It is intended for a generic
 -        binary kernel. If you select them all, kernel will probe it
 -        one by one and will fallback to default.
 +        This option compiles in the bigsmp and STA2X11 default
 +        subarchitectures.  It is intended for a generic binary
 +        kernel. If you select them all, kernel will probe it one by
 +        one and will fallback to default.
  
  # Alphabetically sorted list of Non standard 32 bit platforms
  
 -config X86_NUMAQ
 -      bool "NUMAQ (IBM/Sequent)"
 -      depends on X86_32_NON_STANDARD
 -      depends on PCI
 -      select NUMA
 -      select X86_MPPARSE
 -      ---help---
 -        This option is used for getting Linux to run on a NUMAQ (IBM/Sequent)
 -        NUMA multiquad box. This changes the way that processors are
 -        bootstrapped, and uses Clustered Logical APIC addressing mode instead
 -        of Flat Logical.  You will need a new lynxer.elf file to flash your
 -        firmware with - send email to <Martin.Bligh@us.ibm.com>.
 -
  config X86_SUPPORTS_MEMORY_FAILURE
        def_bool y
        # MCE code calls memory_failure():
        depends on X86_MCE
        # On 32-bit this adds too big of NODES_SHIFT and we run out of page flags:
 -      depends on !X86_NUMAQ
        # On 32-bit SPARSEMEM adds too big of SECTIONS_WIDTH:
        depends on X86_64 || !SPARSEMEM
        select ARCH_SUPPORTS_MEMORY_FAILURE
  
 -config X86_VISWS
 -      bool "SGI 320/540 (Visual Workstation)"
 -      depends on X86_32 && PCI && X86_MPPARSE && PCI_GODIRECT
 -      depends on X86_32_NON_STANDARD
 -      ---help---
 -        The SGI Visual Workstation series is an IA32-based workstation
 -        based on SGI systems chips with some legacy PC hardware attached.
 -
 -        Say Y here to create a kernel to run on the SGI 320 or 540.
 -
 -        A kernel compiled for the Visual Workstation will run on general
 -        PCs as well. See <file:Documentation/sgi-visws.txt> for details.
 -
  config STA2X11
        bool "STA2X11 Companion Chip Support"
        depends on X86_32_NON_STANDARD && PCI
          option is selected the kernel will still be able to boot on
          standard PC machines.
  
 -config X86_SUMMIT
 -      bool "Summit/EXA (IBM x440)"
 -      depends on X86_32_NON_STANDARD
 -      ---help---
 -        This option is needed for IBM systems that use the Summit/EXA chipset.
 -        In particular, it is needed for the x440.
 -
 -config X86_ES7000
 -      bool "Unisys ES7000 IA32 series"
 -      depends on X86_32_NON_STANDARD && X86_BIGSMP
 -      ---help---
 -        Support for Unisys ES7000 systems.  Say 'Y' here if this kernel is
 -        supposed to run on an IA32-based Unisys ES7000 system.
 -
  config X86_32_IRIS
        tristate "Eurobraille/Iris poweroff module"
        depends on X86_32
@@@ -639,6 -698,14 +640,6 @@@ config MEMTES
                memtest=4, mean do 4 test patterns.
          If you are unsure how to answer this question, answer N.
  
 -config X86_SUMMIT_NUMA
 -      def_bool y
 -      depends on X86_32 && NUMA && X86_32_NON_STANDARD
 -
 -config X86_CYCLONE_TIMER
 -      def_bool y
 -      depends on X86_SUMMIT
 -
  source "arch/x86/Kconfig.cpu"
  
  config HPET_TIMER
@@@ -680,7 -747,6 +681,7 @@@ config APB_TIME
  # The code disables itself when not needed.
  config DMI
        default y
 +      select DMI_SCAN_MACHINE_NON_EFI_FALLBACK
        bool "Enable DMI scanning" if EXPERT
        ---help---
          Enabled scanning of DMI to identify machine quirks. Say Y
@@@ -767,7 -833,7 +768,7 @@@ config NR_CPU
        range 2 8192 if SMP && !MAXSMP && CPUMASK_OFFSTACK && X86_64
        default "1" if !SMP
        default "8192" if MAXSMP
 -      default "32" if SMP && (X86_NUMAQ || X86_SUMMIT || X86_BIGSMP || X86_ES7000)
 +      default "32" if SMP && X86_BIGSMP
        default "8" if SMP
        ---help---
          This allows you to specify the maximum number of CPUs which this
@@@ -831,6 -897,10 +832,6 @@@ config X86_IO_API
        def_bool y
        depends on X86_64 || SMP || X86_32_NON_STANDARD || X86_UP_IOAPIC || PCI_MSI
  
 -config X86_VISWS_APIC
 -      def_bool y
 -      depends on X86_32 && X86_VISWS
 -
  config X86_REROUTE_FOR_BROKEN_BOOT_IRQS
        bool "Reroute for broken boot IRQs"
        depends on X86_IO_APIC
@@@ -884,7 -954,7 +885,7 @@@ config X86_ANCIENT_MC
        depends on X86_32 && X86_MCE
        ---help---
          Include support for machine check handling on old Pentium 5 or WinChip
 -        systems. These typically need to be enabled explicitely on the command
 +        systems. These typically need to be enabled explicitly on the command
          line.
  
  config X86_MCE_THRESHOLD
@@@ -995,9 -1065,9 +996,9 @@@ config MICROCODE_INTE
          This options enables microcode patch loading support for Intel
          processors.
  
 -        For latest news and information on obtaining all the required
 -        Intel ingredients for this driver, check:
 -        <http://www.urbanmyth.org/microcode/>.
 +        For the current Intel microcode data package go to
 +        <https://downloadcenter.intel.com> and search for
 +        'Linux Processor Microcode Data File'.
  
  config MICROCODE_AMD
        bool "AMD microcode loading support"
@@@ -1011,6 -1081,10 +1012,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
  
@@@ -1048,11 -1122,13 +1049,11 @@@ config X86_CPUI
  
  choice
        prompt "High Memory Support"
 -      default HIGHMEM64G if X86_NUMAQ
        default HIGHMEM4G
        depends on X86_32
  
  config NOHIGHMEM
        bool "off"
 -      depends on !X86_NUMAQ
        ---help---
          Linux can use up to 64 Gigabytes of physical memory on x86 systems.
          However, the address space of 32-bit x86 processors is only 4
  
  config HIGHMEM4G
        bool "4GB"
 -      depends on !X86_NUMAQ
        ---help---
          Select this if you have a 32-bit processor and between 1 and 4
          gigabytes of physical RAM.
@@@ -1180,8 -1257,8 +1181,8 @@@ config DIRECT_GBPAGE
  config NUMA
        bool "Numa Memory Allocation and Scheduler Support"
        depends on SMP
 -      depends on X86_64 || (X86_32 && HIGHMEM64G && (X86_NUMAQ || X86_BIGSMP || X86_SUMMIT && ACPI))
 -      default y if (X86_NUMAQ || X86_SUMMIT || X86_BIGSMP)
 +      depends on X86_64 || (X86_32 && HIGHMEM64G && X86_BIGSMP)
 +      default y if X86_BIGSMP
        ---help---
          Enable NUMA (Non Uniform Memory Access) support.
  
          For 64-bit this is recommended if the system is Intel Core i7
          (or later), AMD Opteron, or EM64T NUMA.
  
 -        For 32-bit this is only needed on (rare) 32-bit-only platforms
 -        that support NUMA topologies, such as NUMAQ / Summit, or if you
 -        boot a 32-bit kernel on a 64-bit NUMA platform.
 +        For 32-bit this is only needed if you boot a 32-bit
 +        kernel on a 64-bit NUMA platform.
  
          Otherwise, you should say N.
  
 -comment "NUMA (Summit) requires SMP, 64GB highmem support, ACPI"
 -      depends on X86_32 && X86_SUMMIT && (!HIGHMEM64G || !ACPI)
 -
  config AMD_NUMA
        def_bool y
        prompt "Old style AMD Opteron NUMA detection"
@@@ -1238,6 -1319,7 +1239,6 @@@ config NODES_SHIF
        range 1 10
        default "10" if MAXSMP
        default "6" if X86_64
 -      default "4" if X86_NUMAQ
        default "3"
        depends on NEED_MULTIPLE_NODES
        ---help---
@@@ -1520,20 -1602,6 +1521,20 @@@ config EFI_STU
  
          See Documentation/efi-stub.txt for more information.
  
 +config EFI_MIXED
 +      bool "EFI mixed-mode support"
 +      depends on EFI_STUB && X86_64
 +      ---help---
 +         Enabling this feature allows a 64-bit kernel to be booted
 +         on a 32-bit firmware, provided that your CPU supports 64-bit
 +         mode.
 +
 +         Note that it is not possible to boot a mixed-mode enabled
 +         kernel via the EFI boot stub - a bootloader that supports
 +         the EFI handover protocol must be used.
 +
 +         If unsure, say N.
 +
  config SECCOMP
        def_bool y
        prompt "Enable seccomp to safely compute untrusted bytecode"
  
          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
@@@ -1645,67 -1729,16 +1646,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---
@@@ -1785,29 -1818,17 +1786,29 @@@ config DEBUG_HOTPLUG_CPU
          If unsure, say N.
  
  config COMPAT_VDSO
 -      def_bool y
 -      prompt "Compat VDSO support"
 +      def_bool n
 +      prompt "Disable the 32-bit vDSO (needed for glibc 2.3.3)"
        depends on X86_32 || IA32_EMULATION
        ---help---
 -        Map the 32-bit VDSO to the predictable old-style address too.
 +        Certain buggy versions of glibc will crash if they are
 +        presented with a 32-bit vDSO that is not mapped at the address
 +        indicated in its segment table.
  
 -        Say N here if you are running a sufficiently recent glibc
 -        version (2.3.3 or later), to remove the high-mapped
 -        VDSO mapping and to exclusively use the randomized VDSO.
 +        The bug was introduced by f866314b89d56845f55e6f365e18b31ec978ec3a
 +        and fixed by 3b3ddb4f7db98ec9e912ccdf54d35df4aa30e04a and
 +        49ad572a70b8aeb91e57483a11dd1b77e31c4468.  Glibc 2.3.3 is
 +        the only released version with the bug, but OpenSUSE 9
 +        contains a buggy "glibc 2.3.2".
  
 -        If unsure, say Y.
 +        The symptom of the bug is that everything crashes on startup, saying:
 +        dl_main: Assertion `(void *) ph->p_vaddr == _rtld_local._dl_sysinfo_dso' failed!
 +
 +        Saying Y here changes the default value of the vdso32 boot
 +        option from 1 to 0, which turns off the 32-bit vDSO entirely.
 +        This works around the glibc bug but hurts performance.
 +
 +        If unsure, say N: if you are compiling your own kernel, you
 +        are unlikely to be using a buggy version of glibc.
  
  config CMDLINE_BOOL
        bool "Built-in kernel command line"
@@@ -2373,14 -2394,6 +2374,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 fs/proc/base.c
@@@ -200,41 -200,9 +200,9 @@@ static int proc_root_link(struct dentr
        return result;
  }
  
- static int proc_pid_cmdline(struct task_struct *task, char * buffer)
+ static int proc_pid_cmdline(struct task_struct *task, char *buffer)
  {
-       int res = 0;
-       unsigned int len;
-       struct mm_struct *mm = get_task_mm(task);
-       if (!mm)
-               goto out;
-       if (!mm->arg_end)
-               goto out_mm;    /* Shh! No looking before we're done */
-       len = mm->arg_end - mm->arg_start;
-  
-       if (len > PAGE_SIZE)
-               len = PAGE_SIZE;
-  
-       res = access_process_vm(task, mm->arg_start, buffer, len, 0);
-       // If the nul at the end of args has been overwritten, then
-       // assume application is using setproctitle(3).
-       if (res > 0 && buffer[res-1] != '\0' && len < PAGE_SIZE) {
-               len = strnlen(buffer, res);
-               if (len < res) {
-                   res = len;
-               } else {
-                       len = mm->env_end - mm->env_start;
-                       if (len > PAGE_SIZE - res)
-                               len = PAGE_SIZE - res;
-                       res += access_process_vm(task, mm->env_start, buffer+res, len, 0);
-                       res = strnlen(buffer, res);
-               }
-       }
- out_mm:
-       mmput(mm);
- out:
-       return res;
+       return get_cmdline(task, buffer, PAGE_SIZE);
  }
  
  static int proc_pid_auxv(struct task_struct *task, char *buffer)
@@@ -1236,9 -1204,6 +1204,9 @@@ static ssize_t proc_fault_inject_write(
        make_it_fail = simple_strtol(strstrip(buffer), &end, 0);
        if (*end)
                return -EINVAL;
 +      if (make_it_fail < 0 || make_it_fail > 1)
 +              return -EINVAL;
 +
        task = get_proc_task(file_inode(file));
        if (!task)
                return -ESRCH;
@@@ -1661,18 -1626,13 +1629,18 @@@ int pid_revalidate(struct dentry *dentr
        return 0;
  }
  
 +static inline bool proc_inode_is_dead(struct inode *inode)
 +{
 +      return !proc_pid(inode)->tasks[PIDTYPE_PID].first;
 +}
 +
  int pid_delete_dentry(const struct dentry *dentry)
  {
        /* Is the task we represent dead?
         * If so, then don't put the dentry on the lru list,
         * kill it immediately.
         */
 -      return !proc_pid(dentry->d_inode)->tasks[PIDTYPE_PID].first;
 +      return proc_inode_is_dead(dentry->d_inode);
  }
  
  const struct dentry_operations pid_dentry_operations =
@@@ -1827,7 -1787,6 +1795,7 @@@ static int proc_map_files_get_link(stru
        if (rc)
                goto out_mmput;
  
 +      rc = -ENOENT;
        down_read(&mm->mmap_sem);
        vma = find_exact_vma(mm, vm_start, vm_end);
        if (vma && vma->vm_file) {
@@@ -2591,7 -2550,7 +2559,7 @@@ static const struct pid_entry tgid_base
        REG("environ",    S_IRUSR, proc_environ_operations),
        INF("auxv",       S_IRUSR, proc_pid_auxv),
        ONE("status",     S_IRUGO, proc_pid_status),
 -      ONE("personality", S_IRUGO, proc_pid_personality),
 +      ONE("personality", S_IRUSR, proc_pid_personality),
        INF("limits",     S_IRUGO, proc_pid_limits),
  #ifdef CONFIG_SCHED_DEBUG
        REG("sched",      S_IRUGO|S_IWUSR, proc_pid_sched_operations),
  #endif
        REG("comm",      S_IRUGO|S_IWUSR, proc_pid_set_comm_operations),
  #ifdef CONFIG_HAVE_ARCH_TRACEHOOK
 -      INF("syscall",    S_IRUGO, proc_pid_syscall),
 +      INF("syscall",    S_IRUSR, proc_pid_syscall),
  #endif
        INF("cmdline",    S_IRUGO, proc_pid_cmdline),
        ONE("stat",       S_IRUGO, proc_tgid_stat),
  #ifdef CONFIG_PROC_PAGE_MONITOR
        REG("clear_refs", S_IWUSR, proc_clear_refs_operations),
        REG("smaps",      S_IRUGO, proc_pid_smaps_operations),
 -      REG("pagemap",    S_IRUGO, proc_pagemap_operations),
 +      REG("pagemap",    S_IRUSR, proc_pagemap_operations),
  #endif
  #ifdef CONFIG_SECURITY
        DIR("attr",       S_IRUGO|S_IXUGO, proc_attr_dir_inode_operations, proc_attr_dir_operations),
        INF("wchan",      S_IRUGO, proc_pid_wchan),
  #endif
  #ifdef CONFIG_STACKTRACE
 -      ONE("stack",      S_IRUGO, proc_pid_stack),
 +      ONE("stack",      S_IRUSR, proc_pid_stack),
  #endif
  #ifdef CONFIG_SCHEDSTATS
        INF("schedstat",  S_IRUGO, proc_pid_schedstat),
@@@ -2930,14 -2889,14 +2898,14 @@@ static const struct pid_entry tid_base_
        REG("environ",   S_IRUSR, proc_environ_operations),
        INF("auxv",      S_IRUSR, proc_pid_auxv),
        ONE("status",    S_IRUGO, proc_pid_status),
 -      ONE("personality", S_IRUGO, proc_pid_personality),
 +      ONE("personality", S_IRUSR, proc_pid_personality),
        INF("limits",    S_IRUGO, proc_pid_limits),
  #ifdef CONFIG_SCHED_DEBUG
        REG("sched",     S_IRUGO|S_IWUSR, proc_pid_sched_operations),
  #endif
        REG("comm",      S_IRUGO|S_IWUSR, proc_pid_set_comm_operations),
  #ifdef CONFIG_HAVE_ARCH_TRACEHOOK
 -      INF("syscall",   S_IRUGO, proc_pid_syscall),
 +      INF("syscall",   S_IRUSR, proc_pid_syscall),
  #endif
        INF("cmdline",   S_IRUGO, proc_pid_cmdline),
        ONE("stat",      S_IRUGO, proc_tid_stat),
  #ifdef CONFIG_PROC_PAGE_MONITOR
        REG("clear_refs", S_IWUSR, proc_clear_refs_operations),
        REG("smaps",     S_IRUGO, proc_tid_smaps_operations),
 -      REG("pagemap",    S_IRUGO, proc_pagemap_operations),
 +      REG("pagemap",    S_IRUSR, proc_pagemap_operations),
  #endif
  #ifdef CONFIG_SECURITY
        DIR("attr",      S_IRUGO|S_IXUGO, proc_attr_dir_inode_operations, proc_attr_dir_operations),
        INF("wchan",     S_IRUGO, proc_pid_wchan),
  #endif
  #ifdef CONFIG_STACKTRACE
 -      ONE("stack",      S_IRUGO, proc_pid_stack),
 +      ONE("stack",      S_IRUSR, proc_pid_stack),
  #endif
  #ifdef CONFIG_SCHEDSTATS
        INF("schedstat", S_IRUGO, proc_pid_schedstat),
@@@ -3101,42 -3060,34 +3069,42 @@@ out_no_task
   * In the case of a seek we start with the leader and walk nr
   * threads past it.
   */
 -static struct task_struct *first_tid(struct task_struct *leader,
 -              int tid, int nr, struct pid_namespace *ns)
 +static struct task_struct *first_tid(struct pid *pid, int tid, loff_t f_pos,
 +                                      struct pid_namespace *ns)
  {
 -      struct task_struct *pos;
 +      struct task_struct *pos, *task;
 +      unsigned long nr = f_pos;
 +
 +      if (nr != f_pos)        /* 32bit overflow? */
 +              return NULL;
  
        rcu_read_lock();
 -      /* Attempt to start with the pid of a thread */
 -      if (tid && (nr > 0)) {
 +      task = pid_task(pid, PIDTYPE_PID);
 +      if (!task)
 +              goto fail;
 +
 +      /* Attempt to start with the tid of a thread */
 +      if (tid && nr) {
                pos = find_task_by_pid_ns(tid, ns);
 -              if (pos && (pos->group_leader == leader))
 +              if (pos && same_thread_group(pos, task))
                        goto found;
        }
  
        /* If nr exceeds the number of threads there is nothing todo */
 -      pos = NULL;
 -      if (nr && nr >= get_nr_threads(leader))
 -              goto out;
 +      if (nr >= get_nr_threads(task))
 +              goto fail;
  
        /* If we haven't found our starting place yet start
         * with the leader and walk nr threads forward.
         */
 -      for (pos = leader; nr > 0; --nr) {
 -              pos = next_thread(pos);
 -              if (pos == leader) {
 -                      pos = NULL;
 -                      goto out;
 -              }
 -      }
 +      pos = task = task->group_leader;
 +      do {
 +              if (!nr--)
 +                      goto found;
 +      } while_each_thread(task, pos);
 +fail:
 +      pos = NULL;
 +      goto out;
  found:
        get_task_struct(pos);
  out:
@@@ -3169,16 -3120,25 +3137,16 @@@ static struct task_struct *next_tid(str
  /* for the /proc/TGID/task/ directories */
  static int proc_task_readdir(struct file *file, struct dir_context *ctx)
  {
 -      struct task_struct *leader = NULL;
 -      struct task_struct *task = get_proc_task(file_inode(file));
 +      struct inode *inode = file_inode(file);
 +      struct task_struct *task;
        struct pid_namespace *ns;
        int tid;
  
 -      if (!task)
 -              return -ENOENT;
 -      rcu_read_lock();
 -      if (pid_alive(task)) {
 -              leader = task->group_leader;
 -              get_task_struct(leader);
 -      }
 -      rcu_read_unlock();
 -      put_task_struct(task);
 -      if (!leader)
 +      if (proc_inode_is_dead(inode))
                return -ENOENT;
  
        if (!dir_emit_dots(file, ctx))
 -              goto out;
 +              return 0;
  
        /* f_version caches the tgid value that the last readdir call couldn't
         * return. lseek aka telldir automagically resets f_version to 0.
        ns = file->f_dentry->d_sb->s_fs_info;
        tid = (int)file->f_version;
        file->f_version = 0;
 -      for (task = first_tid(leader, tid, ctx->pos - 2, ns);
 +      for (task = first_tid(proc_pid(inode), tid, ctx->pos - 2, ns);
             task;
             task = next_tid(task), ctx->pos++) {
                char name[PROC_NUMBUF];
                        break;
                }
        }
 -out:
 -      put_task_struct(leader);
 +
        return 0;
  }
  
diff --combined include/linux/mm.h
@@@ -5,7 -5,6 +5,7 @@@
  
  #ifdef __KERNEL__
  
 +#include <linux/mmdebug.h>
  #include <linux/gfp.h>
  #include <linux/bug.h>
  #include <linux/list.h>
@@@ -58,15 -57,6 +58,15 @@@ extern int sysctl_legacy_va_layout
  extern unsigned long sysctl_user_reserve_kbytes;
  extern unsigned long sysctl_admin_reserve_kbytes;
  
 +extern int sysctl_overcommit_memory;
 +extern int sysctl_overcommit_ratio;
 +extern unsigned long sysctl_overcommit_kbytes;
 +
 +extern int overcommit_ratio_handler(struct ctl_table *, int, void __user *,
 +                                  size_t *, loff_t *);
 +extern int overcommit_kbytes_handler(struct ctl_table *, int, void __user *,
 +                                  size_t *, loff_t *);
 +
  #define nth_page(page,n) pfn_to_page(page_to_pfn((page)) + (n))
  
  /* to align the pointer to the (next) page boundary */
@@@ -175,10 -165,7 +175,10 @@@ extern unsigned int kobjsize(const voi
   * Special vmas that are non-mergable, non-mlock()able.
   * Note: mm/huge_memory.c VM_NO_THP depends on this definition.
   */
 -#define VM_SPECIAL (VM_IO | VM_DONTEXPAND | VM_PFNMAP)
 +#define VM_SPECIAL (VM_IO | VM_DONTEXPAND | VM_PFNMAP | VM_MIXEDMAP)
 +
 +/* This mask defines which mm->def_flags a process can inherit its parent */
 +#define VM_INIT_DEF_MASK      VM_NOHUGEPAGE
  
  /*
   * mapping from the currently active vm_flags protection bits (the
@@@ -213,10 -200,6 +213,10 @@@ struct vm_fault 
                                         * is set (which is also implied by
                                         * VM_FAULT_ERROR).
                                         */
 +      /* for ->map_pages() only */
 +      pgoff_t max_pgoff;              /* map pages for offset from pgoff till
 +                                       * max_pgoff inclusive */
 +      pte_t *pte;                     /* pte entry associated with ->pgoff */
  };
  
  /*
@@@ -228,7 -211,6 +228,7 @@@ struct vm_operations_struct 
        void (*open)(struct vm_area_struct * area);
        void (*close)(struct vm_area_struct * area);
        int (*fault)(struct vm_area_struct *vma, struct vm_fault *vmf);
 +      void (*map_pages)(struct vm_area_struct *vma, struct vm_fault *vmf);
  
        /* notification that a previously read-only page is about to become
         * writable, if an error is returned it will cause a SIGBUS */
@@@ -312,7 -294,7 +312,7 @@@ static inline int get_freepage_migratet
   */
  static inline int put_page_testzero(struct page *page)
  {
 -      VM_BUG_ON(atomic_read(&page->_count) == 0);
 +      VM_BUG_ON_PAGE(atomic_read(&page->_count) == 0, page);
        return atomic_dec_and_test(&page->_count);
  }
  
@@@ -373,7 -355,7 +373,7 @@@ static inline int is_vmalloc_or_module_
  static inline void compound_lock(struct page *page)
  {
  #ifdef CONFIG_TRANSPARENT_HUGEPAGE
 -      VM_BUG_ON(PageSlab(page));
 +      VM_BUG_ON_PAGE(PageSlab(page), page);
        bit_spin_lock(PG_compound_lock, &page->flags);
  #endif
  }
  static inline void compound_unlock(struct page *page)
  {
  #ifdef CONFIG_TRANSPARENT_HUGEPAGE
 -      VM_BUG_ON(PageSlab(page));
 +      VM_BUG_ON_PAGE(PageSlab(page), page);
        bit_spin_unlock(PG_compound_lock, &page->flags);
  #endif
  }
@@@ -407,18 -389,8 +407,18 @@@ static inline void compound_unlock_irqr
  
  static inline struct page *compound_head(struct page *page)
  {
 -      if (unlikely(PageTail(page)))
 -              return page->first_page;
 +      if (unlikely(PageTail(page))) {
 +              struct page *head = page->first_page;
 +
 +              /*
 +               * page->first_page may be a dangling pointer to an old
 +               * compound page, so recheck that it is still a tail
 +               * page before returning.
 +               */
 +              smp_rmb();
 +              if (likely(PageTail(page)))
 +                      return head;
 +      }
        return page;
  }
  
@@@ -442,44 -414,15 +442,44 @@@ static inline int page_count(struct pag
        return atomic_read(&compound_head(page)->_count);
  }
  
 +#ifdef CONFIG_HUGETLB_PAGE
 +extern int PageHeadHuge(struct page *page_head);
 +#else /* CONFIG_HUGETLB_PAGE */
 +static inline int PageHeadHuge(struct page *page_head)
 +{
 +      return 0;
 +}
 +#endif /* CONFIG_HUGETLB_PAGE */
 +
 +static inline bool __compound_tail_refcounted(struct page *page)
 +{
 +      return !PageSlab(page) && !PageHeadHuge(page);
 +}
 +
 +/*
 + * This takes a head page as parameter and tells if the
 + * tail page reference counting can be skipped.
 + *
 + * For this to be safe, PageSlab and PageHeadHuge must remain true on
 + * any given page where they return true here, until all tail pins
 + * have been released.
 + */
 +static inline bool compound_tail_refcounted(struct page *page)
 +{
 +      VM_BUG_ON_PAGE(!PageHead(page), page);
 +      return __compound_tail_refcounted(page);
 +}
 +
  static inline void get_huge_page_tail(struct page *page)
  {
        /*
 -       * __split_huge_page_refcount() cannot run
 -       * from under us.
 +       * __split_huge_page_refcount() cannot run from under us.
         */
 -      VM_BUG_ON(page_mapcount(page) < 0);
 -      VM_BUG_ON(atomic_read(&page->_count) != 0);
 -      atomic_inc(&page->_mapcount);
 +      VM_BUG_ON_PAGE(!PageTail(page), page);
 +      VM_BUG_ON_PAGE(page_mapcount(page) < 0, page);
 +      VM_BUG_ON_PAGE(atomic_read(&page->_count) != 0, page);
 +      if (compound_tail_refcounted(page->first_page))
 +              atomic_inc(&page->_mapcount);
  }
  
  extern bool __get_page_tail(struct page *page);
@@@ -493,7 -436,7 +493,7 @@@ static inline void get_page(struct pag
         * Getting a normal page or the head of a compound page
         * requires to already have an elevated page->_count.
         */
 -      VM_BUG_ON(atomic_read(&page->_count) <= 0);
 +      VM_BUG_ON_PAGE(atomic_read(&page->_count) <= 0, page);
        atomic_inc(&page->_count);
  }
  
@@@ -530,13 -473,13 +530,13 @@@ static inline int PageBuddy(struct pag
  
  static inline void __SetPageBuddy(struct page *page)
  {
 -      VM_BUG_ON(atomic_read(&page->_mapcount) != -1);
 +      VM_BUG_ON_PAGE(atomic_read(&page->_mapcount) != -1, page);
        atomic_set(&page->_mapcount, PAGE_BUDDY_MAPCOUNT_VALUE);
  }
  
  static inline void __ClearPageBuddy(struct page *page)
  {
 -      VM_BUG_ON(!PageBuddy(page));
 +      VM_BUG_ON_PAGE(!PageBuddy(page), page);
        atomic_set(&page->_mapcount, -1);
  }
  
@@@ -589,9 -532,6 +589,9 @@@ static inline pte_t maybe_mkwrite(pte_
                pte = pte_mkwrite(pte);
        return pte;
  }
 +
 +void do_set_pte(struct vm_area_struct *vma, unsigned long address,
 +              struct page *page, pte_t *pte, bool write, bool anon);
  #endif
  
  /*
  #define ZONES_MASK            ((1UL << ZONES_WIDTH) - 1)
  #define NODES_MASK            ((1UL << NODES_WIDTH) - 1)
  #define SECTIONS_MASK         ((1UL << SECTIONS_WIDTH) - 1)
 -#define LAST_CPUPID_MASK      ((1UL << LAST_CPUPID_WIDTH) - 1)
 +#define LAST_CPUPID_MASK      ((1UL << LAST_CPUPID_SHIFT) - 1)
  #define ZONEID_MASK           ((1UL << ZONEID_SHIFT) - 1)
  
  static inline enum zone_type page_zonenum(const struct page *page)
@@@ -778,7 -718,7 +778,7 @@@ static inline bool __cpupid_match_pid(p
  #ifdef LAST_CPUPID_NOT_IN_PAGE_FLAGS
  static inline int page_cpupid_xchg_last(struct page *page, int cpupid)
  {
 -      return xchg(&page->_last_cpupid, cpupid);
 +      return xchg(&page->_last_cpupid, cpupid & LAST_CPUPID_MASK);
  }
  
  static inline int page_cpupid_last(struct page *page)
  }
  static inline void page_cpupid_reset_last(struct page *page)
  {
 -      page->_last_cpupid = -1;
 +      page->_last_cpupid = -1 & LAST_CPUPID_MASK;
  }
  #else
  static inline int page_cpupid_last(struct page *page)
@@@ -906,14 -846,11 +906,14 @@@ static __always_inline void *lowmem_pag
  #endif
  
  #if defined(WANT_PAGE_VIRTUAL)
 -#define page_address(page) ((page)->virtual)
 -#define set_page_address(page, address)                       \
 -      do {                                            \
 -              (page)->virtual = (address);            \
 -      } while(0)
 +static inline void *page_address(const struct page *page)
 +{
 +      return page->virtual;
 +}
 +static inline void set_page_address(struct page *page, void *address)
 +{
 +      page->virtual = address;
 +}
  #define page_address_init()  do { } while(0)
  #endif
  
@@@ -1047,19 -984,12 +1047,19 @@@ extern void pagefault_out_of_memory(voi
   * various contexts.
   */
  #define SHOW_MEM_FILTER_NODES         (0x0001u)       /* disallowed nodes */
 -#define SHOW_MEM_FILTER_PAGE_COUNT    (0x0002u)       /* page type count */
  
  extern void show_free_areas(unsigned int flags);
  extern bool skip_free_areas_node(unsigned int flags, int nid);
  
  int shmem_zero_setup(struct vm_area_struct *);
 +#ifdef CONFIG_SHMEM
 +bool shmem_mapping(struct address_space *mapping);
 +#else
 +static inline bool shmem_mapping(struct address_space *mapping)
 +{
 +      return false;
 +}
 +#endif
  
  extern int can_do_mlock(void);
  extern int user_shm_lock(size_t, struct user_struct *);
@@@ -1204,6 -1134,7 +1204,7 @@@ void account_page_writeback(struct pag
  int set_page_dirty(struct page *page);
  int set_page_dirty_lock(struct page *page);
  int clear_page_dirty_for_io(struct page *page);
+ int get_cmdline(struct task_struct *task, char *buffer, int buflen);
  
  /* Is the vma a continuation of the stack vma above it? */
  static inline int vma_growsdown(struct vm_area_struct *vma, unsigned long addr)
@@@ -1388,7 -1319,6 +1389,7 @@@ static inline pmd_t *pmd_alloc(struct m
  
  #if USE_SPLIT_PTE_PTLOCKS
  #if ALLOC_SPLIT_PTLOCKS
 +void __init ptlock_cache_init(void);
  extern bool ptlock_alloc(struct page *page);
  extern void ptlock_free(struct page *page);
  
@@@ -1397,10 -1327,6 +1398,10 @@@ static inline spinlock_t *ptlock_ptr(st
        return page->ptl;
  }
  #else /* ALLOC_SPLIT_PTLOCKS */
 +static inline void ptlock_cache_init(void)
 +{
 +}
 +
  static inline bool ptlock_alloc(struct page *page)
  {
        return true;
@@@ -1431,7 -1357,7 +1432,7 @@@ static inline bool ptlock_init(struct p
         * slab code uses page->slab_cache and page->first_page (for tail
         * pages), which share storage with page->ptl.
         */
 -      VM_BUG_ON(*(unsigned long *)&page->ptl);
 +      VM_BUG_ON_PAGE(*(unsigned long *)&page->ptl, page);
        if (!ptlock_alloc(page))
                return false;
        spin_lock_init(ptlock_ptr(page));
@@@ -1453,17 -1379,10 +1454,17 @@@ static inline spinlock_t *pte_lockptr(s
  {
        return &mm->page_table_lock;
  }
 +static inline void ptlock_cache_init(void) {}
  static inline bool ptlock_init(struct page *page) { return true; }
  static inline void pte_lock_deinit(struct page *page) {}
  #endif /* USE_SPLIT_PTE_PTLOCKS */
  
 +static inline void pgtable_init(void)
 +{
 +      ptlock_cache_init();
 +      pgtable_cache_init();
 +}
 +
  static inline bool pgtable_page_ctor(struct page *page)
  {
        inc_zone_page_state(page, NR_PAGETABLE);
@@@ -1506,15 -1425,9 +1507,15 @@@ static inline void pgtable_page_dtor(st
  
  #if USE_SPLIT_PMD_PTLOCKS
  
 +static struct page *pmd_to_page(pmd_t *pmd)
 +{
 +      unsigned long mask = ~(PTRS_PER_PMD * sizeof(pmd_t) - 1);
 +      return virt_to_page((void *)((unsigned long) pmd & mask));
 +}
 +
  static inline spinlock_t *pmd_lockptr(struct mm_struct *mm, pmd_t *pmd)
  {
 -      return ptlock_ptr(virt_to_page(pmd));
 +      return ptlock_ptr(pmd_to_page(pmd));
  }
  
  static inline bool pgtable_pmd_page_ctor(struct page *page)
  static inline void pgtable_pmd_page_dtor(struct page *page)
  {
  #ifdef CONFIG_TRANSPARENT_HUGEPAGE
 -      VM_BUG_ON(page->pmd_huge_pte);
 +      VM_BUG_ON_PAGE(page->pmd_huge_pte, page);
  #endif
        ptlock_free(page);
  }
  
 -#define pmd_huge_pte(mm, pmd) (virt_to_page(pmd)->pmd_huge_pte)
 +#define pmd_huge_pte(mm, pmd) (pmd_to_page(pmd)->pmd_huge_pte)
  
  #else
  
@@@ -1677,8 -1590,10 +1678,8 @@@ static inline int __early_pfn_to_nid(un
  #else
  /* please see mm/page_alloc.c */
  extern int __meminit early_pfn_to_nid(unsigned long pfn);
 -#ifdef CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID
  /* there is a per-arch backend function. */
  extern int __meminit __early_pfn_to_nid(unsigned long pfn);
 -#endif /* CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID */
  #endif
  
  extern void set_dma_reserve(unsigned long new_dma_reserve);
@@@ -1773,9 -1688,6 +1774,9 @@@ extern void set_mm_exe_file(struct mm_s
  extern struct file *get_mm_exe_file(struct mm_struct *mm);
  
  extern int may_expand_vm(struct mm_struct *mm, unsigned long npages);
 +extern struct vm_area_struct *_install_special_mapping(struct mm_struct *mm,
 +                                 unsigned long addr, unsigned long len,
 +                                 unsigned long flags, struct page **pages);
  extern int install_special_mapping(struct mm_struct *mm,
                                   unsigned long addr, unsigned long len,
                                   unsigned long flags, struct page **pages);
@@@ -1843,11 -1755,9 +1844,11 @@@ vm_unmapped_area(struct vm_unmapped_are
  extern void truncate_inode_pages(struct address_space *, loff_t);
  extern void truncate_inode_pages_range(struct address_space *,
                                       loff_t lstart, loff_t lend);
 +extern void truncate_inode_pages_final(struct address_space *);
  
  /* generic vm_area_ops exported for stackable file systems */
  extern int filemap_fault(struct vm_area_struct *, struct vm_fault *);
 +extern void filemap_map_pages(struct vm_area_struct *vma, struct vm_fault *vmf);
  extern int filemap_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf);
  
  /* mm/page-writeback.c */
@@@ -1875,6 -1785,9 +1876,6 @@@ void page_cache_async_readahead(struct 
                                unsigned long size);
  
  unsigned long max_sane_readahead(unsigned long nr);
 -unsigned long ra_submit(struct file_ra_state *ra,
 -                      struct address_space *mapping,
 -                      struct file *filp);
  
  /* Generic expand stack which grows the stack according to GROWS{UP,DOWN} */
  extern int expand_stack(struct vm_area_struct *vma, unsigned long address);
@@@ -1930,7 -1843,7 +1931,7 @@@ static inline pgprot_t vm_get_page_prot
  }
  #endif
  
 -#ifdef CONFIG_ARCH_USES_NUMA_PROT_NONE
 +#ifdef CONFIG_NUMA_BALANCING
  unsigned long change_prot_numa(struct vm_area_struct *vma,
                        unsigned long start, unsigned long end);
  #endif
@@@ -2065,6 -1978,8 +2066,6 @@@ extern void shake_page(struct page *p, 
  extern atomic_long_t num_poisoned_pages;
  extern int soft_offline_page(struct page *page, int flags);
  
 -extern void dump_page(struct page *page);
 -
  #if defined(CONFIG_TRANSPARENT_HUGEPAGE) || defined(CONFIG_HUGETLBFS)
  extern void clear_huge_page(struct page *page,
                            unsigned long addr,
diff --combined include/linux/sched.h
@@@ -3,8 -3,6 +3,8 @@@
  
  #include <uapi/linux/sched.h>
  
 +#include <linux/sched/prio.h>
 +
  
  struct sched_param {
        int sched_priority;
@@@ -18,7 -16,6 +18,7 @@@
  #include <linux/types.h>
  #include <linux/timex.h>
  #include <linux/jiffies.h>
 +#include <linux/plist.h>
  #include <linux/rbtree.h>
  #include <linux/thread_info.h>
  #include <linux/cpumask.h>
@@@ -29,7 -26,7 +29,7 @@@
  
  #include <asm/page.h>
  #include <asm/ptrace.h>
 -#include <asm/cputime.h>
 +#include <linux/cputime.h>
  
  #include <linux/smp.h>
  #include <linux/sem.h>
  
  #include <asm/processor.h>
  
 +#define SCHED_ATTR_SIZE_VER0  48      /* sizeof first published struct */
 +
 +/*
 + * Extended scheduling parameters data structure.
 + *
 + * This is needed because the original struct sched_param can not be
 + * altered without introducing ABI issues with legacy applications
 + * (e.g., in sched_getparam()).
 + *
 + * However, the possibility of specifying more than just a priority for
 + * the tasks may be useful for a wide variety of application fields, e.g.,
 + * multimedia, streaming, automation and control, and many others.
 + *
 + * This variant (sched_attr) is meant at describing a so-called
 + * sporadic time-constrained task. In such model a task is specified by:
 + *  - the activation period or minimum instance inter-arrival time;
 + *  - the maximum (or average, depending on the actual scheduling
 + *    discipline) computation time of all instances, a.k.a. runtime;
 + *  - the deadline (relative to the actual activation time) of each
 + *    instance.
 + * Very briefly, a periodic (sporadic) task asks for the execution of
 + * some specific computation --which is typically called an instance--
 + * (at most) every period. Moreover, each instance typically lasts no more
 + * than the runtime and must be completed by time instant t equal to
 + * the instance activation time + the deadline.
 + *
 + * This is reflected by the actual fields of the sched_attr structure:
 + *
 + *  @size             size of the structure, for fwd/bwd compat.
 + *
 + *  @sched_policy     task's scheduling policy
 + *  @sched_flags      for customizing the scheduler behaviour
 + *  @sched_nice               task's nice value      (SCHED_NORMAL/BATCH)
 + *  @sched_priority   task's static priority (SCHED_FIFO/RR)
 + *  @sched_deadline   representative of the task's deadline
 + *  @sched_runtime    representative of the task's runtime
 + *  @sched_period     representative of the task's period
 + *
 + * Given this task model, there are a multiplicity of scheduling algorithms
 + * and policies, that can be used to ensure all the tasks will make their
 + * timing constraints.
 + *
 + * As of now, the SCHED_DEADLINE policy (sched_dl scheduling class) is the
 + * only user of this new interface. More information about the algorithm
 + * available in the scheduling class file or in Documentation/.
 + */
 +struct sched_attr {
 +      u32 size;
 +
 +      u32 sched_policy;
 +      u64 sched_flags;
 +
 +      /* SCHED_NORMAL, SCHED_BATCH */
 +      s32 sched_nice;
 +
 +      /* SCHED_FIFO, SCHED_RR */
 +      u32 sched_priority;
 +
 +      /* SCHED_DEADLINE */
 +      u64 sched_runtime;
 +      u64 sched_deadline;
 +      u64 sched_period;
 +};
 +
  struct exec_domain;
  struct futex_pi_state;
  struct robust_list_head;
@@@ -130,11 -63,6 +130,11 @@@ struct bio_list
  struct fs_struct;
  struct perf_event_context;
  struct blk_plug;
 +struct filename;
 +
 +#define VMACACHE_BITS 2
 +#define VMACACHE_SIZE (1U << VMACACHE_BITS)
 +#define VMACACHE_MASK (VMACACHE_SIZE - 1)
  
  /*
   * List of flags we want to share for kernel threads,
@@@ -210,9 -138,8 +210,9 @@@ print_cfs_rq(struct seq_file *m, int cp
  #define __TASK_STOPPED                4
  #define __TASK_TRACED         8
  /* in tsk->exit_state */
 -#define EXIT_ZOMBIE           16
 -#define EXIT_DEAD             32
 +#define EXIT_DEAD             16
 +#define EXIT_ZOMBIE           32
 +#define EXIT_TRACE            (EXIT_ZOMBIE | EXIT_DEAD)
  /* in tsk->state again */
  #define TASK_DEAD             64
  #define TASK_WAKEKILL         128
@@@ -237,10 -164,11 +237,10 @@@ extern char ___assert_task_state[1 - 2*
  /* get_task_state() */
  #define TASK_REPORT           (TASK_RUNNING | TASK_INTERRUPTIBLE | \
                                 TASK_UNINTERRUPTIBLE | __TASK_STOPPED | \
 -                               __TASK_TRACED)
 +                               __TASK_TRACED | EXIT_ZOMBIE | EXIT_DEAD)
  
  #define task_is_traced(task)  ((task->state & __TASK_TRACED) != 0)
  #define task_is_stopped(task) ((task->state & __TASK_STOPPED) != 0)
 -#define task_is_dead(task)    ((task)->exit_state != 0)
  #define task_is_stopped_or_traced(task)       \
                        ((task->state & (__TASK_STOPPED | __TASK_TRACED)) != 0)
  #define task_contributes_to_load(task)        \
@@@ -299,14 -227,10 +299,14 @@@ extern int runqueue_is_locked(int cpu)
  #if defined(CONFIG_SMP) && defined(CONFIG_NO_HZ_COMMON)
  extern void nohz_balance_enter_idle(int cpu);
  extern void set_cpu_sd_state_idle(void);
 -extern int get_nohz_timer_target(void);
 +extern int get_nohz_timer_target(int pinned);
  #else
  static inline void nohz_balance_enter_idle(int cpu) { }
  static inline void set_cpu_sd_state_idle(void) { }
 +static inline int get_nohz_timer_target(int pinned)
 +{
 +      return smp_processor_id();
 +}
  #endif
  
  /*
@@@ -403,33 -327,22 +403,33 @@@ arch_get_unmapped_area_topdown(struct f
  static inline void arch_pick_mmap_layout(struct mm_struct *mm) {}
  #endif
  
 -
 -extern void set_dumpable(struct mm_struct *mm, int value);
 -extern int get_dumpable(struct mm_struct *mm);
 -
  #define SUID_DUMP_DISABLE     0       /* No setuid dumping */
  #define SUID_DUMP_USER                1       /* Dump as user of process */
  #define SUID_DUMP_ROOT                2       /* Dump as root */
  
  /* mm flags */
 -/* dumpable bits */
 -#define MMF_DUMPABLE      0  /* core dump is permitted */
 -#define MMF_DUMP_SECURELY 1  /* core file is readable only by root */
  
 +/* for SUID_DUMP_* above */
  #define MMF_DUMPABLE_BITS 2
  #define MMF_DUMPABLE_MASK ((1 << MMF_DUMPABLE_BITS) - 1)
  
 +extern void set_dumpable(struct mm_struct *mm, int value);
 +/*
 + * This returns the actual value of the suid_dumpable flag. For things
 + * that are using this for checking for privilege transitions, it must
 + * test against SUID_DUMP_USER rather than treating it as a boolean
 + * value.
 + */
 +static inline int __get_dumpable(unsigned long mm_flags)
 +{
 +      return mm_flags & MMF_DUMPABLE_MASK;
 +}
 +
 +static inline int get_dumpable(struct mm_struct *mm)
 +{
 +      return __get_dumpable(mm->flags);
 +}
 +
  /* coredump filter bits */
  #define MMF_DUMP_ANON_PRIVATE 2
  #define MMF_DUMP_ANON_SHARED  3
@@@ -572,7 -485,6 +572,7 @@@ struct signal_struct 
        atomic_t                sigcnt;
        atomic_t                live;
        int                     nr_threads;
 +      struct list_head        thread_head;
  
        wait_queue_head_t       wait_chldexit;  /* for wait4() */
  
@@@ -1088,7 -1000,6 +1088,7 @@@ struct sched_entity 
  #endif
  
  #ifdef CONFIG_FAIR_GROUP_SCHED
 +      int                     depth;
        struct sched_entity     *parent;
        /* rq on which this entity is (to be) queued: */
        struct cfs_rq           *cfs_rq;
@@@ -1118,51 -1029,6 +1118,51 @@@ struct sched_rt_entity 
  #endif
  };
  
 +struct sched_dl_entity {
 +      struct rb_node  rb_node;
 +
 +      /*
 +       * Original scheduling parameters. Copied here from sched_attr
 +       * during sched_setscheduler2(), they will remain the same until
 +       * the next sched_setscheduler2().
 +       */
 +      u64 dl_runtime;         /* maximum runtime for each instance    */
 +      u64 dl_deadline;        /* relative deadline of each instance   */
 +      u64 dl_period;          /* separation of two instances (period) */
 +      u64 dl_bw;              /* dl_runtime / dl_deadline             */
 +
 +      /*
 +       * Actual scheduling parameters. Initialized with the values above,
 +       * they are continously updated during task execution. Note that
 +       * the remaining runtime could be < 0 in case we are in overrun.
 +       */
 +      s64 runtime;            /* remaining runtime for this instance  */
 +      u64 deadline;           /* absolute deadline for this instance  */
 +      unsigned int flags;     /* specifying the scheduler behaviour   */
 +
 +      /*
 +       * Some bool flags:
 +       *
 +       * @dl_throttled tells if we exhausted the runtime. If so, the
 +       * task has to wait for a replenishment to be performed at the
 +       * next firing of dl_timer.
 +       *
 +       * @dl_new tells if a new instance arrived. If so we must
 +       * start executing it with full runtime and reset its absolute
 +       * deadline;
 +       *
 +       * @dl_boosted tells if we are boosted due to DI. If so we are
 +       * outside bandwidth enforcement mechanism (but only until we
 +       * exit the critical section).
 +       */
 +      int dl_throttled, dl_new, dl_boosted;
 +
 +      /*
 +       * Bandwidth enforcement timer. Each -deadline task has its
 +       * own bandwidth to be enforced, thus we need one timer per task.
 +       */
 +      struct hrtimer dl_timer;
 +};
  
  struct rcu_node;
  
@@@ -1199,7 -1065,6 +1199,7 @@@ struct task_struct 
  #ifdef CONFIG_CGROUP_SCHED
        struct task_group *sched_task_group;
  #endif
 +      struct sched_dl_entity dl;
  
  #ifdef CONFIG_PREEMPT_NOTIFIERS
        /* list of struct preempt_notifier: */
        struct list_head tasks;
  #ifdef CONFIG_SMP
        struct plist_node pushable_tasks;
 +      struct rb_node pushable_dl_tasks;
  #endif
  
        struct mm_struct *mm, *active_mm;
  #ifdef CONFIG_COMPAT_BRK
        unsigned brk_randomized:1;
  #endif
 +      /* per-thread vma caching */
 +      u32 vmacache_seqnum;
 +      struct vm_area_struct *vmacache[VMACACHE_SIZE];
  #if defined(SPLIT_RSS_COUNTING)
        struct task_rss_stat    rss_stat;
  #endif
        /* Used for emulating ABI behavior of previous Linux versions */
        unsigned int personality;
  
 -      unsigned did_exec:1;
        unsigned in_execve:1;   /* Tell the LSMs that the process is doing an
                                 * execve */
        unsigned in_iowait:1;
        /* PID/PID hash table linkage. */
        struct pid_link pids[PIDTYPE_MAX];
        struct list_head thread_group;
 +      struct list_head thread_node;
  
        struct completion *vfork_done;          /* for vfork() */
        int __user *set_child_tid;              /* CLONE_CHILD_SETTID */
  
  #ifdef CONFIG_RT_MUTEXES
        /* PI waiters blocked on a rt_mutex held by this task */
 -      struct plist_head pi_waiters;
 +      struct rb_root pi_waiters;
 +      struct rb_node *pi_waiters_leftmost;
        /* Deadlock detection and priority inheritance handling */
        struct rt_mutex_waiter *pi_blocked_on;
 +      /* Top pi_waiters task */
 +      struct task_struct *pi_top_task;
  #endif
  
  #ifdef CONFIG_DEBUG_MUTEXES
        struct mutex perf_event_mutex;
        struct list_head perf_event_list;
  #endif
 +#ifdef CONFIG_DEBUG_PREEMPT
 +      unsigned long preempt_disable_ip;
 +#endif
  #ifdef CONFIG_NUMA
        struct mempolicy *mempolicy;    /* Protected by alloc_lock */
        short il_next;
        unsigned int numa_scan_period;
        unsigned int numa_scan_period_max;
        int numa_preferred_nid;
 -      int numa_migrate_deferred;
        unsigned long numa_migrate_retry;
        u64 node_stamp;                 /* migration stamp  */
 +      u64 last_task_numa_placement;
 +      u64 last_sum_exec_runtime;
        struct callback_head numa_work;
  
        struct list_head numa_entry;
         * Scheduling placement decisions are made based on the these counts.
         * The values remain static for the duration of a PTE scan
         */
 -      unsigned long *numa_faults;
 +      unsigned long *numa_faults_memory;
        unsigned long total_numa_faults;
  
        /*
         * numa_faults_buffer records faults per node during the current
 -       * scan window. When the scan completes, the counts in numa_faults
 -       * decay and these values are copied.
 +       * scan window. When the scan completes, the counts in
 +       * numa_faults_memory decay and these values are copied.
         */
 -      unsigned long *numa_faults_buffer;
 +      unsigned long *numa_faults_buffer_memory;
 +
 +      /*
 +       * Track the nodes the process was running on when a NUMA hinting
 +       * fault was incurred.
 +       */
 +      unsigned long *numa_faults_cpu;
 +      unsigned long *numa_faults_buffer_cpu;
  
        /*
         * numa_faults_locality tracks if faults recorded during the last
@@@ -1622,8 -1469,8 +1622,8 @@@ extern void task_numa_fault(int last_no
  extern pid_t task_numa_group_id(struct task_struct *p);
  extern void set_numabalancing_state(bool enabled);
  extern void task_numa_free(struct task_struct *p);
 -
 -extern unsigned int sysctl_numa_balancing_migrate_deferred;
 +extern bool should_numa_migrate_memory(struct task_struct *p, struct page *page,
 +                                      int src_nid, int dst_cpu);
  #else
  static inline void task_numa_fault(int last_node, int node, int pages,
                                   int flags)
@@@ -1639,11 -1486,6 +1639,11 @@@ static inline void set_numabalancing_st
  static inline void task_numa_free(struct task_struct *p)
  {
  }
 +static inline bool should_numa_migrate_memory(struct task_struct *p,
 +                              struct page *page, int src_nid, int dst_cpu)
 +{
 +      return true;
 +}
  #endif
  
  static inline struct pid *task_pid(struct task_struct *task)
@@@ -1719,6 -1561,24 +1719,24 @@@ static inline pid_t task_tgid_vnr(struc
  }
  
  
+ static inline int pid_alive(const struct task_struct *p);
+ static inline pid_t task_ppid_nr_ns(const struct task_struct *tsk, struct pid_namespace *ns)
+ {
+       pid_t pid = 0;
+       rcu_read_lock();
+       if (pid_alive(tsk))
+               pid = task_tgid_nr_ns(rcu_dereference(tsk->real_parent), ns);
+       rcu_read_unlock();
+       return pid;
+ }
+ static inline pid_t task_ppid_nr(const struct task_struct *tsk)
+ {
+       return task_ppid_nr_ns(tsk, &init_pid_ns);
+ }
  static inline pid_t task_pgrp_nr_ns(struct task_struct *tsk,
                                        struct pid_namespace *ns)
  {
@@@ -1758,7 -1618,7 +1776,7 @@@ static inline pid_t task_pgrp_nr(struc
   *
   * Return: 1 if the process is alive. 0 otherwise.
   */
- static inline int pid_alive(struct task_struct *p)
+ static inline int pid_alive(const struct task_struct *p)
  {
        return p->pids[PIDTYPE_PID].pid != NULL;
  }
@@@ -1852,6 -1712,7 +1870,6 @@@ extern void thread_group_cputime_adjust
  #define PF_SPREAD_SLAB        0x02000000      /* Spread some slab caches over cpuset */
  #define PF_NO_SETAFFINITY 0x04000000  /* Userland is not allowed to meddle with cpus_allowed */
  #define PF_MCE_EARLY    0x08000000      /* Early kill for mce process policy */
 -#define PF_MEMPOLICY  0x10000000      /* Non-default NUMA mempolicy */
  #define PF_MUTEX_TESTER       0x20000000      /* Thread belongs to the rt mutex tester */
  #define PF_FREEZER_SKIP       0x40000000      /* Freezer should not count it as freezable */
  #define PF_SUSPEND_TASK 0x80000000      /* this thread called freeze_processes and should not be frozen */
@@@ -2037,9 -1898,7 +2055,9 @@@ static inline void sched_clock_idle_wak
   * but then during bootup it turns out that sched_clock()
   * is reliable after all:
   */
 -extern int sched_clock_stable;
 +extern int sched_clock_stable(void);
 +extern void set_sched_clock_stable(void);
 +extern void clear_sched_clock_stable(void);
  
  extern void sched_clock_tick(void);
  extern void sched_clock_idle_sleep_event(void);
@@@ -2110,16 -1969,7 +2128,16 @@@ static inline void sched_autogroup_exit
  extern bool yield_to(struct task_struct *p, bool preempt);
  extern void set_user_nice(struct task_struct *p, long nice);
  extern int task_prio(const struct task_struct *p);
 -extern int task_nice(const struct task_struct *p);
 +/**
 + * task_nice - return the nice value of a given task.
 + * @p: the task in question.
 + *
 + * Return: The nice value [ -20 ... 0 ... 19 ].
 + */
 +static inline int task_nice(const struct task_struct *p)
 +{
 +      return PRIO_TO_NICE((p)->static_prio);
 +}
  extern int can_nice(const struct task_struct *p, const int nice);
  extern int task_curr(const struct task_struct *p);
  extern int idle_cpu(int cpu);
@@@ -2127,8 -1977,6 +2145,8 @@@ extern int sched_setscheduler(struct ta
                              const struct sched_param *);
  extern int sched_setscheduler_nocheck(struct task_struct *, int,
                                      const struct sched_param *);
 +extern int sched_setattr(struct task_struct *,
 +                       const struct sched_attr *);
  extern struct task_struct *idle_task(int cpu);
  /**
   * is_idle_task - is the specified task an idle task?
@@@ -2208,7 -2056,7 +2226,7 @@@ extern void wake_up_new_task(struct tas
  #else
   static inline void kick_process(struct task_struct *tsk) { }
  #endif
 -extern void sched_fork(unsigned long clone_flags, struct task_struct *p);
 +extern int sched_fork(unsigned long clone_flags, struct task_struct *p);
  extern void sched_dead(struct task_struct *p);
  
  extern void proc_caches_init(void);
@@@ -2334,6 -2182,8 +2352,6 @@@ extern struct mm_struct *get_task_mm(st
  extern struct mm_struct *mm_access(struct task_struct *task, unsigned int mode);
  /* Remove the current tasks stale references to the old mm_struct */
  extern void mm_release(struct task_struct *, struct mm_struct *);
 -/* Allocate a new mm structure and copy contents from tsk->mm */
 -extern struct mm_struct *dup_mm(struct task_struct *tsk);
  
  extern int copy_thread(unsigned long, unsigned long, unsigned long,
                        struct task_struct *);
@@@ -2351,14 -2201,14 +2369,14 @@@ extern void do_group_exit(int)
  extern int allow_signal(int);
  extern int disallow_signal(int);
  
 -extern int do_execve(const char *,
 +extern int do_execve(struct filename *,
                     const char __user * const __user *,
                     const char __user * const __user *);
  extern long do_fork(unsigned long, unsigned long, unsigned long, int __user *, int __user *);
  struct task_struct *fork_idle(int);
  extern pid_t kernel_thread(int (*fn)(void *), void *arg, unsigned long flags);
  
 -extern void set_task_comm(struct task_struct *tsk, char *from);
 +extern void set_task_comm(struct task_struct *tsk, const char *from);
  extern char *get_task_comm(char *to, struct task_struct *tsk);
  
  #ifdef CONFIG_SMP
@@@ -2391,16 -2241,6 +2409,16 @@@ extern bool current_is_single_threaded(
  #define while_each_thread(g, t) \
        while ((t = next_thread(t)) != g)
  
 +#define __for_each_thread(signal, t)  \
 +      list_for_each_entry_rcu(t, &(signal)->thread_head, thread_node)
 +
 +#define for_each_thread(p, t)         \
 +      __for_each_thread((p)->signal, t)
 +
 +/* Careful: this is a double loop, 'break' won't work as expected. */
 +#define for_each_process_thread(p, t) \
 +      for_each_process(p) for_each_thread(p, t)
 +
  static inline int get_nr_threads(struct task_struct *tsk)
  {
        return tsk->signal->nr_threads;
@@@ -2805,21 -2645,6 +2823,21 @@@ static inline bool __must_check current
  }
  #endif
  
 +static inline void current_clr_polling(void)
 +{
 +      __current_clr_polling();
 +
 +      /*
 +       * Ensure we check TIF_NEED_RESCHED after we clear the polling bit.
 +       * Once the bit is cleared, we'll get IPIs with every new
 +       * TIF_NEED_RESCHED and the IPI handler, scheduler_ipi(), will also
 +       * fold.
 +       */
 +      smp_mb(); /* paired with resched_task() */
 +
 +      preempt_fold_need_resched();
 +}
 +
  static __always_inline bool need_resched(void)
  {
        return unlikely(tif_need_resched());
diff --combined init/Kconfig
@@@ -273,16 -273,6 +273,16 @@@ config FHANDL
          get renamed. Enables open_by_handle_at(2) and name_to_handle_at(2)
          syscalls.
  
 +config USELIB
 +      bool "uselib syscall"
 +      default y
 +      help
 +        This option enables the uselib syscall, a system call used in the
 +        dynamic linker from libc5 and earlier.  glibc does not use this
 +        system call.  If you intend to run programs built on libc5 or
 +        earlier, you may need to enable this syscall.  Current systems
 +        running glibc can safely disable this.
 +
  config AUDIT
        bool "Auditing support"
        depends on NET
          logging of avc messages output).  Does not do system-call
          auditing without CONFIG_AUDITSYSCALL.
  
+ config HAVE_ARCH_AUDITSYSCALL
+       bool
  config AUDITSYSCALL
        bool "Enable system-call auditing support"
-       depends on AUDIT && (X86 || PARISC || PPC || S390 || IA64 || UML || SPARC64 || SUPERH || (ARM && AEABI && !OABI_COMPAT) || ALPHA)
+       depends on AUDIT && HAVE_ARCH_AUDITSYSCALL
        default y if SECURITY_SELINUX
        help
          Enable low-overhead system-call auditing infrastructure that
@@@ -542,7 -535,7 +545,7 @@@ config CONTEXT_TRACKING_FORC
          dynticks subsystem by forcing the context tracking on all
          CPUs in the system.
  
 -        Say Y only if you're working on the developpement of an
 +        Say Y only if you're working on the development of an
          architecture backend for the context tracking.
  
          Say N otherwise, this option brings an overhead that you
@@@ -864,7 -857,7 +867,7 @@@ config NUMA_BALANCIN
  
  menuconfig CGROUPS
        boolean "Control Group support"
 -      depends on EVENTFD
 +      select KERNFS
        help
          This option adds support for grouping sets of processes together, for
          use with process control subsystems such as Cpusets, CFS, memory
@@@ -931,7 -924,6 +934,7 @@@ config MEMC
        bool "Memory Resource Controller for Control Groups"
        depends on RESOURCE_COUNTERS
        select MM_OWNER
 +      select EVENTFD
        help
          Provides a memory resource controller that manages both anonymous
          memory and page cache. (See Documentation/cgroups/memory.txt)
@@@ -1127,6 -1119,8 +1130,6 @@@ config IPC_N
  
  config USER_NS
        bool "User namespace"
 -      select UIDGID_STRICT_TYPE_CHECKS
 -
        default n
        help
          This allows containers, i.e. vservers, to use user namespaces
@@@ -1158,8 -1152,18 +1161,8 @@@ config NET_N
  
  endif # NAMESPACES
  
 -config UIDGID_STRICT_TYPE_CHECKS
 -      bool "Require conversions between uid/gids and their internal representation"
 -      default n
 -      help
 -       While the nececessary conversions are being added to all subsystems this option allows
 -       the code to continue to build for unconverted subsystems.
 -
 -       Say Y here if you want the strict type checking enabled
 -
  config SCHED_AUTOGROUP
        bool "Automatic process group scheduling"
 -      select EVENTFD
        select CGROUPS
        select CGROUP_SCHED
        select FAIR_GROUP_SCHED
@@@ -1301,16 -1305,6 +1304,16 @@@ config UID1
        help
          This enables the legacy 16-bit UID syscall wrappers.
  
 +config SYSFS_SYSCALL
 +      bool "Sysfs syscall support" if EXPERT
 +      default y
 +      ---help---
 +        sys_sysfs is an obsolete system call no longer supported in libc.
 +        Note that disabling this option is more secure but might break
 +        compatibility with some systems.
 +
 +        If unsure say Y here.
 +
  config SYSCTL_SYSCALL
        bool "Sysctl syscall support" if EXPERT
        depends on PROC_SYSCTL
@@@ -1408,13 -1402,6 +1411,13 @@@ config FUTE
          support for "fast userspace mutexes".  The resulting kernel may not
          run glibc-based applications correctly.
  
 +config HAVE_FUTEX_CMPXCHG
 +      bool
 +      help
 +        Architectures should select this if futex_atomic_cmpxchg_inatomic()
 +        is implemented and always working. This removes a couple of runtime
 +        checks.
 +
  config EPOLL
        bool "Enable eventpoll support" if EXPERT
        default y
@@@ -1483,7 -1470,6 +1486,7 @@@ config PCI_QUIRK
  
  config EMBEDDED
        bool "Embedded system"
 +      option allnoconfig_y
        select EXPERT
        help
          This option should be enabled if compiling the kernel for
diff --combined kernel/audit.c
@@@ -182,7 -182,7 +182,7 @@@ struct audit_buffer 
  
  struct audit_reply {
        __u32 portid;
-       struct net *net;        
+       struct net *net;
        struct sk_buff *skb;
  };
  
@@@ -396,7 -396,7 +396,7 @@@ static void audit_printk_skb(struct sk_
                if (printk_ratelimit())
                        pr_notice("type=%d %s\n", nlh->nlmsg_type, data);
                else
-                       audit_log_lost("printk limit exceeded\n");
+                       audit_log_lost("printk limit exceeded");
        }
  
        audit_hold_skb(skb);
@@@ -412,7 -412,7 +412,7 @@@ static void kauditd_send_skb(struct sk_
                BUG_ON(err != -ECONNREFUSED); /* Shouldn't happen */
                if (audit_pid) {
                        pr_err("*NO* daemon at audit_pid=%d\n", audit_pid);
-                       audit_log_lost("auditd disappeared\n");
+                       audit_log_lost("auditd disappeared");
                        audit_pid = 0;
                        audit_sock = NULL;
                }
@@@ -559,7 -559,7 +559,7 @@@ static int audit_send_reply_thread(voi
  }
  /**
   * audit_send_reply - send an audit reply message via netlink
 - * @portid: netlink port to which to send reply
 + * @request_skb: skb of request we are replying to (used to target the reply)
   * @seq: sequence number
   * @type: audit message type
   * @done: done (last) flag
@@@ -607,7 -607,7 +607,7 @@@ static int audit_netlink_ok(struct sk_b
  {
        int err = 0;
  
-       /* Only support the initial namespaces for now. */
+       /* Only support initial user namespace for now. */
        /*
         * We return ECONNREFUSED because it tricks userspace into thinking
         * that audit was not configured into the kernel.  Lots of users
         * userspace will reject all logins.  This should be removed when we
         * support non init namespaces!!
         */
-       if ((current_user_ns() != &init_user_ns) ||
-           (task_active_pid_ns(current) != &init_pid_ns))
 -      if ((current_user_ns() != &init_user_ns))
++      if (current_user_ns() != &init_user_ns)
                return -ECONNREFUSED;
  
        switch (msg_type) {
        case AUDIT_TTY_SET:
        case AUDIT_TRIM:
        case AUDIT_MAKE_EQUIV:
+               /* Only support auditd and auditctl in initial pid namespace
+                * for now. */
+               if ((task_active_pid_ns(current) != &init_pid_ns))
+                       return -EPERM;
                if (!capable(CAP_AUDIT_CONTROL))
                        err = -EPERM;
                break;
@@@ -659,6 -663,7 +663,7 @@@ static int audit_log_common_recv_msg(st
  {
        int rc = 0;
        uid_t uid = from_kuid(&init_user_ns, current_uid());
+       pid_t pid = task_tgid_nr(current);
  
        if (!audit_enabled && msg_type != AUDIT_USER_AVC) {
                *ab = NULL;
        *ab = audit_log_start(NULL, GFP_KERNEL, msg_type);
        if (unlikely(!*ab))
                return rc;
-       audit_log_format(*ab, "pid=%d uid=%u", task_tgid_vnr(current), uid);
+       audit_log_format(*ab, "pid=%d uid=%u", pid, uid);
        audit_log_session_info(*ab);
        audit_log_task_context(*ab);
  
@@@ -1097,7 -1102,7 +1102,7 @@@ static void __net_exit audit_net_exit(s
                audit_sock = NULL;
        }
  
-       rcu_assign_pointer(aunet->nlsk, NULL);
+       RCU_INIT_POINTER(aunet->nlsk, NULL);
        synchronize_net();
        netlink_kernel_release(sock);
  }
@@@ -1829,11 -1834,11 +1834,11 @@@ void audit_log_task_info(struct audit_b
        spin_unlock_irq(&tsk->sighand->siglock);
  
        audit_log_format(ab,
-                        " ppid=%ld pid=%d auid=%u uid=%u gid=%u"
+                        " ppid=%d pid=%d auid=%u uid=%u gid=%u"
                         " euid=%u suid=%u fsuid=%u"
                         " egid=%u sgid=%u fsgid=%u tty=%s ses=%u",
-                        sys_getppid(),
-                        tsk->pid,
+                        task_ppid_nr(tsk),
+                        task_pid_nr(tsk),
                         from_kuid(&init_user_ns, audit_get_loginuid(tsk)),
                         from_kuid(&init_user_ns, cred->uid),
                         from_kgid(&init_user_ns, cred->gid),
diff --combined kernel/auditfilter.c
@@@ -19,6 -19,8 +19,8 @@@
   * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
   */
  
+ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
  #include <linux/kernel.h>
  #include <linux/audit.h>
  #include <linux/kthread.h>
@@@ -226,7 -228,7 +228,7 @@@ static int audit_match_signal(struct au
  #endif
  
  /* Common user-space to kernel rule translation. */
- static inline struct audit_entry *audit_to_entry_common(struct audit_rule *rule)
+ static inline struct audit_entry *audit_to_entry_common(struct audit_rule_data *rule)
  {
        unsigned listnr;
        struct audit_entry *entry;
                ;
        }
        if (unlikely(rule->action == AUDIT_POSSIBLE)) {
-               printk(KERN_ERR "AUDIT_POSSIBLE is deprecated\n");
+               pr_err("AUDIT_POSSIBLE is deprecated\n");
                goto exit_err;
        }
        if (rule->action != AUDIT_NEVER && rule->action != AUDIT_ALWAYS)
@@@ -403,7 -405,7 +405,7 @@@ static struct audit_entry *audit_data_t
        int i;
        char *str;
  
-       entry = audit_to_entry_common((struct audit_rule *)data);
+       entry = audit_to_entry_common(data);
        if (IS_ERR(entry))
                goto exit_nofree;
  
                        f->val = 0;
                }
  
+               if ((f->type == AUDIT_PID) || (f->type == AUDIT_PPID)) {
+                       struct pid *pid;
+                       rcu_read_lock();
+                       pid = find_vpid(f->val);
+                       if (!pid) {
+                               rcu_read_unlock();
+                               err = -ESRCH;
+                               goto exit_free;
+                       }
+                       f->val = pid_nr(pid);
+                       rcu_read_unlock();
+               }
                err = audit_field_valid(entry, f);
                if (err)
                        goto exit_free;
                        /* Keep currently invalid fields around in case they
                         * become valid after a policy reload. */
                        if (err == -EINVAL) {
-                               printk(KERN_WARNING "audit rule for LSM "
-                                      "\'%s\' is invalid\n",  str);
+                               pr_warn("audit rule for LSM \'%s\' is invalid\n",
+                                       str);
                                err = 0;
                        }
                        if (err) {
@@@ -709,8 -724,8 +724,8 @@@ static inline int audit_dupe_lsm_field(
        /* Keep currently invalid fields around in case they
         * become valid after a policy reload. */
        if (ret == -EINVAL) {
-               printk(KERN_WARNING "audit rule for LSM \'%s\' is "
-                      "invalid\n", df->lsm_str);
+               pr_warn("audit rule for LSM \'%s\' is invalid\n",
+                       df->lsm_str);
                ret = 0;
        }
  
@@@ -1067,7 -1082,7 +1082,7 @@@ int audit_rule_change(int type, __u32 p
  
  /**
   * audit_list_rules_send - list the audit rules
 - * @portid: target portid for netlink audit messages
 + * @request_skb: skb of request we are replying to (used to target the reply)
   * @seq: netlink audit message sequence (serial) number
   */
  int audit_list_rules_send(struct sk_buff *request_skb, int seq)
@@@ -1240,12 -1255,14 +1255,14 @@@ static int audit_filter_user_rules(stru
  
        for (i = 0; i < rule->field_count; i++) {
                struct audit_field *f = &rule->fields[i];
+               pid_t pid;
                int result = 0;
                u32 sid;
  
                switch (f->type) {
                case AUDIT_PID:
-                       result = audit_comparator(task_pid_vnr(current), f->op, f->val);
+                       pid = task_pid_nr(current);
+                       result = audit_comparator(pid, f->op, f->val);
                        break;
                case AUDIT_UID:
                        result = audit_uid_comparator(current_uid(), f->op, f->uid);
diff --combined kernel/auditsc.c
@@@ -42,6 -42,8 +42,8 @@@
   * and <dustin.kirkland@us.ibm.com> for LSPP certification compliance.
   */
  
+ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
  #include <linux/init.h>
  #include <asm/types.h>
  #include <linux/atomic.h>
@@@ -68,6 -70,7 +70,7 @@@
  #include <linux/capability.h>
  #include <linux/fs_struct.h>
  #include <linux/compat.h>
+ #include <linux/ctype.h>
  
  #include "audit.h"
  
@@@ -79,6 -82,9 +82,9 @@@
  /* no execve audit message should be longer than this (userspace limits) */
  #define MAX_EXECVE_AUDIT_LEN 7500
  
+ /* max length to print of cmdline/proctitle value during audit */
+ #define MAX_PROCTITLE_AUDIT_LEN 128
  /* number of audit rules */
  int audit_n_rules;
  
@@@ -451,15 -457,17 +457,17 @@@ static int audit_filter_rules(struct ta
                struct audit_field *f = &rule->fields[i];
                struct audit_names *n;
                int result = 0;
+               pid_t pid;
  
                switch (f->type) {
                case AUDIT_PID:
-                       result = audit_comparator(tsk->pid, f->op, f->val);
+                       pid = task_pid_nr(tsk);
+                       result = audit_comparator(pid, f->op, f->val);
                        break;
                case AUDIT_PPID:
                        if (ctx) {
                                if (!ctx->ppid)
-                                       ctx->ppid = sys_getppid();
+                                       ctx->ppid = task_ppid_nr(tsk);
                                result = audit_comparator(ctx->ppid, f->op, f->val);
                        }
                        break;
@@@ -805,7 -813,8 +813,8 @@@ void audit_filter_inodes(struct task_st
        rcu_read_unlock();
  }
  
- static inline struct audit_context *audit_get_context(struct task_struct *tsk,
+ /* Transfer the audit context pointer to the caller, clearing it in the tsk's struct */
+ static inline struct audit_context *audit_take_context(struct task_struct *tsk,
                                                      int return_valid,
                                                      long return_code)
  {
        return context;
  }
  
+ static inline void audit_proctitle_free(struct audit_context *context)
+ {
+       kfree(context->proctitle.value);
+       context->proctitle.value = NULL;
+       context->proctitle.len = 0;
+ }
  static inline void audit_free_names(struct audit_context *context)
  {
        struct audit_names *n, *next;
        if (context->put_count + context->ino_count != context->name_count) {
                int i = 0;
  
-               printk(KERN_ERR "%s:%d(:%d): major=%d in_syscall=%d"
-                      " name_count=%d put_count=%d"
-                      " ino_count=%d [NOT freeing]\n",
-                      __FILE__, __LINE__,
+               pr_err("%s:%d(:%d): major=%d in_syscall=%d"
+                      " name_count=%d put_count=%d ino_count=%d"
+                      " [NOT freeing]\n", __FILE__, __LINE__,
                       context->serial, context->major, context->in_syscall,
                       context->name_count, context->put_count,
                       context->ino_count);
                list_for_each_entry(n, &context->names_list, list) {
-                       printk(KERN_ERR "names[%d] = %p = %s\n", i++,
-                              n->name, n->name->name ?: "(null)");
+                       pr_err("names[%d] = %p = %s\n", i++, n->name,
+                              n->name->name ?: "(null)");
                }
                dump_stack();
                return;
@@@ -955,6 -970,7 +970,7 @@@ static inline void audit_free_context(s
        audit_free_aux(context);
        kfree(context->filterkey);
        kfree(context->sockaddr);
+       audit_proctitle_free(context);
        kfree(context);
  }
  
@@@ -1157,7 -1173,7 +1173,7 @@@ static void audit_log_execve_info(struc
         */
        buf = kmalloc(MAX_EXECVE_AUDIT_LEN + 1, GFP_KERNEL);
        if (!buf) {
-               audit_panic("out of memory for argv string\n");
+               audit_panic("out of memory for argv string");
                return;
        }
  
@@@ -1271,6 -1287,59 +1287,59 @@@ static void show_special(struct audit_c
        audit_log_end(ab);
  }
  
+ static inline int audit_proctitle_rtrim(char *proctitle, int len)
+ {
+       char *end = proctitle + len - 1;
+       while (end > proctitle && !isprint(*end))
+               end--;
+       /* catch the case where proctitle is only 1 non-print character */
+       len = end - proctitle + 1;
+       len -= isprint(proctitle[len-1]) == 0;
+       return len;
+ }
+ static void audit_log_proctitle(struct task_struct *tsk,
+                        struct audit_context *context)
+ {
+       int res;
+       char *buf;
+       char *msg = "(null)";
+       int len = strlen(msg);
+       struct audit_buffer *ab;
+       ab = audit_log_start(context, GFP_KERNEL, AUDIT_PROCTITLE);
+       if (!ab)
+               return; /* audit_panic or being filtered */
+       audit_log_format(ab, "proctitle=");
+       /* Not  cached */
+       if (!context->proctitle.value) {
+               buf = kmalloc(MAX_PROCTITLE_AUDIT_LEN, GFP_KERNEL);
+               if (!buf)
+                       goto out;
+               /* Historically called this from procfs naming */
+               res = get_cmdline(tsk, buf, MAX_PROCTITLE_AUDIT_LEN);
+               if (res == 0) {
+                       kfree(buf);
+                       goto out;
+               }
+               res = audit_proctitle_rtrim(buf, res);
+               if (res == 0) {
+                       kfree(buf);
+                       goto out;
+               }
+               context->proctitle.value = buf;
+               context->proctitle.len = res;
+       }
+       msg = context->proctitle.value;
+       len = context->proctitle.len;
+ out:
+       audit_log_n_untrustedstring(ab, msg, len);
+       audit_log_end(ab);
+ }
  static void audit_log_exit(struct audit_context *context, struct task_struct *tsk)
  {
        int i, call_panic = 0;
                audit_log_name(context, n, NULL, i++, &call_panic);
        }
  
+       audit_log_proctitle(tsk, context);
        /* Send end of event record to help user space know we are finished */
        ab = audit_log_start(context, GFP_KERNEL, AUDIT_EOE);
        if (ab)
@@@ -1406,7 -1477,7 +1477,7 @@@ void __audit_free(struct task_struct *t
  {
        struct audit_context *context;
  
-       context = audit_get_context(tsk, 0, 0);
+       context = audit_take_context(tsk, 0, 0);
        if (!context)
                return;
  
@@@ -1500,7 -1571,7 +1571,7 @@@ void __audit_syscall_exit(int success, 
        else
                success = AUDITSC_FAILURE;
  
-       context = audit_get_context(tsk, success, return_code);
+       context = audit_take_context(tsk, success, return_code);
        if (!context)
                return;
  
@@@ -1550,7 -1621,7 +1621,7 @@@ static inline void handle_one(const str
        if (likely(put_tree_ref(context, chunk)))
                return;
        if (unlikely(!grow_tree_refs(context))) {
-               printk(KERN_WARNING "out of memory, audit has lost a tree reference\n");
+               pr_warn("out of memory, audit has lost a tree reference\n");
                audit_set_auditable(context);
                audit_put_chunk(chunk);
                unroll_tree_refs(context, p, count);
@@@ -1609,8 -1680,7 +1680,7 @@@ retry
                        goto retry;
                }
                /* too bad */
-               printk(KERN_WARNING
-                       "out of memory, audit has lost a tree reference\n");
+               pr_warn("out of memory, audit has lost a tree reference\n");
                unroll_tree_refs(context, p, count);
                audit_set_auditable(context);
                return;
@@@ -1682,7 -1752,7 +1752,7 @@@ void __audit_getname(struct filename *n
  
        if (!context->in_syscall) {
  #if AUDIT_DEBUG == 2
-               printk(KERN_ERR "%s:%d(:%d): ignoring getname(%p)\n",
+               pr_err("%s:%d(:%d): ignoring getname(%p)\n",
                       __FILE__, __LINE__, context->serial, name);
                dump_stack();
  #endif
@@@ -1719,17 -1789,17 +1789,17 @@@ void audit_putname(struct filename *nam
        struct audit_context *context = current->audit_context;
  
        BUG_ON(!context);
 -      if (!context->in_syscall) {
 +      if (!name->aname || !context->in_syscall) {
  #if AUDIT_DEBUG == 2
-               printk(KERN_ERR "%s:%d(:%d): final_putname(%p)\n",
+               pr_err("%s:%d(:%d): final_putname(%p)\n",
                       __FILE__, __LINE__, context->serial, name);
                if (context->name_count) {
                        struct audit_names *n;
                        int i = 0;
  
                        list_for_each_entry(n, &context->names_list, list)
-                               printk(KERN_ERR "name[%d] = %p = %s\n", i++,
-                                      n->name, n->name->name ?: "(null)");
+                               pr_err("name[%d] = %p = %s\n", i++, n->name,
+                                      n->name->name ?: "(null)");
                        }
  #endif
                final_putname(name);
        else {
                ++context->put_count;
                if (context->put_count > context->name_count) {
-                       printk(KERN_ERR "%s:%d(:%d): major=%d"
-                              " in_syscall=%d putname(%p) name_count=%d"
-                              " put_count=%d\n",
+                       pr_err("%s:%d(:%d): major=%d in_syscall=%d putname(%p)"
+                              " name_count=%d put_count=%d\n",
                               __FILE__, __LINE__,
                               context->serial, context->major,
                               context->in_syscall, name->name,
@@@ -1981,12 -2050,10 +2050,10 @@@ static void audit_log_set_loginuid(kuid
        ab = audit_log_start(NULL, GFP_KERNEL, AUDIT_LOGIN);
        if (!ab)
                return;
-       audit_log_format(ab, "pid=%d uid=%u"
-                        " old-auid=%u new-auid=%u old-ses=%u new-ses=%u"
-                        " res=%d",
-                        current->pid, uid,
-                        oldloginuid, loginuid, oldsessionid, sessionid,
-                        !rc);
+       audit_log_format(ab, "pid=%d uid=%u", task_pid_nr(current), uid);
+       audit_log_task_context(ab);
+       audit_log_format(ab, " old-auid=%u auid=%u old-ses=%u ses=%u res=%d",
+                        oldloginuid, loginuid, oldsessionid, sessionid, !rc);
        audit_log_end(ab);
  }
  
@@@ -2208,7 -2275,7 +2275,7 @@@ void __audit_ptrace(struct task_struct 
  {
        struct audit_context *context = current->audit_context;
  
-       context->target_pid = t->pid;
+       context->target_pid = task_pid_nr(t);
        context->target_auid = audit_get_loginuid(t);
        context->target_uid = task_uid(t);
        context->target_sessionid = audit_get_sessionid(t);
@@@ -2233,7 -2300,7 +2300,7 @@@ int __audit_signal_info(int sig, struc
  
        if (audit_pid && t->tgid == audit_pid) {
                if (sig == SIGTERM || sig == SIGHUP || sig == SIGUSR1 || sig == SIGUSR2) {
-                       audit_sig_pid = tsk->pid;
+                       audit_sig_pid = task_pid_nr(tsk);
                        if (uid_valid(tsk->loginuid))
                                audit_sig_uid = tsk->loginuid;
                        else
        /* optimize the common case by putting first signal recipient directly
         * in audit_context */
        if (!ctx->target_pid) {
-               ctx->target_pid = t->tgid;
+               ctx->target_pid = task_tgid_nr(t);
                ctx->target_auid = audit_get_loginuid(t);
                ctx->target_uid = t_uid;
                ctx->target_sessionid = audit_get_sessionid(t);
        }
        BUG_ON(axp->pid_count >= AUDIT_AUX_PIDS);
  
-       axp->target_pid[axp->pid_count] = t->tgid;
+       axp->target_pid[axp->pid_count] = task_tgid_nr(t);
        axp->target_auid[axp->pid_count] = audit_get_loginuid(t);
        axp->target_uid[axp->pid_count] = t_uid;
        axp->target_sessionid[axp->pid_count] = audit_get_sessionid(t);
@@@ -2368,7 -2435,7 +2435,7 @@@ static void audit_log_task(struct audit
                         from_kgid(&init_user_ns, gid),
                         sessionid);
        audit_log_task_context(ab);
-       audit_log_format(ab, " pid=%d comm=", current->pid);
+       audit_log_format(ab, " pid=%d comm=", task_pid_nr(current));
        audit_log_untrustedstring(ab, current->comm);
        if (mm) {
                down_read(&mm->mmap_sem);
diff --combined kernel/seccomp.c
@@@ -55,33 -55,60 +55,33 @@@ struct seccomp_filter 
        atomic_t usage;
        struct seccomp_filter *prev;
        unsigned short len;  /* Instruction count */
 -      struct sock_filter insns[];
 +      struct sock_filter_int insnsi[];
  };
  
  /* Limit any path through the tree to 256KB worth of instructions. */
  #define MAX_INSNS_PER_PATH ((1 << 18) / sizeof(struct sock_filter))
  
 -/**
 - * get_u32 - returns a u32 offset into data
 - * @data: a unsigned 64 bit value
 - * @index: 0 or 1 to return the first or second 32-bits
 - *
 - * This inline exists to hide the length of unsigned long.  If a 32-bit
 - * unsigned long is passed in, it will be extended and the top 32-bits will be
 - * 0. If it is a 64-bit unsigned long, then whatever data is resident will be
 - * properly returned.
 - *
 +/*
   * Endianness is explicitly ignored and left for BPF program authors to manage
   * as per the specific architecture.
   */
 -static inline u32 get_u32(u64 data, int index)
 +static void populate_seccomp_data(struct seccomp_data *sd)
  {
 -      return ((u32 *)&data)[index];
 -}
 +      struct task_struct *task = current;
 +      struct pt_regs *regs = task_pt_regs(task);
  
 -/* Helper for bpf_load below. */
 -#define BPF_DATA(_name) offsetof(struct seccomp_data, _name)
 -/**
 - * bpf_load: checks and returns a pointer to the requested offset
 - * @off: offset into struct seccomp_data to load from
 - *
 - * Returns the requested 32-bits of data.
 - * seccomp_check_filter() should assure that @off is 32-bit aligned
 - * and not out of bounds.  Failure to do so is a BUG.
 - */
 -u32 seccomp_bpf_load(int off)
 -{
 -      struct pt_regs *regs = task_pt_regs(current);
 -      if (off == BPF_DATA(nr))
 -              return syscall_get_nr(current, regs);
 -      if (off == BPF_DATA(arch))
 -              return syscall_get_arch();
 -      if (off >= BPF_DATA(args[0]) && off < BPF_DATA(args[6])) {
 -              unsigned long value;
 -              int arg = (off - BPF_DATA(args[0])) / sizeof(u64);
 -              int index = !!(off % sizeof(u64));
 -              syscall_get_arguments(current, regs, arg, 1, &value);
 -              return get_u32(value, index);
 -      }
 -      if (off == BPF_DATA(instruction_pointer))
 -              return get_u32(KSTK_EIP(current), 0);
 -      if (off == BPF_DATA(instruction_pointer) + sizeof(u32))
 -              return get_u32(KSTK_EIP(current), 1);
 -      /* seccomp_check_filter should make this impossible. */
 -      BUG();
 +      sd->nr = syscall_get_nr(task, regs);
-       sd->arch = syscall_get_arch(task, regs);
++      sd->arch = syscall_get_arch();
 +
 +      /* Unroll syscall_get_args to help gcc on arm. */
 +      syscall_get_arguments(task, regs, 0, 1, (unsigned long *) &sd->args[0]);
 +      syscall_get_arguments(task, regs, 1, 1, (unsigned long *) &sd->args[1]);
 +      syscall_get_arguments(task, regs, 2, 1, (unsigned long *) &sd->args[2]);
 +      syscall_get_arguments(task, regs, 3, 1, (unsigned long *) &sd->args[3]);
 +      syscall_get_arguments(task, regs, 4, 1, (unsigned long *) &sd->args[4]);
 +      syscall_get_arguments(task, regs, 5, 1, (unsigned long *) &sd->args[5]);
 +
 +      sd->instruction_pointer = KSTK_EIP(task);
  }
  
  /**
@@@ -106,17 -133,17 +106,17 @@@ static int seccomp_check_filter(struct 
  
                switch (code) {
                case BPF_S_LD_W_ABS:
 -                      ftest->code = BPF_S_ANC_SECCOMP_LD_W;
 +                      ftest->code = BPF_LDX | BPF_W | BPF_ABS;
                        /* 32-bit aligned and not out of bounds. */
                        if (k >= sizeof(struct seccomp_data) || k & 3)
                                return -EINVAL;
                        continue;
                case BPF_S_LD_W_LEN:
 -                      ftest->code = BPF_S_LD_IMM;
 +                      ftest->code = BPF_LD | BPF_IMM;
                        ftest->k = sizeof(struct seccomp_data);
                        continue;
                case BPF_S_LDX_W_LEN:
 -                      ftest->code = BPF_S_LDX_IMM;
 +                      ftest->code = BPF_LDX | BPF_IMM;
                        ftest->k = sizeof(struct seccomp_data);
                        continue;
                /* Explicitly include allowed calls. */
                case BPF_S_JMP_JGT_X:
                case BPF_S_JMP_JSET_K:
                case BPF_S_JMP_JSET_X:
 +                      sk_decode_filter(ftest, ftest);
                        continue;
                default:
                        return -EINVAL;
  static u32 seccomp_run_filters(int syscall)
  {
        struct seccomp_filter *f;
 +      struct seccomp_data sd;
        u32 ret = SECCOMP_RET_ALLOW;
  
        /* Ensure unexpected behavior doesn't result in failing open. */
        if (WARN_ON(current->seccomp.filter == NULL))
                return SECCOMP_RET_KILL;
  
 +      populate_seccomp_data(&sd);
 +
        /*
         * All filters in the list are evaluated and the lowest BPF return
         * value always takes priority (ignoring the DATA).
         */
        for (f = current->seccomp.filter; f; f = f->prev) {
 -              u32 cur_ret = sk_run_filter(NULL, f->insns);
 +              u32 cur_ret = sk_run_filter_int_seccomp(&sd, f->insnsi);
                if ((cur_ret & SECCOMP_RET_ACTION) < (ret & SECCOMP_RET_ACTION))
                        ret = cur_ret;
        }
@@@ -208,8 -231,6 +208,8 @@@ static long seccomp_attach_filter(struc
        struct seccomp_filter *filter;
        unsigned long fp_size = fprog->len * sizeof(struct sock_filter);
        unsigned long total_insns = fprog->len;
 +      struct sock_filter *fp;
 +      int new_len;
        long ret;
  
        if (fprog->len == 0 || fprog->len > BPF_MAXINSNS)
                                     CAP_SYS_ADMIN) != 0)
                return -EACCES;
  
 -      /* Allocate a new seccomp_filter */
 -      filter = kzalloc(sizeof(struct seccomp_filter) + fp_size,
 -                       GFP_KERNEL|__GFP_NOWARN);
 -      if (!filter)
 +      fp = kzalloc(fp_size, GFP_KERNEL|__GFP_NOWARN);
 +      if (!fp)
                return -ENOMEM;
 -      atomic_set(&filter->usage, 1);
 -      filter->len = fprog->len;
  
        /* Copy the instructions from fprog. */
        ret = -EFAULT;
 -      if (copy_from_user(filter->insns, fprog->filter, fp_size))
 -              goto fail;
 +      if (copy_from_user(fp, fprog->filter, fp_size))
 +              goto free_prog;
  
        /* Check and rewrite the fprog via the skb checker */
 -      ret = sk_chk_filter(filter->insns, filter->len);
 +      ret = sk_chk_filter(fp, fprog->len);
        if (ret)
 -              goto fail;
 +              goto free_prog;
  
        /* Check and rewrite the fprog for seccomp use */
 -      ret = seccomp_check_filter(filter->insns, filter->len);
 +      ret = seccomp_check_filter(fp, fprog->len);
 +      if (ret)
 +              goto free_prog;
 +
 +      /* Convert 'sock_filter' insns to 'sock_filter_int' insns */
 +      ret = sk_convert_filter(fp, fprog->len, NULL, &new_len);
 +      if (ret)
 +              goto free_prog;
 +
 +      /* Allocate a new seccomp_filter */
 +      filter = kzalloc(sizeof(struct seccomp_filter) +
 +                       sizeof(struct sock_filter_int) * new_len,
 +                       GFP_KERNEL|__GFP_NOWARN);
 +      if (!filter)
 +              goto free_prog;
 +
 +      ret = sk_convert_filter(fp, fprog->len, filter->insnsi, &new_len);
        if (ret)
 -              goto fail;
 +              goto free_filter;
 +
 +      atomic_set(&filter->usage, 1);
 +      filter->len = new_len;
  
        /*
         * If there is an existing filter, make it the prev and don't drop its
        filter->prev = current->seccomp.filter;
        current->seccomp.filter = filter;
        return 0;
 -fail:
 +
 +free_filter:
        kfree(filter);
 +free_prog:
 +      kfree(fp);
        return ret;
  }
  
   *
   * Returns 0 on success and non-zero otherwise.
   */
 -long seccomp_attach_user_filter(char __user *user_filter)
 +static long seccomp_attach_user_filter(char __user *user_filter)
  {
        struct sock_fprog fprog;
        long ret = -EFAULT;
@@@ -348,7 -351,7 +348,7 @@@ static void seccomp_send_sigsys(int sys
        info.si_code = SYS_SECCOMP;
        info.si_call_addr = (void __user *)KSTK_EIP(current);
        info.si_errno = reason;
-       info.si_arch = syscall_get_arch(current, task_pt_regs(current));
+       info.si_arch = syscall_get_arch();
        info.si_syscall = syscall;
        force_sig_info(SIGSYS, &info, current);
  }
diff --combined lib/Kconfig
@@@ -182,6 -182,15 +182,15 @@@ config AUDIT_GENERI
        depends on AUDIT && !AUDIT_ARCH
        default y
  
+ config AUDIT_ARCH_COMPAT_GENERIC
+       bool
+       default n
+ config AUDIT_COMPAT_GENERIC
+       bool
+       depends on AUDIT_GENERIC && AUDIT_ARCH_COMPAT_GENERIC && COMPAT
+       default y
  config RANDOM32_SELFTEST
        bool "PRNG perform self test on init"
        default n
@@@ -342,9 -351,9 +351,9 @@@ config HAS_IOME
        select GENERIC_IO
        default y
  
 -config HAS_IOPORT
 +config HAS_IOPORT_MAP
        boolean
 -      depends on HAS_IOMEM && !NO_IOPORT
 +      depends on HAS_IOMEM && !NO_IOPORT_MAP
        default y
  
  config HAS_DMA
diff --combined lib/Makefile
@@@ -26,13 -26,11 +26,13 @@@ obj-y += bcd.o div64.o sort.o parser.o 
         bust_spinlocks.o hexdump.o kasprintf.o bitmap.o scatterlist.o \
         gcd.o lcm.o list_sort.o uuid.o flex_array.o iovec.o clz_ctz.o \
         bsearch.o find_last_bit.o find_next_bit.o llist.o memweight.o kfifo.o \
 -       percpu-refcount.o percpu_ida.o
 +       percpu-refcount.o percpu_ida.o hash.o
  obj-y += string_helpers.o
  obj-$(CONFIG_TEST_STRING_HELPERS) += test-string_helpers.o
  obj-y += kstrtox.o
  obj-$(CONFIG_TEST_KSTRTOX) += test-kstrtox.o
 +obj-$(CONFIG_TEST_MODULE) += test_module.o
 +obj-$(CONFIG_TEST_USER_COPY) += test_user_copy.o
  
  ifeq ($(CONFIG_DEBUG_KOBJECT),y)
  CFLAGS_kobject.o += -DDEBUG
@@@ -45,7 -43,6 +45,7 @@@ obj-$(CONFIG_HAS_IOMEM) += iomap_copy.
  obj-$(CONFIG_CHECK_SIGNATURE) += check_signature.o
  obj-$(CONFIG_DEBUG_LOCKING_API_SELFTESTS) += locking-selftest.o
  
 +GCOV_PROFILE_hweight.o := n
  CFLAGS_hweight.o = $(subst $(quote),,$(CONFIG_ARCH_HWEIGHT_CFLAGS))
  obj-$(CONFIG_GENERIC_HWEIGHT) += hweight.o
  
@@@ -96,6 -93,7 +96,7 @@@ obj-$(CONFIG_TEXTSEARCH_BM) += ts_bm.
  obj-$(CONFIG_TEXTSEARCH_FSM) += ts_fsm.o
  obj-$(CONFIG_SMP) += percpu_counter.o
  obj-$(CONFIG_AUDIT_GENERIC) += audit.o
+ obj-$(CONFIG_AUDIT_COMPAT_GENERIC) += compat_audit.o
  
  obj-$(CONFIG_SWIOTLB) += swiotlb.o
  obj-$(CONFIG_IOMMU_HELPER) += iommu-helper.o
diff --combined mm/util.c
+++ b/mm/util.c
@@@ -1,7 -1,6 +1,7 @@@
  #include <linux/mm.h>
  #include <linux/slab.h>
  #include <linux/string.h>
 +#include <linux/compiler.h>
  #include <linux/export.h>
  #include <linux/err.h>
  #include <linux/sched.h>
@@@ -308,7 -307,7 +308,7 @@@ void arch_pick_mmap_layout(struct mm_st
   * If the architecture not support this function, simply return with no
   * page pinned
   */
 -int __attribute__((weak)) __get_user_pages_fast(unsigned long start,
 +int __weak __get_user_pages_fast(unsigned long start,
                                 int nr_pages, int write, struct page **pages)
  {
        return 0;
@@@ -339,7 -338,7 +339,7 @@@ EXPORT_SYMBOL_GPL(__get_user_pages_fast
   * callers need to carefully consider what to use. On many architectures,
   * get_user_pages_fast simply falls back to get_user_pages.
   */
 -int __attribute__((weak)) get_user_pages_fast(unsigned long start,
 +int __weak get_user_pages_fast(unsigned long start,
                                int nr_pages, int write, struct page **pages)
  {
        struct mm_struct *mm = current->mm;
@@@ -405,47 -404,63 +405,95 @@@ struct address_space *page_mapping(stru
        return mapping;
  }
  
 +int overcommit_ratio_handler(struct ctl_table *table, int write,
 +                           void __user *buffer, size_t *lenp,
 +                           loff_t *ppos)
 +{
 +      int ret;
 +
 +      ret = proc_dointvec(table, write, buffer, lenp, ppos);
 +      if (ret == 0 && write)
 +              sysctl_overcommit_kbytes = 0;
 +      return ret;
 +}
 +
 +int overcommit_kbytes_handler(struct ctl_table *table, int write,
 +                           void __user *buffer, size_t *lenp,
 +                           loff_t *ppos)
 +{
 +      int ret;
 +
 +      ret = proc_doulongvec_minmax(table, write, buffer, lenp, ppos);
 +      if (ret == 0 && write)
 +              sysctl_overcommit_ratio = 0;
 +      return ret;
 +}
 +
  /*
   * Committed memory limit enforced when OVERCOMMIT_NEVER policy is used
   */
  unsigned long vm_commit_limit(void)
  {
 -      return ((totalram_pages - hugetlb_total_pages())
 -              * sysctl_overcommit_ratio / 100) + total_swap_pages;
 +      unsigned long allowed;
 +
 +      if (sysctl_overcommit_kbytes)
 +              allowed = sysctl_overcommit_kbytes >> (PAGE_SHIFT - 10);
 +      else
 +              allowed = ((totalram_pages - hugetlb_total_pages())
 +                         * sysctl_overcommit_ratio / 100);
 +      allowed += total_swap_pages;
 +
 +      return allowed;
  }
  
+ /**
+  * get_cmdline() - copy the cmdline value to a buffer.
+  * @task:     the task whose cmdline value to copy.
+  * @buffer:   the buffer to copy to.
+  * @buflen:   the length of the buffer. Larger cmdline values are truncated
+  *            to this length.
+  * Returns the size of the cmdline field copied. Note that the copy does
+  * not guarantee an ending NULL byte.
+  */
+ int get_cmdline(struct task_struct *task, char *buffer, int buflen)
+ {
+       int res = 0;
+       unsigned int len;
+       struct mm_struct *mm = get_task_mm(task);
+       if (!mm)
+               goto out;
+       if (!mm->arg_end)
+               goto out_mm;    /* Shh! No looking before we're done */
+       len = mm->arg_end - mm->arg_start;
+       if (len > buflen)
+               len = buflen;
+       res = access_process_vm(task, mm->arg_start, buffer, len, 0);
+       /*
+        * If the nul at the end of args has been overwritten, then
+        * assume application is using setproctitle(3).
+        */
+       if (res > 0 && buffer[res-1] != '\0' && len < buflen) {
+               len = strnlen(buffer, res);
+               if (len < res) {
+                       res = len;
+               } else {
+                       len = mm->env_end - mm->env_start;
+                       if (len > buflen - res)
+                               len = buflen - res;
+                       res += access_process_vm(task, mm->env_start,
+                                                buffer+res, len, 0);
+                       res = strnlen(buffer, res);
+               }
+       }
+ out_mm:
+       mmput(mm);
+ out:
+       return res;
+ }
  
  /* Tracepoints definitions. */
  EXPORT_TRACEPOINT_SYMBOL(kmalloc);
@@@ -7,7 -7,7 +7,7 @@@
   * the Free Software Foundation, version 2 of the License.
   *
   * File: integrity_audit.c
 - *    Audit calls for the integrity subsystem
 + *    Audit calls for the integrity subsystem
   */
  
  #include <linux/fs.h>
@@@ -22,7 -22,7 +22,7 @@@ static int __init integrity_audit_setup
  {
        unsigned long audit;
  
 -      if (!strict_strtoul(str, 0, &audit))
 +      if (!kstrtoul(str, 0, &audit))
                integrity_audit_info = audit ? 1 : 0;
        return 1;
  }
@@@ -33,14 -33,13 +33,14 @@@ void integrity_audit_msg(int audit_msgn
                         const char *cause, int result, int audit_info)
  {
        struct audit_buffer *ab;
 +      char name[TASK_COMM_LEN];
  
        if (!integrity_audit_info && audit_info == 1)   /* Skip info messages */
                return;
  
        ab = audit_log_start(current->audit_context, GFP_KERNEL, audit_msgno);
        audit_log_format(ab, "pid=%d uid=%u auid=%u ses=%u",
-                        current->pid,
+                        task_pid_nr(current),
                         from_kuid(&init_user_ns, current_cred()->uid),
                         from_kuid(&init_user_ns, audit_get_loginuid(current)),
                         audit_get_sessionid(current));
@@@ -50,7 -49,7 +50,7 @@@
        audit_log_format(ab, " cause=");
        audit_log_string(ab, cause);
        audit_log_format(ab, " comm=");
 -      audit_log_untrustedstring(ab, current->comm);
 +      audit_log_untrustedstring(ab, get_task_comm(name, current));
        if (fname) {
                audit_log_format(ab, " name=");
                audit_log_untrustedstring(ab, fname);