From: Mark Brown Date: Wed, 5 Nov 2014 14:27:01 +0000 (+0000) Subject: Merge branch 'linaro-android-3.10-lsk' of git://android.git.linaro.org/kernel/linaro... X-Git-Tag: firefly_0821_release~3680^2~51^2 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=f42afd0e0390a22dec05cda87c195d5d724d3ec8;p=firefly-linux-kernel-4.4.55.git Merge branch 'linaro-android-3.10-lsk' of git://android.git.linaro.org/kernel/linaro-android into linux-linaro-lsk-android 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 --- f42afd0e0390a22dec05cda87c195d5d724d3ec8 diff --cc arch/arm/Kconfig index a8f736df80e4,351e48e45cbb..976d7c0ef24b --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@@ -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 diff --cc arch/arm/include/asm/barrier.h index 60f15e274e6d,b00ef075bc2e..2f59f7443396 --- a/arch/arm/include/asm/barrier.h +++ b/arch/arm/include/asm/barrier.h @@@ -54,11 -54,26 +54,26 @@@ #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) diff --cc arch/arm64/Kconfig index ad6917ac9b67,43f1a2ee307c..4ff74ee25d61 --- a/arch/arm64/Kconfig +++ b/arch/arm64/Kconfig @@@ -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 @@@ -25,14 -17,11 +26,16 @@@ 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" diff --cc arch/arm64/include/asm/syscall.h index 383771eb0b87,d7de9333f714..709a574468f0 --- a/arch/arm64/include/asm/syscall.h +++ b/arch/arm64/include/asm/syscall.h @@@ -16,9 -16,10 +16,11 @@@ #ifndef __ASM_SYSCALL_H #define __ASM_SYSCALL_H + #include + #include #include +extern const void *sys_call_table[]; static inline int syscall_get_nr(struct task_struct *task, struct pt_regs *regs) diff --cc arch/arm64/include/asm/thread_info.h index 215f935619e7,c77b13b4e36e..205d81b17023 --- a/arch/arm64/include/asm/thread_info.h +++ b/arch/arm64/include/asm/thread_info.h @@@ -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 | \ diff --cc arch/arm64/include/asm/unistd.h index c335479c2638,2a3957faa702..f67d0ec20f94 --- a/arch/arm64/include/asm/unistd.h +++ b/arch/arm64/include/asm/unistd.h @@@ -25,8 -25,26 +25,28 @@@ #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 + +#define NR_syscalls (__NR_syscalls) diff --cc arch/arm64/kernel/Makefile index ac389d32ccde,3e6706630ae5..23e19f94d449 --- a/arch/arm64/kernel/Makefile +++ b/arch/arm64/kernel/Makefile @@@ -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 diff --cc arch/arm64/kernel/kuser32.S index 7787208e8cc6,2f5b3ff7e30d..9fb6d5a3cea7 --- a/arch/arm64/kernel/kuser32.S +++ b/arch/arm64/kernel/kuser32.S @@@ -28,7 -28,7 +28,8 @@@ * See Documentation/arm/kernel_user_helpers.txt for formal definitions. */ + #include +#include .align 5 .globl __kuser_helper_start diff --cc arch/arm64/kernel/process.c index 10ad4d99266b,977ca8aa7dd1..c09f85f80a9e --- a/arch/arm64/kernel/process.c +++ b/arch/arm64/kernel/process.c @@@ -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)); diff --cc arch/arm64/kernel/ptrace.c index 70311740677a,f47e70fed6af..e1f70225a919 --- a/arch/arm64/kernel/ptrace.c +++ b/arch/arm64/kernel/ptrace.c @@@ -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); } diff --cc arch/arm64/mm/proc.S index e085ee6ef4e2,25929f65b5f2..e83249401615 --- a/arch/arm64/mm/proc.S +++ b/arch/arm64/mm/proc.S @@@ -235,5 -180,6 +249,6 @@@ crval */ .type crval, #object crval: - .word 0x030802e2 // clear + .word 0x000802e2 // clear .word 0x0405d11d // set + #endif diff --cc drivers/base/power/main.c index a42c3548bdd3,5131ad8ca17f..2c41a74d0eda --- a/drivers/base/power/main.c +++ b/drivers/base/power/main.c @@@ -28,10 -28,9 +28,11 @@@ #include #include #include +#include +#include #include #include + #include #include "../base.h" #include "power.h"