Merge branch 'linaro-android-3.10-lsk' of git://android.git.linaro.org/kernel/linaro...
authorMark Brown <broonie@kernel.org>
Wed, 5 Nov 2014 14:27:01 +0000 (14:27 +0000)
committerMark Brown <broonie@kernel.org>
Wed, 5 Nov 2014 14:27:01 +0000 (14:27 +0000)
Conflicts:
arch/arm64/Kconfig
arch/arm64/include/asm/barrier.h
arch/arm64/include/asm/elf.h
arch/arm64/include/asm/ptrace.h
arch/arm64/kernel/Makefile
arch/arm64/kernel/debug-monitors.c
arch/arm64/kernel/entry.S
arch/arm64/kernel/hw_breakpoint.c
arch/arm64/kernel/kuser32.S
arch/arm64/kernel/ptrace.c
arch/arm64/kernel/setup.c
arch/arm64/kernel/traps.c
kernel/fork.c

34 files changed:
1  2 
MAINTAINERS
arch/arm/Kconfig
arch/arm/include/asm/barrier.h
arch/arm/include/asm/syscall.h
arch/arm64/Kconfig
arch/arm64/include/asm/compat.h
arch/arm64/include/asm/ptrace.h
arch/arm64/include/asm/syscall.h
arch/arm64/include/asm/thread_info.h
arch/arm64/include/asm/unistd.h
arch/arm64/kernel/Makefile
arch/arm64/kernel/entry.S
arch/arm64/kernel/kuser32.S
arch/arm64/kernel/process.c
arch/arm64/kernel/ptrace.c
arch/arm64/kernel/setup.c
arch/arm64/kernel/signal32.c
arch/arm64/kernel/sys_compat.c
arch/arm64/mm/proc.S
arch/metag/include/asm/barrier.h
arch/mips/kernel/scall32-o32.S
arch/mips/kernel/scall64-64.S
arch/mips/kernel/scall64-n32.S
arch/mips/kernel/scall64-o32.S
arch/x86/syscalls/syscall_64.tbl
drivers/base/power/main.c
drivers/cpufreq/cpufreq_stats.c
fs/exec.c
include/linux/sched.h
kernel/fork.c
kernel/irq/pm.c
kernel/power/process.c
kernel/power/suspend.c
net/ipv4/tcp.c

diff --cc MAINTAINERS
Simple merge
index a8f736df80e40d01b1528e3fff23240e0087a91d,351e48e45cbb54830711caea8f51fd6ad4223fac..976d7c0ef24b58cb8553fc15c44e897d659c14aa
@@@ -20,9 -19,10 +20,9 @@@ config AR
        select GENERIC_STRNCPY_FROM_USER
        select GENERIC_STRNLEN_USER
        select HARDIRQS_SW_RESEND
 -      select HAVE_AOUT
        select HAVE_ARCH_JUMP_LABEL if !XIP_KERNEL
        select HAVE_ARCH_KGDB
-       select HAVE_ARCH_SECCOMP_FILTER if (AEABI && !OABI_COMPAT)
+       select HAVE_ARCH_SECCOMP_FILTER
        select HAVE_ARCH_TRACEHOOK
        select HAVE_BPF_JIT
        select HAVE_C_RECORDMCOUNT
index 60f15e274e6d461814eb467cc84dc8b0f0395163,b00ef075bc2e4adb7b08992d77d04c03ce91ac54..2f59f74433964016003167007badbeffcbba465a
  #define smp_rmb()     barrier()
  #define smp_wmb()     barrier()
  #else
 -#define smp_mb()      dmb()
 -#define smp_rmb()     dmb()
 -#define smp_wmb()     dmb()
 +#define smp_mb()      dmb(ish)
 +#define smp_rmb()     smp_mb()
 +#define smp_wmb()     dmb(ishst)
  #endif
  
+ #define smp_store_release(p, v)                                               \
+ do {                                                                  \
+       compiletime_assert_atomic_type(*p);                             \
+       smp_mb();                                                       \
+       ACCESS_ONCE(*p) = (v);                                          \
+ } while (0)
+ #define smp_load_acquire(p)                                           \
+ ({                                                                    \
+       typeof(*p) ___p1 = ACCESS_ONCE(*p);                             \
+       compiletime_assert_atomic_type(*p);                             \
+       smp_mb();                                                       \
+       ___p1;                                                          \
+ })
  #define read_barrier_depends()                do { } while(0)
  #define smp_read_barrier_depends()    do { } while(0)
  
Simple merge
index ad6917ac9b671d53f1ab1d916bca232fdc677838,43f1a2ee307c8b4e480036982bbf969c2719b228..4ff74ee25d6185675fb425759b8cdfbd7b659c2e
@@@ -11,12 -7,9 +11,13 @@@ config ARM6
        select ARM_AMBA
        select ARM_ARCH_TIMER
        select ARM_GIC
 +      select ARM_GIC_V3
 +      select BUILDTIME_EXTABLE_SORT
+       select AUDIT_ARCH_COMPAT_GENERIC
        select CLONE_BACKWARDS
        select COMMON_CLK
 +      select CPU_PM if (SUSPEND || CPU_IDLE)
 +      select DCACHE_WORD_ACCESS
        select GENERIC_CLOCKEVENTS
        select GENERIC_CLOCKEVENTS_BROADCAST if SMP
        select GENERIC_CPU_AUTOPROBE
        select GENERIC_IRQ_PROBE
        select GENERIC_IRQ_SHOW
        select GENERIC_SMP_IDLE_THREAD
 +      select GENERIC_STRNCPY_FROM_USER
 +      select GENERIC_STRNLEN_USER
        select GENERIC_TIME_VSYSCALL
        select HARDIRQS_SW_RESEND
 +      select HAVE_ARCH_JUMP_LABEL
 +      select HAVE_ARCH_KGDB
+       select HAVE_ARCH_AUDITSYSCALL
+       select HAVE_ARCH_SECCOMP_FILTER
        select HAVE_ARCH_TRACEHOOK
 +      select HAVE_C_RECORDMCOUNT
        select HAVE_DEBUG_BUGVERBOSE
        select HAVE_DEBUG_KMEMLEAK
        select HAVE_DMA_API_DEBUG
@@@ -296,16 -153,33 +299,41 @@@ config NR_CPU
        int "Maximum number of CPUs (2-32)"
        range 2 32
        depends on SMP
 -      default "4"
 +      # These have to remain sorted largest to smallest
 +      default "8"
 +
 +config HOTPLUG_CPU
 +      bool "Support for hot-pluggable CPUs"
 +      depends on SMP
 +      help
 +        Say Y here to experiment with turning CPUs off and on.  CPUs
 +        can be controlled through /sys/devices/system/cpu.
  
+ config SWP_EMULATE
+       bool "Emulate SWP/SWPB instructions"
+       help
+         ARMv6 architecture deprecates use of the SWP/SWPB instructions. ARMv8
+         oblosetes the use of SWP/SWPB instructions. ARMv7 multiprocessing
+         extensions introduce the ability to disable these instructions,
+         triggering an undefined instruction exception when executed. Say Y
+         here to enable software emulation of these instructions for userspace
+         (not kernel) using LDREX/STREX. Also creates /proc/cpu/swp_emulation
+         for statistics.
+         In some older versions of glibc [<=2.8] SWP is used during futex
+         trylock() operations with the assumption that the code will not
+         be preempted. This invalid assumption may be more likely to fail
+         with SWP emulation enabled, leading to deadlock of the user
+         application.
+         NOTE: when accessing uncached shared regions, LDREX/STREX rely
+         on an external transaction monitoring block called a global
+         monitor to maintain update atomicity. If your system does not
+         implement a global monitor, this option can cause programs that
+         perform SWP operations to uncached memory to deadlock.
+         If unsure, say Y.
  source kernel/Kconfig.preempt
  
  config HZ
@@@ -336,25 -210,43 +364,59 @@@ config HW_PERF_EVENT
          Enable hardware performance counter support for perf events. If
          disabled, perf events will use software events only.
  
 +config SYS_SUPPORTS_HUGETLBFS
 +      def_bool y
 +
 +config ARCH_WANT_GENERAL_HUGETLB
 +      def_bool y
 +
 +config ARCH_WANT_HUGE_PMD_SHARE
 +      def_bool y if !ARM64_64K_PAGES
 +
 +config HAVE_ARCH_TRANSPARENT_HUGEPAGE
 +      def_bool y
 +
+ config ARMV7_COMPAT
+       bool "Kernel support for ARMv7 applications"
+       depends on COMPAT
+       select SWP_EMULATE
+       help
+        This option enables features that allow that ran on an ARMv7 or older
+        processor to continue functioning.
+        If you want to execute ARMv7 applications, say Y
+ config ARMV7_COMPAT_CPUINFO
+       bool "Report backwards compatible cpu features in /proc/cpuinfo"
+       depends on ARMV7_COMPAT
+       default y
+       help
+        This option makes /proc/cpuinfo list CPU features that an ARMv7 or
+        earlier kernel would report, but are not optional on an ARMv8 or later
+        processor.
+        If you want to execute ARMv7 applications, say Y
  source "mm/Kconfig"
  
 -
 +config FORCE_MAX_ZONEORDER
 +      int
 +      default "14" if (ARM64_64K_PAGES && TRANSPARENT_HUGEPAGE)
 +      default "11"
 +
+ config SECCOMP
+       bool "Enable seccomp to safely compute untrusted bytecode"
+       ---help---
+         This kernel feature is useful for number crunching applications
+         that may need to compute untrusted bytecode during their
+         execution. By using pipes or other transports made available to
+         the process as file descriptors supporting the read/write
+         syscalls, it's possible to isolate those applications in
+         their own address space using seccomp. Once seccomp is
+         enabled via prctl(PR_SET_SECCOMP), it cannot be disabled
+         and the task is only allowed to execute a few safe syscalls
+         defined by each seccomp mode.
  endmenu
  
  menu "Boot options"
Simple merge
Simple merge
index 383771eb0b87b5c540b49bf0553ff99e4ff907b8,d7de9333f7146a3e51c318edd1b9f54cc464f8b8..709a574468f01a7fab6f20683310aee5f1689e3c
  #ifndef __ASM_SYSCALL_H
  #define __ASM_SYSCALL_H
  
+ #include <uapi/linux/audit.h>
+ #include <linux/compat.h>
  #include <linux/err.h>
  
 +extern const void *sys_call_table[];
  
  static inline int syscall_get_nr(struct task_struct *task,
                                 struct pt_regs *regs)
index 215f935619e75c1f8efc8b54c70be77ccf339a58,c77b13b4e36eaa00e2feee778a4c080e45d1579f..205d81b170235f3583856fc248405e66cbc90b5b
@@@ -125,11 -125,11 +125,15 @@@ static inline struct thread_info *curre
  #define _TIF_SIGPENDING               (1 << TIF_SIGPENDING)
  #define _TIF_NEED_RESCHED     (1 << TIF_NEED_RESCHED)
  #define _TIF_NOTIFY_RESUME    (1 << TIF_NOTIFY_RESUME)
 +#define _TIF_SYSCALL_TRACE    (1 << TIF_SYSCALL_TRACE)
 +#define _TIF_SYSCALL_AUDIT    (1 << TIF_SYSCALL_AUDIT)
 +#define _TIF_SYSCALL_TRACEPOINT       (1 << TIF_SYSCALL_TRACEPOINT)
 +#define _TIF_SECCOMP          (1 << TIF_SECCOMP)
  #define _TIF_FOREIGN_FPSTATE  (1 << TIF_FOREIGN_FPSTATE)
+ #define _TIF_SYSCALL_TRACE    (1 << TIF_SYSCALL_TRACE)
+ #define _TIF_SYSCALL_AUDIT    (1 << TIF_SYSCALL_AUDIT)
+ #define _TIF_SYSCALL_TRACEPOINT       (1 << TIF_SYSCALL_TRACEPOINT)
+ #define _TIF_SECCOMP          (1 << TIF_SECCOMP)
  #define _TIF_32BIT            (1 << TIF_32BIT)
  
  #define _TIF_WORK_MASK                (_TIF_NEED_RESCHED | _TIF_SIGPENDING | \
index c335479c26381ccb32370a5e01c25471717ba653,2a3957faa70211fc07a39118f19d289cef90ae1b..f67d0ec20f946987ef2b8c025b2936c43e3c169f
  #define __ARCH_WANT_COMPAT_SYS_SENDFILE
  #define __ARCH_WANT_SYS_FORK
  #define __ARCH_WANT_SYS_VFORK
+ /*
+  * Compat syscall numbers used by the AArch64 kernel.
+  */
+ #define __NR_compat_restart_syscall   0
+ #define __NR_compat_exit              1
+ #define __NR_compat_read              3
+ #define __NR_compat_write             4
+ #define __NR_compat_sigreturn         119
+ #define __NR_compat_rt_sigreturn      173
+ /*
+  * The following SVCs are ARM private.
+  */
+ #define __ARM_NR_COMPAT_BASE          0x0f0000
+ #define __ARM_NR_compat_cacheflush    (__ARM_NR_COMPAT_BASE+2)
+ #define __ARM_NR_compat_set_tls               (__ARM_NR_COMPAT_BASE+5)
+ #define __NR_compat_syscalls          384
  #endif
  #define __ARCH_WANT_SYS_CLONE
  #include <uapi/asm/unistd.h>
 +
 +#define NR_syscalls (__NR_syscalls)
index ac389d32ccde1c626f5f0de5ed02cf6bb03c6dfc,3e6706630ae5e151edc59d7099c2c6eebfa18219..23e19f94d44911b05ed175bf65084720932fe450
@@@ -15,24 -9,19 +15,27 @@@ CFLAGS_REMOVE_return_address.o = -p
  arm64-obj-y           := cputable.o debug-monitors.o entry.o irq.o fpsimd.o   \
                           entry-fpsimd.o process.o ptrace.o setup.o signal.o   \
                           sys.o stacktrace.o time.o traps.o io.o vdso.o        \
-                          hyp-stub.o psci.o cpu_ops.o insn.o return_address.o
 -                         hyp-stub.o psci.o opcodes.o
++                         hyp-stub.o psci.o cpu_ops.o insn.o return_address.o \
++                         opcodes.o
  
- arm64-obj-$(CONFIG_COMPAT)            += sys32.o kuser32.o signal32.o         \
+ arm64-obj-$(CONFIG_COMPAT)            += sys32.o kuser32.o signal32.o \
                                           sys_compat.o
 +arm64-obj-$(CONFIG_FUNCTION_TRACER)   += ftrace.o entry-ftrace.o
  arm64-obj-$(CONFIG_MODULES)           += arm64ksyms.o module.o
 -arm64-obj-$(CONFIG_SMP)                       += smp.o smp_spin_table.o smp_psci.o
 +arm64-obj-$(CONFIG_SMP)                       += smp.o smp_spin_table.o
 +arm64-obj-$(CONFIG_SMP)                       += topology.o
 +arm64-obj-$(CONFIG_PERF_EVENTS)               += perf_regs.o
  arm64-obj-$(CONFIG_HW_PERF_EVENTS)    += perf_event.o
 -arm64-obj-$(CONFIG_HAVE_HW_BREAKPOINT)+= hw_breakpoint.o
 +arm64-obj-$(CONFIG_HAVE_HW_BREAKPOINT)        += hw_breakpoint.o
  arm64-obj-$(CONFIG_EARLY_PRINTK)      += early_printk.o
 -arm64-obj-$(CONFIG_ARM_CPU_SUSPEND)   += sleep.o suspend.o
 +arm64-obj-$(CONFIG_ARM_CPU_TOPOLOGY)  += topology.o
 +arm64-obj-$(CONFIG_ARM64_CPU_SUSPEND) += sleep.o suspend.o
 +arm64-obj-$(CONFIG_JUMP_LABEL)                += jump_label.o
 +arm64-obj-$(CONFIG_KGDB)              += kgdb.o
 +arm64-obj-$(CONFIG_EFI)                       += efi.o efi-stub.o efi-entry.o
  
+ obj-$(CONFIG_SWP_EMULATE)     += swp_emulate.o
  obj-y                                 += $(arm64-obj-y) vdso/
  obj-m                                 += $(arm64-obj-m)
  head-y                                        := head.o
Simple merge
index 7787208e8cc6af3a4ff55226fb85ef6b8f8d30ba,2f5b3ff7e30dfc7ba3b5cc228a639950245cabda..9fb6d5a3cea791b177c08ca5282ab0e194fc9219
@@@ -28,7 -28,7 +28,8 @@@
   * See Documentation/arm/kernel_user_helpers.txt for formal definitions.
   */
  
+ #include <asm/unistd.h>
 +#include <asm/unistd32.h>
  
        .align  5
        .globl  __kuser_helper_start
index 10ad4d99266b272c6f8863fdc3b93218ff0e23e1,977ca8aa7dd10064af262b1e53800d2b23ca5acd..c09f85f80a9e8dc71a97889c2c9451ae440ced32
@@@ -161,20 -142,73 +161,84 @@@ void machine_restart(char *cmd
        while (1);
  }
  
+ /*
+  * dump a block of kernel memory from around the given address
+  */
+ static void show_data(unsigned long addr, int nbytes, const char *name)
+ {
+       int     i, j;
+       int     nlines;
+       u32     *p;
+       /*
+        * don't attempt to dump non-kernel addresses or
+        * values that are probably just small negative numbers
+        */
+       if (addr < PAGE_OFFSET || addr > -256UL)
+               return;
+       printk("\n%s: %#lx:\n", name, addr);
+       /*
+        * round address down to a 32 bit boundary
+        * and always dump a multiple of 32 bytes
+        */
+       p = (u32 *)(addr & ~(sizeof(u32) - 1));
+       nbytes += (addr & (sizeof(u32) - 1));
+       nlines = (nbytes + 31) / 32;
+       for (i = 0; i < nlines; i++) {
+               /*
+                * just display low 16 bits of address to keep
+                * each line of the dump < 80 characters
+                */
+               printk("%04lx ", (unsigned long)p & 0xffff);
+               for (j = 0; j < 8; j++) {
+                       u32     data;
+                       if (probe_kernel_address(p, data)) {
+                               printk(" ********");
+                       } else {
+                               printk(" %08x", data);
+                       }
+                       ++p;
+               }
+               printk("\n");
+       }
+ }
+ static void show_extra_register_data(struct pt_regs *regs, int nbytes)
+ {
+       mm_segment_t fs;
+       unsigned int i;
+       fs = get_fs();
+       set_fs(KERNEL_DS);
+       show_data(regs->pc - nbytes, nbytes * 2, "PC");
+       show_data(regs->regs[30] - nbytes, nbytes * 2, "LR");
+       show_data(regs->sp - nbytes, nbytes * 2, "SP");
+       for (i = 0; i < 30; i++) {
+               char name[4];
+               snprintf(name, sizeof(name), "X%u", i);
+               show_data(regs->regs[i] - nbytes, nbytes * 2, name);
+       }
+       set_fs(fs);
+ }
  void __show_regs(struct pt_regs *regs)
  {
 -      int i;
 +      int i, top_reg;
 +      u64 lr, sp;
 +
 +      if (compat_user_mode(regs)) {
 +              lr = regs->compat_lr;
 +              sp = regs->compat_sp;
 +              top_reg = 12;
 +      } else {
 +              lr = regs->regs[30];
 +              sp = regs->sp;
 +              top_reg = 29;
 +      }
  
        show_regs_print_info(KERN_DEFAULT);
        print_symbol("PC is at %s\n", instruction_pointer(regs));
index 70311740677a88e9ef334d96ee7a01e23dd6329f,f47e70fed6af77e714601af2afaf247f84772313..e1f70225a919e392076f0371679e1ce864443931
@@@ -1101,17 -1112,40 +1116,22 @@@ asmlinkage int syscall_trace_enter(stru
        if (test_thread_flag(TIF_SYSCALL_TRACE))
                tracehook_report_syscall(regs, PTRACE_SYSCALL_ENTER);
  
 -      if (IS_SKIP_SYSCALL(regs->syscallno)) {
 -              /*
 -               * RESTRICTION: we can't modify a return value of user
 -               * issued syscall(-1) here. In order to ease this flavor,
 -               * we need to treat whatever value in x0 as a return value,
 -               * but this might result in a bogus value being returned.
 -               */
 -              /*
 -               * NOTE: syscallno may also be set to -1 if fatal signal is
 -               * detected in tracehook_report_syscall_entry(), but since
 -               * a value set to x0 here is not used in this case, we may
 -               * neglect the case.
 -               */
 -              if (!test_thread_flag(TIF_SYSCALL_TRACE) ||
 -                              (IS_SKIP_SYSCALL(saved_syscallno)))
 -                      regs->regs[0] = -ENOSYS;
 -      }
 +      if (test_thread_flag(TIF_SYSCALL_TRACEPOINT))
 +              trace_sys_enter(regs, regs->syscallno);
  
+       audit_syscall_entry(syscall_get_arch(), regs->syscallno,
+               regs->orig_x0, regs->regs[1], regs->regs[2], regs->regs[3]);
        return regs->syscallno;
  }
  
  asmlinkage void syscall_trace_exit(struct pt_regs *regs)
  {
 +      if (test_thread_flag(TIF_SYSCALL_TRACEPOINT))
 +              trace_sys_exit(regs, regs_return_value(regs));
 +
+       audit_syscall_exit(regs);
        if (test_thread_flag(TIF_SYSCALL_TRACE))
                tracehook_report_syscall(regs, PTRACE_SYSCALL_EXIT);
  }
Simple merge
Simple merge
Simple merge
index e085ee6ef4e23c146627798b9c7b98411a719f36,25929f65b5f2c6619c2b6b44781046465e5a5431..e832494016157716da981c07097ba0b0d5e3535e
@@@ -235,5 -180,6 +249,6 @@@ crval
         */
        .type   crval, #object
  crval:
 -      .word   0x030802e2                      // clear
 +      .word   0x000802e2                      // clear
        .word   0x0405d11d                      // set
+ #endif
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
index a42c3548bdd34bcfe4d3e47390c438333c7d35cc,5131ad8ca17f7550d53666bb7d3b86ffd2a063db..2c41a74d0eda09e2b087db0ecbd0b49b68128fa2
  #include <linux/sched.h>
  #include <linux/async.h>
  #include <linux/suspend.h>
 +#include <trace/events/power.h>
 +#include <linux/cpufreq.h>
  #include <linux/cpuidle.h>
  #include <linux/timer.h>
+ #include <linux/wakeup_reason.h>
  
  #include "../base.h"
  #include "power.h"
Simple merge
diff --cc fs/exec.c
Simple merge
Simple merge
diff --cc kernel/fork.c
Simple merge
diff --cc kernel/irq/pm.c
Simple merge
Simple merge
Simple merge
diff --cc net/ipv4/tcp.c
Simple merge