Linux 4.4.200
Greg KH
maintainerI'm announcing the release of the 4.4.200 kernel.
All users of the 4.4 kernel series must upgrade.
The updated 4.4.y git tree can be found at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git linux-4.4.y
and can be browsed at the normal kernel.org git web browser:
https://git.kernel.org/?p=linux/kernel/git/stable/linux-stable.git;a=summary
thanks,
greg k-h
------------
Makefile | 8 arch/arm/Kconfig | 3 arch/arm/boot/dts/logicpd-torpedo-som.dtsi | 4 arch/arm/include/asm/arch_gicv3.h | 27 - arch/arm/include/asm/assembler.h | 23 + arch/arm/include/asm/barrier.h | 34 ++ arch/arm/include/asm/bugs.h | 6 arch/arm/include/asm/cp15.h | 18 + arch/arm/include/asm/cputype.h | 9 arch/arm/include/asm/proc-fns.h | 65 +++- arch/arm/include/asm/system_misc.h | 15 arch/arm/include/asm/thread_info.h | 8 arch/arm/include/asm/uaccess.h | 177 ++++++----- arch/arm/kernel/Makefile | 4 arch/arm/kernel/armksyms.c | 6 arch/arm/kernel/bugs.c | 18 + arch/arm/kernel/entry-common.S | 18 - arch/arm/kernel/entry-header.S | 25 + arch/arm/kernel/head-common.S | 6 arch/arm/kernel/psci-call.S | 31 - arch/arm/kernel/setup.c | 40 +- arch/arm/kernel/signal.c | 125 ++++--- arch/arm/kernel/smccc-call.S | 62 +++ arch/arm/kernel/smp.c | 36 ++ arch/arm/kernel/suspend.c | 2 arch/arm/kernel/sys_oabi-compat.c | 16 - arch/arm/lib/copy_from_user.S | 5 arch/arm/mm/Kconfig | 23 + arch/arm/mm/Makefile | 2 arch/arm/mm/alignment.c | 44 ++ arch/arm/mm/fault.c | 3 arch/arm/mm/proc-macros.S | 13 arch/arm/mm/proc-v7-2level.S | 6 arch/arm/mm/proc-v7-bugs.c | 161 ++++++++++ arch/arm/mm/proc-v7.S | 154 +++++++-- arch/arm/vfp/vfpmodule.c | 37 -- arch/arm64/Kconfig | 1 arch/arm64/kernel/Makefile | 4 arch/arm64/kernel/arm64ksyms.c | 5 arch/arm64/kernel/asm-offsets.c | 3 arch/arm64/kernel/psci-call.S | 28 - arch/arm64/kernel/smccc-call.S | 43 ++ arch/mips/bcm63xx/prom.c | 2 arch/mips/include/asm/bmips.h | 10 arch/mips/kernel/smp-bmips.c | 8 drivers/dma/qcom_bam_dma.c | 14 drivers/firmware/Kconfig | 3 drivers/firmware/psci.c | 78 ++++ drivers/net/ethernet/hisilicon/hip04_eth.c | 15 drivers/net/ethernet/mellanox/mlx4/resource_tracker.c | 42 +- drivers/net/vxlan.c | 5 drivers/of/unittest.c | 1 drivers/regulator/pfuze100-regulator.c | 8 drivers/regulator/ti-abb-regulator.c | 26 - drivers/scsi/Kconfig | 2 drivers/scsi/sni_53c710.c | 4 drivers/target/target_core_device.c | 21 - fs/cifs/cifsglob.h | 5 fs/cifs/cifsproto.h | 1 fs/cifs/file.c | 23 - fs/cifs/smb2file.c | 2 fs/dcache.c | 2 include/linux/arm-smccc.h | 283 ++++++++++++++++++ include/linux/gfp.h | 23 + include/linux/psci.h | 13 include/linux/skbuff.h | 3 include/net/flow_dissector.h | 3 include/net/sock.h | 11 kernel/time/alarmtimer.c | 4 net/core/datagram.c | 2 net/core/ethtool.c | 4 net/core/flow_dissector.c | 48 +-- net/dccp/ipv4.c | 4 net/ipv4/datagram.c | 2 net/ipv4/tcp_ipv4.c | 4 net/sched/sch_fq_codel.c | 6 net/sched/sch_hhf.c | 8 net/sched/sch_sfb.c | 13 net/sched/sch_sfq.c | 14 net/sctp/socket.c | 2 sound/soc/rockchip/rockchip_i2s.c | 2 tools/perf/builtin-kmem.c | 1 82 files changed, 1555 insertions(+), 485 deletions(-)
Adam Ford (1):
ARM: dts: logicpd-torpedo-som: Remove twl_keypad
Andrey Ryabinin (1):
ARM: 8051/1: put_user: fix possible data corruption in put_user
Axel Lin (1):
regulator: ti-abb: Fix timeout in ti_abb_wait_txdone/ti_abb_clear_all_txdone
Bodo Stroesser (1):
scsi: target: core: Do not overwrite CDB byte 1
Dave Wysochanski (1):
cifs: Fix cifsInodeInfo lock_sem deadlock when reconnect occurs
Eran Ben Elisha (1):
net/mlx4_core: Dynamically set guaranteed amount of counters per VF
Eric Dumazet (4):
dccp: do not leak jiffies on the wire
net: add READ_ONCE() annotation in __skb_wait_for_more_packets()
inet: stop leaking jiffies on the wire net/flow_dissector: switch to siphash
Greg Kroah-Hartman (1):
Linux 4.4.200
Jeffrey Hugo (1):
dmaengine: qcom: bam_dma: Fix resource leak
Jens Wiklander (4):
ARM: 8478/2: arm/arm64: add arm-smccc
ARM: 8479/2: add implementation for arm-smccc
ARM: 8480/2: arm64: add implementation for arm-smccc
ARM: 8481/2: drivers: psci: replace psci firmware calls
Jiangfeng Xiao (1):
net: hisilicon: Fix ping latency when deal with high throughput
Jonas Gorski (1):
MIPS: bmips: mark exception vectors as char arrays
Julien Thierry (8):
ARM: 8789/1: signal: copy registers using __copy_to_user()
ARM: 8791/1: vfp: use __copy_to_user() when saving VFP state
ARM: 8792/1: oabi-compat: copy oabi events using __copy_to_user()
ARM: 8793/1: signal: replace __put_user_error with __put_user
ARM: 8794/1: uaccess: Prevent speculative use of the current addr_limit
ARM: 8795/1: spectre-v1.1: use put_user() for __put_user()
ARM: 8796/1: spectre-v1,v1.1: provide helpers for address sanitization
ARM: 8810/1: vfp: Fix wrong assignement to ufp_exc
Marc Zyngier (9):
arm/arm64: KVM: Advertise SMCCC v1.1
arm64: KVM: Report SMCCC_ARCH_WORKAROUND_1 BP hardening support firmware/psci: Expose PSCI conduit
firmware/psci: Expose SMCCC version through psci_ops arm/arm64: smccc: Make function identifiers an unsigned quantity arm/arm64: smccc: Implement SMCCC v1.1 inline primitive arm/arm64: smccc: Add SMCCC-specific return codes arm/arm64: smccc-1.1: Make return values unsigned long arm/arm64: smccc-1.1: Handle function result as parameters
Navid Emamdoost (1):
of: unittest: fix memory leak in unittest_data_add
Petr Vorel (1):
alarmtimer: Change remaining ENOTSUPP to EOPNOTSUPP
Robin Murphy (1):
ASoc: rockchip: i2s: Fix RPM imbalance
Russell King (28):
ARM: mm: fix alignment handler faults under memory pressure
ARM: uaccess: remove put_user() code duplication
ARM: add more CPU part numbers for Cortex and Brahma B15 CPUs
ARM: bugs: prepare processor bug infrastructure
ARM: bugs: hook processor bug checking into SMP and suspend paths
ARM: bugs: add support for per-processor bug checking
ARM: spectre: add Kconfig symbol for CPUs vulnerable to Spectre
ARM: spectre-v2: harden branch predictor on context switches
ARM: spectre-v2: add Cortex A8 and A15 validation of the IBE bit
ARM: spectre-v2: harden user aborts in kernel space
ARM: spectre-v2: add firmware based hardening
ARM: spectre-v2: warn about incorrect context switching functions
ARM: spectre-v1: add speculation barrier (csdb) macros
ARM: spectre-v1: add array_index_mask_nospec() implementation
ARM: spectre-v1: fix syscall entry
ARM: signal: copy registers using __copy_from_user()
ARM: vfp: use __copy_from_user() when restoring VFP state
ARM: oabi-compat: copy semops using __copy_from_user()
ARM: use __inttype() in get_user()
ARM: spectre-v1: use get_user() for __get_user()
ARM: spectre-v1: mitigate user accesses
ARM: make lookup_processor_type() non-__init
ARM: split out processor lookup
ARM: clean up per-processor check_bugs method call
ARM: add PROC_VTABLE and PROC_TABLE macros
ARM: spectre-v2: per-CPU vtables to work around big.Little systems
ARM: ensure that processor vtables is not lost after boot
ARM: fix the cockup in the previous patch
Seth Forshee (1):
kbuild: add -fcf-protection=none when using retpoline flags
Tejun Heo (1):
net: fix sk_page_frag() recursion from memory reclaim
Thomas Bogendoerfer (2):
scsi: sni_53c710: fix compilation error
scsi: fix kconfig dependency warning related to 53C700_LE_ON_BE
Vladimir Murzin (1):
ARM: Move system register accessors to asm/cp15.h
Xin Long (1):
vxlan: check tun_info options_len properly
Yizhuo (1):
regulator: pfuze100-regulator: Variable "val" in pfuze100_regulator_probe() could be uninitialized
Yunfeng Ye (1):
perf kmem: Fix memory leak in compact_gfp_flags()
zhanglin (1):
net: Zeroing the structure ethtool_wolinfo in ethtool_get_wol()
zhangyi (F) (1):
fs/dcache: move security_d_instantiate() behind attaching dentry to inode
Greg KH
maintainerMakefile +7 -1
@@ -1,6 +1,6 @@ VERSION = 4 PATCHLEVEL = 4 -SUBLEVEL = 199 +SUBLEVEL = 200 EXTRAVERSION = NAME = Blurry Fish Butt
@@ -823,6 +823,12 @@ KBUILD_CFLAGS += $(call cc-option,-Werror=strict-prototypes) # Prohibit date/time macros, which would make the build non-deterministic KBUILD_CFLAGS += $(call cc-option,-Werror=date-time) +# ensure -fcf-protection is disabled when using retpoline as it is +# incompatible with -mindirect-branch=thunk-extern +ifdef CONFIG_RETPOLINE +KBUILD_CFLAGS += $(call cc-option,-fcf-protection=none) +endif + # use the deterministic mode of AR if available KBUILD_ARFLAGS := $(call ar-option,D)
arch/arm/Kconfig +2 -1
@@ -37,6 +37,7 @@ config ARM select HAVE_ARCH_KGDB if !CPU_ENDIAN_BE32 select HAVE_ARCH_SECCOMP_FILTER if (AEABI && !OABI_COMPAT) select HAVE_ARCH_TRACEHOOK + select HAVE_ARM_SMCCC if CPU_V7 select HAVE_BPF_JIT select HAVE_CC_STACKPROTECTOR select HAVE_CONTEXT_TRACKING
@@ -1481,7 +1482,7 @@ config HOTPLUG_CPU config ARM_PSCI bool "Support for the ARM Power State Coordination Interface (PSCI)" - depends on CPU_V7 + depends on HAVE_ARM_SMCCC select ARM_PSCI_FW help Say Y here if you want Linux to communicate with system firmware
arch/arm/boot/dts/logicpd-torpedo-som.dtsi +4 -0
@@ -169,3 +169,7 @@ &twl_gpio { ti,use-leds; }; + +&twl_keypad { + status = "disabled"; +};
arch/arm/include/asm/arch_gicv3.h +11 -16
@@ -22,9 +22,7 @@#include <linux/io.h> #include <asm/barrier.h> - -#define __ACCESS_CP15 (CRn, Op1, CRm, Op2) p15, Op1, %0, CRn, CRm, Op2 -#define __ACCESS_CP15_64 (Op1, CRm) p15, Op1, %Q0, %R0, CRm +#include <asm/cp15.h> #define ICC_EOIR1 __ACCESS_CP15(c12, 0, c12, 1)#define ICC_DIR __ACCESS_CP15(c12, 0, c11, 1)
@@ -102,58 +100,55 @@static inline void gic_write_eoir (u32 irq) { - asm volatile("mcr " __stringify(ICC_EOIR1) : : "r" (irq)); +write_sysreg (irq,ICC_EOIR1 );isb (); }static inline void gic_write_dir (u32 val) { - asm volatile("mcr " __stringify(ICC_DIR) : : "r" (val)); +write_sysreg (val,ICC_DIR );isb (); }static inline u32 gic_read_iar (void ) { -u32 irqstat; +u32 irqstat =read_sysreg (ICC_IAR1 ); - asm volatile("mrc " __stringify(ICC_IAR1) : "=r" (irqstat));dsb (sy); +return irqstat; }static inline void gic_write_pmr (u32 val) { - asm volatile("mcr " __stringify(ICC_PMR) : : "r" (val)); +write_sysreg (val,ICC_PMR ); }static inline void gic_write_ctlr (u32 val) { - asm volatile("mcr " __stringify(ICC_CTLR) : : "r" (val)); +write_sysreg (val,ICC_CTLR );isb (); }static inline void gic_write_grpen1 (u32 val) { - asm volatile("mcr " __stringify(ICC_IGRPEN1) : : "r" (val)); +write_sysreg (val,ICC_IGRPEN1 );isb (); }static inline void gic_write_sgi1r (u64 val) { - asm volatile("mcrr " __stringify(ICC_SGI1R) : : "r" (val)); +write_sysreg (val,ICC_SGI1R ); }static inline u32 gic_read_sre (void ) { -u32 val; - - asm volatile("mrc " __stringify(ICC_SRE) : "=r" (val)); -return val; +return read_sysreg (ICC_SRE ); }static inline void gic_write_sre (u32 val) { - asm volatile("mcr " __stringify(ICC_SRE) : : "r" (val)); +write_sysreg (val,ICC_SRE );isb (); }
arch/arm/include/asm/assembler.h +23 -0
@@ -441,11 +441,34 @@ THUMB( orr \reg , \reg , #PSR_T_BIT ) .size \name , . - \name .endm + .macro csdb +#ifdef CONFIG_THUMB2_KERNEL + .inst.w 0xf3af8014 +#else + .inst 0xe320f014 +#endif + .endm + .macro check_uaccess, addr:req, size:req, limit:req, tmp:req, bad:req#ifndef CONFIG_CPU_USE_DOMAINS adds \tmp, \addr, #\size - 1 sbcccs \tmp, \tmp, \limit bcs \bad +#ifdef CONFIG_CPU_SPECTRE + movcs \addr, #0 + csdb +#endif +#endif + .endm + + .macro uaccess_mask_range_ptr, addr:req, size:req, limit:req, tmp:req +#ifdef CONFIG_CPU_SPECTRE + sub \tmp, \limit, #1 + subs \tmp, \tmp, \addr @ tmp = limit - 1 - addr + addhs \tmp, \tmp, #1 @ if (tmp >= 0) { + subhss \tmp, \tmp, \size @ tmp = limit - (addr + size) } + movlo \addr, #0 @ if (tmp < 0) addr = NULL + csdb #endif .endm
arch/arm/include/asm/barrier.h +34 -0
@@ -18,6 +18,12 @@#define isb (option) __asm__ __volatile__ ("isb " #option : : : "memory")#define dsb (option) __asm__ __volatile__ ("dsb " #option : : : "memory")#define dmb (option) __asm__ __volatile__ ("dmb " #option : : : "memory") +#ifdef CONFIG_THUMB2_KERNEL +#define CSDB ".inst.w 0xf3af8014" +#else +#define CSDB ".inst 0xe320f014" +#endif +#define csdb () __asm__ __volatile__(CSDB : : : "memory")#elif defined(CONFIG_CPU_XSC3 ) || __LINUX_ARM_ARCH__ ==6 #define isb (x) __asm__ __volatile__ ("mcr p15, 0, %0, c7, c5, 4" \ : : "r" (0) : "memory")
@@ -38,6 +44,13 @@#define dmb (x) __asm__ __volatile__ ("" : : : "memory")#endif +#ifndef CSDB +#define CSDB +#endif +#ifndef csdb +#define csdb () +#endif +#ifdef CONFIG_ARM_HEAVY_MB extern void (*soc_mb)(void );extern void arm_heavy_mb (void );
@@ -95,5 +108,26 @@ do { \#define smp_mb__before_atomic () smp_mb()#define smp_mb__after_atomic () smp_mb() +#ifdef CONFIG_CPU_SPECTRE +static inline unsigned long array_index_mask_nospec (unsigned long idx, +unsigned long sz) +{ +unsigned long mask; + + asmvolatile ( +"cmp %1, %2\n" +" sbc %0, %1, %1\n" +CSDB + :"=r" (mask) + :"r" (idx),"Ir" (sz) + :"cc" ); + +return mask; +} +#define array_index_mask_nospec array_index_mask_nospec +#endif + +#include <asm-generic/barrier.h> +#endif /* !__ASSEMBLY__ */ #endif /* __ASM_BARRIER_H */
arch/arm/include/asm/bugs.h +4 -2
@@ -10,12 +10,14 @@#ifndef __ASM_BUGS_H#define __ASM_BUGS_H -#ifdef CONFIG_MMU extern void check_writebuffer_bugs (void ); -#define check_bugs () check_writebuffer_bugs() +#ifdef CONFIG_MMU +extern void check_bugs (void ); +extern void check_other_bugs (void );#else #define check_bugs () do { } while (0) +#define check_other_bugs () do { } while (0)#endif #endif
arch/arm/include/asm/cp15.h +18 -0
@@ -49,6 +49,24 @@#ifdef CONFIG_CPU_CP15 +#define __ACCESS_CP15 (CRn, Op1, CRm, Op2) \ + "mrc", "mcr", __stringify(p15, Op1, %0, CRn, CRm, Op2), u32 +#define __ACCESS_CP15_64 (Op1, CRm) \ + "mrrc", "mcrr", __stringify(p15, Op1, %Q0, %R0, CRm), u64 + +#define __read_sysreg (r, w, c, t) ({ \ + t __val; \ + asm volatile(r " " c : "=r" (__val)); \ + __val; \ +}) +#define read_sysreg (...) __read_sysreg(__VA_ARGS__) + +#define __write_sysreg (v, r, w, c, t) asm volatile(w " " c : : "r" ((t)(v))) +#define write_sysreg (v, ...) __write_sysreg(v, __VA_ARGS__) + +#define BPIALL __ACCESS_CP15(c7, 0, c5, 6) +#define ICIALLU __ACCESS_CP15(c7, 0, c5, 0) +extern unsigned long cr_alignment;/* defined in entry-armv.S */ static inline unsigned long get_cr (void )
arch/arm/include/asm/cputype.h +9 -0
@@ -74,8 +74,16 @@#define ARM_CPU_PART_CORTEX_A12 0x4100c0d0#define ARM_CPU_PART_CORTEX_A17 0x4100c0e0#define ARM_CPU_PART_CORTEX_A15 0x4100c0f0 +#define ARM_CPU_PART_CORTEX_A53 0x4100d030 +#define ARM_CPU_PART_CORTEX_A57 0x4100d070 +#define ARM_CPU_PART_CORTEX_A72 0x4100d080 +#define ARM_CPU_PART_CORTEX_A73 0x4100d090 +#define ARM_CPU_PART_CORTEX_A75 0x4100d0a0#define ARM_CPU_PART_MASK 0xff00fff0 +/* Broadcom cores */ +#define ARM_CPU_PART_BRAHMA_B15 0x420000f0 +#define ARM_CPU_XSCALE_ARCH_MASK 0xe000#define ARM_CPU_XSCALE_ARCH_V1 0x2000#define ARM_CPU_XSCALE_ARCH_V2 0x4000
@@ -85,6 +93,7 @@#define ARM_CPU_PART_SCORPION 0x510002d0extern unsigned int processor_id; +struct proc_info_list *lookup_processor (u32 midr);#ifdef CONFIG_CPU_CP15 #define read_cpuid (reg) \
arch/arm/include/asm/proc-fns.h +53 -12
92 lines not on this page · raw message
arch/arm/include/asm/system_misc.h +15 -0
@@ -7,6 +7,7 @@#include <linux/linkage.h> #include <linux/irqflags.h> #include <linux/reboot.h> +#include <linux/percpu.h> extern void cpu_init (void );
@@ -14,6 +15,20 @@ void soft_restart(unsigned long);extern void (*arm_pm_restart)(enum reboot_mode reboot_mode,const char *cmd);extern void (*arm_pm_idle)(void ); +#ifdef CONFIG_HARDEN_BRANCH_PREDICTOR +typedef void (*harden_branch_predictor_fn_t )(void ); +DECLARE_PER_CPU (harden_branch_predictor_fn_t, harden_branch_predictor_fn); +static inline void harden_branch_predictor (void ) +{ +harden_branch_predictor_fn_t fn =per_cpu (harden_branch_predictor_fn, +smp_processor_id ()); +if (fn) +fn (); +} +#else +#define harden_branch_predictor () do { } while (0) +#endif +#define UDBG_UNDEFINED (1 << 0)#define UDBG_SYSCALL (1 << 1)#define UDBG_BADABORT (1 << 2)
arch/arm/include/asm/thread_info.h +4 -4
@@ -124,10 +124,10 @@ extern void vfp_flush_hwstate(struct thread_info *);struct user_vfp ;struct user_vfp_exc ; -extern int vfp_preserve_user_clear_hwstate (struct user_vfp __user *, -struct user_vfp_exc __user *); -extern int vfp_restore_user_hwstate (struct user_vfp __user *, -struct user_vfp_exc __user *); +extern int vfp_preserve_user_clear_hwstate (struct user_vfp *, +struct user_vfp_exc *); +extern int vfp_restore_user_hwstate (struct user_vfp *, +struct user_vfp_exc *);#endif /*
arch/arm/include/asm/uaccess.h +109 -68
245 lines not on this page · raw message
arch/arm/kernel/Makefile +3 -1
@@ -30,6 +30,7 @@ else obj-y += entry-armv.o endif +obj-$(CONFIG_MMU) += bugs.o obj-$(CONFIG_CPU_IDLE) += cpuidle.o obj-$(CONFIG_ISA_DMA_API) += dma.o obj-$(CONFIG_FIQ) += fiq.o fiqasm.o
@@ -87,8 +88,9 @@ obj-$(CONFIG_EARLY_PRINTK) += early_printk.o obj-$(CONFIG_ARM_VIRT_EXT) += hyp-stub.o ifeq ($(CONFIG_ARM_PSCI),y) -obj-y += psci-call.o obj-$(CONFIG_SMP) += psci_smp.o endif +obj-$(CONFIG_HAVE_ARM_SMCCC) += smccc-call.o + extra-y := $(head-y) vmlinux.lds
arch/arm/kernel/armksyms.c +6 -0
@@ -16,6 +16,7 @@#include <linux/syscalls.h> #include <linux/uaccess.h> #include <linux/io.h> +#include <linux/arm-smccc.h> #include <asm/checksum.h> #include <asm/ftrace.h>
@@ -175,3 +176,8 @@ EXPORT_SYMBOL(__gnu_mcount_nc);EXPORT_SYMBOL (__pv_phys_pfn_offset);EXPORT_SYMBOL (__pv_offset);#endif + +#ifdef CONFIG_HAVE_ARM_SMCCC +EXPORT_SYMBOL (arm_smccc_smc); +EXPORT_SYMBOL (arm_smccc_hvc); +#endif
arch/arm/kernel/bugs.c new file +18 -0
@@ -0,0 +1,18 @@ +// SPDX-Identifier: GPL-2.0 +#include <linux/init.h> +#include <asm/bugs.h> +#include <asm/proc-fns.h> + +void check_other_bugs (void ) +{ +#ifdef MULTI_CPU +if (cpu_check_bugs) +cpu_check_bugs (); +#endif +} + +void __init check_bugs (void ) +{ +check_writebuffer_bugs (); +check_other_bugs (); +}
arch/arm/kernel/entry-common.S +7 -11
@@ -223,9 +223,7 @@ local_restart: tst r10, #_TIF_SYSCALL_WORK @ are we tracing syscalls? bne __sys_trace - cmp scno, #NR_syscalls @ check upper syscall limit - badr lr, ret_fast_syscall @ return address - ldrcc pc, [tbl, scno, lsl #2] @ call sys_* routine + invoke_syscall tbl, scno, r10, ret_fast_syscall add r1, sp, #S_OFF 2: cmp scno, #(__ARM_NR_BASE - __NR_SYSCALL_BASE)
@@ -258,14 +256,8 @@ __sys_trace: mov r1, scno add r0, sp, #S_OFF bl syscall_trace_enter - - badr lr, __sys_trace_return @ return address - mov scno, r0 @ syscall number (possibly new) - add r1, sp, #S_R0 + S_OFF @ pointer to regs - cmp scno, #NR_syscalls @ check upper syscall limit - ldmccia r1, {r0 - r6} @ have to reload r0 - r6 - stmccia sp, {r4, r5} @ and update the stack args - ldrcc pc, [tbl, scno, lsl #2] @ call sys_* routine + mov scno, r0 + invoke_syscall tbl, scno, r10, __sys_trace_return, reload=1 cmp scno, #-1 @ skip the syscall? bne 2b add sp, sp, #S_OFF @ restore stack
@@ -317,6 +309,10 @@ sys_syscall: bic scno, r0, #__NR_OABI_SYSCALL_BASE cmp scno, #__NR_syscall - __NR_SYSCALL_BASE cmpne scno, #NR_syscalls @ check range +#ifdef CONFIG_CPU_SPECTRE + movhs scno, #0 + csdb +#endif stmloia sp, {r5, r6} @ shuffle args movlo r0, r1 movlo r1, r2
arch/arm/kernel/entry-header.S +25 -0
@@ -373,6 +373,31 @@ #endif .endm + .macro invoke_syscall, table, nr, tmp, ret, reload=0 +#ifdef CONFIG_CPU_SPECTRE + mov \tmp, \nr + cmp \tmp, #NR_syscalls @ check upper syscall limit + movcs \tmp, #0 + csdb + badr lr, \ret @ return address + .if \reload + add r1, sp, #S_R0 + S_OFF @ pointer to regs + ldmccia r1, {r0 - r6} @ reload r0-r6 + stmccia sp, {r4, r5} @ update stack arguments + .endif + ldrcc pc, [\table, \tmp, lsl #2] @ call sys_* routine +#else + cmp \nr, #NR_syscalls @ check upper syscall limit + badr lr, \ret @ return address + .if \reload + add r1, sp, #S_R0 + S_OFF @ pointer to regs + ldmccia r1, {r0 - r6} @ reload r0-r6 + stmccia sp, {r4, r5} @ update stack arguments + .endif + ldrcc pc, [\table, \nr, lsl #2] @ call sys_* routine +#endif + .endm + /* * These are the registers used in the syscall handler, and allow us to * have in theory up to 7 arguments to a function - r0 to r6.
arch/arm/kernel/head-common.S +3 -3
@@ -122,6 +122,9 @@ __mmap_switched_data: .long init_thread_union + THREAD_START_SP @ sp .size __mmap_switched_data, . - __mmap_switched_data + __FINIT + .text + /* * This provides a C-API version of __lookup_processor_type */
@@ -133,9 +136,6 @@ ENTRY(lookup_processor_type) ldmfd sp!, {r4 - r6, r9, pc} ENDPROC(lookup_processor_type) - __FINIT - .text - /* * Read processor ID register (CP#15, CR0), and look up in the linker-built * supported processor list. Note that we can't use the absolute addresses
arch/arm/kernel/psci-call.S deleted +0 -31
@@ -1,31 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * Copyright (C) 2015 ARM Limited - * - * Author: Mark Rutland <[email protected]> - */ - -#include <linux/linkage.h> - -#include <asm/opcodes-sec.h> -#include <asm/opcodes-virt.h> - -/* int __invoke_psci_fn_hvc(u32 function_id, u32 arg0, u32 arg1, u32 arg2) */ -ENTRY(__invoke_psci_fn_hvc) - __HVC(0) - bx lr -ENDPROC(__invoke_psci_fn_hvc) - -/* int __invoke_psci_fn_smc(u32 function_id, u32 arg0, u32 arg1, u32 arg2) */ -ENTRY(__invoke_psci_fn_smc) - __SMC(0) - bx lr -ENDPROC(__invoke_psci_fn_smc)
arch/arm/kernel/setup.c +25 -15
@@ -113,6 +113,11 @@ EXPORT_SYMBOL(elf_hwcap2);#ifdef MULTI_CPU struct processor processor__read_mostly ; +#if defined(CONFIG_BIG_LITTLE ) && defined(CONFIG_HARDEN_BRANCH_PREDICTOR ) +struct processor *cpu_vtable[NR_CPUS ] = { + [0 ] = &processor, +}; +#endif #endif #ifdef MULTI_TLB struct cpu_tlb_fns cpu_tlb__read_mostly ;
@@ -599,28 +604,33 @@ static void __init smp_build_mpidr_hash(void) }#endif -static void __init setup_processor (void ) +/* +* locate processor in the list of supported processor types. The linker +* builds this table for us from the entries in arch/arm/mm/proc-*.S +*/ +struct proc_info_list *lookup_processor (u32 midr) { -struct proc_info_list *list; +struct proc_info_list *list =lookup_processor_type (midr); -/* -* locate processor in the list of supported processor -* types. The linker builds this table for us from the -* entries in arch/arm/mm/proc-*.S -*/ - list =lookup_processor_type (read_cpuid_id ());if (!list) { -pr_err ("CPU configuration botched (ID %08x), unable to continue.\n" , -read_cpuid_id ()); -while (1 ); +pr_err ("CPU%u: configuration botched (ID %08x), CPU halted\n" , +smp_processor_id (), midr); +while (1 ) +/* can't use cpu_relax() here as it may require MMU setup */ ; } +return list; +} + +static void __init setup_processor (void ) +{ +unsigned int midr =read_cpuid_id (); +struct proc_info_list *list =lookup_processor (midr); + cpu_name = list->cpu_name; __cpu_architecture =__get_cpu_architecture (); -#ifdef MULTI_CPU - processor = *list->proc; -#endif +init_proc_vtable (list->proc);#ifdef MULTI_TLB cpu_tlb = *list->tlb;#endif
@@ -632,7 +642,7 @@ static void __init setup_processor(void)#endif pr_info ("CPU: %s [%08x] revision %d (ARMv%s), cr=%08lx\n" , - cpu_name,read_cpuid_id (),read_cpuid_id () &15 , + list->cpu_name, midr, midr &15 , proc_arch[cpu_architecture ()],get_cr ()); snprintf(init_utsname()->machine, __NEW_UTS_LEN + 1, "%s%c",
arch/arm/kernel/signal.c +67 -58
182 lines not on this page · raw message
arch/arm/kernel/smccc-call.S new file +62 -0
62 lines not on this page · raw message
arch/arm/kernel/smp.c +36 -0
@@ -27,8 +27,10 @@#include <linux/completion.h> #include <linux/cpufreq.h> #include <linux/irq_work.h> +#include <linux/slab.h> #include <linux/atomic.h> +#include <asm/bugs.h> #include <asm/smp.h> #include <asm/cacheflush.h> #include <asm/cpu.h>
@@ -39,6 +41,7 @@#include <asm/mmu_context.h> #include <asm/pgtable.h> #include <asm/pgalloc.h> +#include <asm/procinfo.h> #include <asm/processor.h> #include <asm/sections.h> #include <asm/tlbflush.h>
@@ -95,6 +98,30 @@ static unsigned long get_arch_pgd(pgd_t *pgd)#endif } +#if defined(CONFIG_BIG_LITTLE ) && defined(CONFIG_HARDEN_BRANCH_PREDICTOR ) +static int secondary_biglittle_prepare (unsigned int cpu) +{ +if (!cpu_vtable[cpu]) + cpu_vtable[cpu] =kzalloc (sizeof (*cpu_vtable[cpu]),GFP_KERNEL ); + +return cpu_vtable[cpu] ?0 : -ENOMEM ; +} + +static void secondary_biglittle_init (void ) +{ +init_proc_vtable (lookup_processor (read_cpuid_id ())->proc); +} +#else +static int secondary_biglittle_prepare (unsigned int cpu) +{ +return 0 ; +} + +static void secondary_biglittle_init (void ) +{ +} +#endif +int __cpu_up (unsigned int cpu,struct task_struct *idle) {int ret;
@@ -102,6 +129,10 @@ int __cpu_up(unsigned int cpu, struct task_struct *idle)if (!smp_ops.smp_boot_secondary)return -ENOSYS ; + ret =secondary_biglittle_prepare (cpu); +if (ret) +return ret; +/* * We need to tell the secondary core where to find * its stack and the page tables.
@@ -353,6 +384,8 @@ asmlinkage void secondary_start_kernel(void)struct mm_struct *mm = &init_mm;unsigned int cpu; +secondary_biglittle_init (); +/* * The identity mapping is uncached (strongly ordered), so * switch away from it before attempting any exclusive accesses.
@@ -396,6 +429,9 @@ asmlinkage void secondary_start_kernel(void)* before we continue - which happens after __cpu_up returns. */ set_cpu_online (cpu, true); + +check_other_bugs (); +complete (&cpu_running);local_irq_enable ();
arch/arm/kernel/suspend.c +2 -0
@@ -1,6 +1,7 @@#include <linux/init.h> #include <linux/slab.h> +#include <asm/bugs.h> #include <asm/cacheflush.h> #include <asm/idmap.h> #include <asm/pgalloc.h>
@@ -34,6 +35,7 @@ int cpu_suspend(unsigned long arg, int (*fn)(unsigned long))cpu_switch_mm (mm->pgd, mm);local_flush_bp_all ();local_flush_tlb_all (); +check_other_bugs (); }return ret;
arch/arm/kernel/sys_oabi-compat.c +11 -5
@@ -276,6 +276,7 @@ asmlinkage long sys_oabi_epoll_wait(int epfd, int maxevents, int timeout) {struct epoll_event *kbuf; +struct oabi_epoll_event e;mm_segment_t fs;long ret, err, i;
@@ -294,8 +295,11 @@ asmlinkage long sys_oabi_epoll_wait(int epfd,set_fs (fs); err =0 ;for (i =0 ; i < ret; i++) { -__put_user_error (kbuf[i].events, &events->events, err); -__put_user_error (kbuf[i].data, &events->data, err); + e.events = kbuf[i].events; + e.data = kbuf[i].data; + err =__copy_to_user (events, &e,sizeof (e)); +if (err) +break ; events++; }kfree (kbuf);
@@ -328,9 +332,11 @@ asmlinkage long sys_oabi_semtimedop(int semid,return -ENOMEM ; err =0 ;for (i =0 ; i < nsops; i++) { -__get_user_error (sops[i].sem_num, &tsops->sem_num, err); -__get_user_error (sops[i].sem_op, &tsops->sem_op, err); -__get_user_error (sops[i].sem_flg, &tsops->sem_flg, err); +struct oabi_sembuf osb; + err |=__copy_from_user (&osb, tsops,sizeof (osb)); + sops[i].sem_num = osb.sem_num; + sops[i].sem_op = osb.sem_op; + sops[i].sem_flg = osb.sem_flg; tsops++; }if (timeout) {
arch/arm/lib/copy_from_user.S +5 -0
@@ -90,6 +90,11 @@ .text ENTRY(arm_copy_from_user) +#ifdef CONFIG_CPU_SPECTRE + get_thread_info r3 + ldr r3, [r3, #TI_ADDR_LIMIT] + uaccess_mask_range_ptr r1, r2, r3, ip +#endif #include "copy_template.S"
arch/arm/mm/Kconfig +23 -0
@@ -396,6 +396,7 @@ config CPU_V7 select CPU_CP15_MPU if !MMU select CPU_HAS_ASID if MMU select CPU_PABRT_V7 + select CPU_SPECTRE if MMU select CPU_TLB_V7 if MMU # ARMv7M
@@ -793,6 +794,28 @@ config CPU_BPREDICT_DISABLE help Say Y here to disable branch prediction. If unsure, say N. +config CPU_SPECTRE + bool + +config HARDEN_BRANCH_PREDICTOR + bool "Harden the branch predictor against aliasing attacks" if EXPERT + depends on CPU_SPECTRE + default y + help + Speculation attacks against some high-performance processors rely + on being able to manipulate the branch predictor for a victim + context by executing aliasing branches in the attacker context. + Such attacks can be partially mitigated against by clearing + internal branch predictor state and limiting the prediction + logic in some situations. + + This config option will take CPU-specific actions to harden + the branch predictor against aliasing attacks and may rely on + specific instruction sequences or control bits being set by + the system firmware. + + If unsure, say Y. + config TLS_REG_EMUL bool select NEED_KUSER_HELPERS
arch/arm/mm/Makefile +1 -1
@@ -92,7 +92,7 @@ obj-$(CONFIG_CPU_MOHAWK) += proc-mohawk.o obj-$(CONFIG_CPU_FEROCEON) += proc-feroceon.o obj-$(CONFIG_CPU_V6) += proc-v6.o obj-$(CONFIG_CPU_V6K) += proc-v6.o -obj-$(CONFIG_CPU_V7) += proc-v7.o +obj-$(CONFIG_CPU_V7) += proc-v7.o proc-v7-bugs.o obj-$(CONFIG_CPU_V7M) += proc-v7m.o AFLAGS_proc-v6.o :=-Wa,-march=armv6
arch/arm/mm/alignment.c +36 -8
75 lines not on this page · raw message
arch/arm/mm/fault.c +3 -0
@@ -163,6 +163,9 @@ __do_user_fault(struct task_struct *tsk, unsigned long addr, {struct siginfo si; +if (addr >TASK_SIZE ) +harden_branch_predictor (); +#ifdef CONFIG_DEBUG_USER if (((user_debug &UDBG_SEGV ) && (sig ==SIGSEGV )) || ((user_debug &UDBG_BUS ) && (sig ==SIGBUS ))) {
arch/arm/mm/proc-macros.S +12 -1
@@ -258,13 +258,21 @@ mcr p15, 0, ip, c7, c10, 4 @ data write barrier .endm -.macro define_processor_functions name:req, dabort:req, pabort:req, nommu=0, suspend=0 +.macro define_processor_functions name:req, dabort:req, pabort:req, nommu=0, suspend=0, bugs=0 +/* + * If we are building for big.Little with branch predictor hardening, + * we need the processor function tables to remain available after boot. + */ +#if defined(CONFIG_BIG_LITTLE) && defined(CONFIG_HARDEN_BRANCH_PREDICTOR) + .section ".rodata" +#endif .type \name\()_processor_functions, #object .align 2 ENTRY(\name\()_processor_functions) .word \dabort .word \pabort .word cpu_\name\()_proc_init + .word \bugs .word cpu_\name\()_proc_fin .word cpu_\name\()_reset .word cpu_\name\()_do_idle
@@ -293,6 +301,9 @@ ENTRY(\name\()_processor_functions) .endif .size \name\()_processor_functions, . - \name\()_processor_functions +#if defined(CONFIG_BIG_LITTLE) && defined(CONFIG_HARDEN_BRANCH_PREDICTOR) + .previous +#endif .endm .macro define_cache_functions name:req
arch/arm/mm/proc-v7-2level.S +0 -6
@@ -41,11 +41,6 @@ * even on Cortex-A8 revisions not affected by 430973. * If IBE is not set, the flush BTAC/BTB won't do anything. */ -ENTRY(cpu_ca8_switch_mm) -#ifdef CONFIG_MMU - mov r2, #0 - mcr p15, 0, r2, c7, c5, 6 @ flush BTAC/BTB -#endif ENTRY(cpu_v7_switch_mm) #ifdef CONFIG_MMU mmid r1, r1 @ get mm->context.id
@@ -66,7 +61,6 @@ ENTRY(cpu_v7_switch_mm) #endif bx lr ENDPROC(cpu_v7_switch_mm) -ENDPROC(cpu_ca8_switch_mm) /* * cpu_v7_set_pte_ext(ptep, pte)
arch/arm/mm/proc-v7-bugs.c new file +161 -0
161 lines not on this page · raw message
arch/arm/mm/proc-v7.S +122 -32
207 lines not on this page · raw message
arch/arm/vfp/vfpmodule.c +15 -22
@@ -558,12 +558,11 @@ void vfp_flush_hwstate(struct thread_info *thread)* Save the current VFP state into the provided structures and prepare * for entry into a new function (signal handler). */ -int vfp_preserve_user_clear_hwstate (struct user_vfp __user *ufp, -struct user_vfp_exc __user *ufp_exc) +int vfp_preserve_user_clear_hwstate (struct user_vfp *ufp, +struct user_vfp_exc *ufp_exc) {struct thread_info *thread =current_thread_info ();struct vfp_hard_struct *hwstate = &thread->vfpstate.hard; -int err =0 ;/* Ensure that the saved hwstate is up-to-date. */ vfp_sync_hwstate (thread);
@@ -572,22 +571,19 @@ int vfp_preserve_user_clear_hwstate(struct user_vfp __user *ufp,* Copy the floating point registers. There can be unused * registers see asm/hwcap.h for details. */ - err |=__copy_to_user (&ufp->fpregs, &hwstate->fpregs, -sizeof (hwstate->fpregs)); +memcpy (&ufp->fpregs, &hwstate->fpregs,sizeof (hwstate->fpregs)); +/* * Copy the status and control register. */ -__put_user_error (hwstate->fpscr, &ufp->fpscr, err); + ufp->fpscr = hwstate->fpscr;/* * Copy the exception registers. */ -__put_user_error (hwstate->fpexc, &ufp_exc->fpexc, err); -__put_user_error (hwstate->fpinst, &ufp_exc->fpinst, err); -__put_user_error (hwstate->fpinst2, &ufp_exc->fpinst2, err); - -if (err) -return -EFAULT ; + ufp_exc->fpexc = hwstate->fpexc; + ufp_exc->fpinst = hwstate->fpinst; + ufp_exc->fpinst2 = hwstate->fpinst2;/* Ensure that VFP is disabled. */ vfp_flush_hwstate (thread);
@@ -601,13 +597,11 @@ int vfp_preserve_user_clear_hwstate(struct user_vfp __user *ufp, }/* Sanitise and restore the current VFP state from the provided structures. */ -int vfp_restore_user_hwstate (struct user_vfp __user *ufp, -struct user_vfp_exc __user *ufp_exc) +int vfp_restore_user_hwstate (struct user_vfp *ufp,struct user_vfp_exc *ufp_exc) {struct thread_info *thread =current_thread_info ();struct vfp_hard_struct *hwstate = &thread->vfpstate.hard;unsigned long fpexc; -int err =0 ;/* Disable VFP to avoid corrupting the new thread state. */ vfp_flush_hwstate (thread);
@@ -616,17 +610,16 @@ int vfp_restore_user_hwstate(struct user_vfp __user *ufp,* Copy the floating point registers. There can be unused * registers see asm/hwcap.h for details. */ - err |=__copy_from_user (&hwstate->fpregs, &ufp->fpregs, -sizeof (hwstate->fpregs)); +memcpy (&hwstate->fpregs, &ufp->fpregs,sizeof (hwstate->fpregs));/* * Copy the status and control register. */ -__get_user_error (hwstate->fpscr, &ufp->fpscr, err); + hwstate->fpscr = ufp->fpscr;/* * Sanitise and restore the exception registers. */ -__get_user_error (fpexc, &ufp_exc->fpexc, err); + fpexc = ufp_exc->fpexc;/* Ensure the VFP is enabled. */ fpexc |=FPEXC_EN ;
@@ -635,10 +628,10 @@ int vfp_restore_user_hwstate(struct user_vfp __user *ufp, fpexc &= ~(FPEXC_EX |FPEXC_FP2V ); hwstate->fpexc = fpexc; -__get_user_error (hwstate->fpinst, &ufp_exc->fpinst, err); -__get_user_error (hwstate->fpinst2, &ufp_exc->fpinst2, err); + hwstate->fpinst = ufp_exc->fpinst; + hwstate->fpinst2 = ufp_exc->fpinst2; -return err ? -EFAULT :0 ; +return 0 ; }/*
arch/arm64/Kconfig +1 -0
@@ -92,6 +92,7 @@ config ARM64 select SPARSE_IRQ select SYSCTL_EXCEPTION_TRACE select HAVE_CONTEXT_TRACKING + select HAVE_ARM_SMCCC help ARM 64-bit (AArch64) Linux support.
arch/arm64/kernel/Makefile +2 -2
@@ -14,10 +14,10 @@ CFLAGS_REMOVE_return_address.o = -pg arm64-obj-y := 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 psci-call.o cpu_ops.o insn.o \ + hyp-stub.o psci.o cpu_ops.o insn.o \ return_address.o cpuinfo.o cpu_errata.o \ cpufeature.o alternative.o cacheinfo.o \ - smp.o smp_spin_table.o topology.o + smp.o smp_spin_table.o topology.o smccc-call.o extra-$(CONFIG_EFI) := efi-entry.o
arch/arm64/kernel/arm64ksyms.c +5 -0
@@ -26,6 +26,7 @@#include <linux/syscalls.h> #include <linux/uaccess.h> #include <linux/io.h> +#include <linux/arm-smccc.h> #include <asm/checksum.h>
@@ -68,3 +69,7 @@ EXPORT_SYMBOL(test_and_change_bit);#ifdef CONFIG_FUNCTION_TRACER EXPORT_SYMBOL (_mcount);#endif + +/* arm-smccc */ +EXPORT_SYMBOL (arm_smccc_smc); +EXPORT_SYMBOL (arm_smccc_hvc);
arch/arm64/kernel/asm-offsets.c +3 -0
@@ -28,6 +28,7 @@#include <asm/suspend.h> #include <asm/vdso_datapage.h> #include <linux/kbuild.h> +#include <linux/arm-smccc.h> int main (void ) {
@@ -162,5 +163,7 @@ int main(void)DEFINE (SLEEP_SAVE_SP_PHYS , offsetof(struct sleep_save_sp , save_ptr_stash_phys));DEFINE (SLEEP_SAVE_SP_VIRT , offsetof(struct sleep_save_sp , save_ptr_stash));#endif +DEFINE (ARM_SMCCC_RES_X0_OFFS , offsetof(struct arm_smccc_res , a0)); +DEFINE (ARM_SMCCC_RES_X2_OFFS , offsetof(struct arm_smccc_res , a2));return 0 ; }
arch/arm64/kernel/psci-call.S deleted +0 -28
@@ -1,28 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * Copyright (C) 2015 ARM Limited - * - * Author: Will Deacon <[email protected]> - */ - -#include <linux/linkage.h> - -/* int __invoke_psci_fn_hvc(u64 function_id, u64 arg0, u64 arg1, u64 arg2) */ -ENTRY(__invoke_psci_fn_hvc) - hvc #0 - ret -ENDPROC(__invoke_psci_fn_hvc) - -/* int __invoke_psci_fn_smc(u64 function_id, u64 arg0, u64 arg1, u64 arg2) */ -ENTRY(__invoke_psci_fn_smc) - smc #0 - ret -ENDPROC(__invoke_psci_fn_smc)
arch/arm64/kernel/smccc-call.S new file +43 -0
43 lines not on this page · raw message
arch/mips/bcm63xx/prom.c +1 -1
@@ -84,7 +84,7 @@ void __init prom_init(void)* Here we will start up CPU1 in the background and ask it to * reconfigure itself then go back to sleep. */ -memcpy ((void *)0xa0000200 , &bmips_smp_movevec,0x20 ); +memcpy ((void *)0xa0000200 , bmips_smp_movevec,0x20 );__sync ();set_c0_cause (C_SW0 );cpumask_set_cpu (1 , &bmips_booted_mask);
arch/mips/include/asm/bmips.h +5 -5
@@ -75,11 +75,11 @@ static inline int register_bmips_smp_ops(void)#endif } -extern char bmips_reset_nmi_vec; -extern char bmips_reset_nmi_vec_end; -extern char bmips_smp_movevec; -extern char bmips_smp_int_vec; -extern char bmips_smp_int_vec_end; +extern char bmips_reset_nmi_vec[]; +extern char bmips_reset_nmi_vec_end[]; +extern char bmips_smp_movevec[]; +extern char bmips_smp_int_vec[]; +extern char bmips_smp_int_vec_end[];extern int bmips_smp_enabled;extern int bmips_cpu_offset;
arch/mips/kernel/smp-bmips.c +4 -4
@@ -451,10 +451,10 @@ static void bmips_wr_vec(unsigned long dst, char *start, char *end)static inline void bmips_nmi_handler_setup (void ) { -bmips_wr_vec (BMIPS_NMI_RESET_VEC , &bmips_reset_nmi_vec, - &bmips_reset_nmi_vec_end); -bmips_wr_vec (BMIPS_WARM_RESTART_VEC , &bmips_smp_int_vec, - &bmips_smp_int_vec_end); +bmips_wr_vec (BMIPS_NMI_RESET_VEC , bmips_reset_nmi_vec, + bmips_reset_nmi_vec_end); +bmips_wr_vec (BMIPS_WARM_RESTART_VEC , bmips_smp_int_vec, + bmips_smp_int_vec_end); }struct reset_vec_info {
drivers/dma/qcom_bam_dma.c +14 -0
@@ -671,7 +671,21 @@ static int bam_dma_terminate_all(struct dma_chan *chan)/* remove all transactions, including active transaction */ spin_lock_irqsave (&bchan->vc.lock, flag); +/* +* If we have transactions queued, then some might be committed to the +* hardware in the desc fifo. The only way to reset the desc fifo is +* to do a hardware reset (either by pipe or the entire block). +* bam_chan_init_hw() will trigger a pipe reset, and also reinit the +* pipe. If the pipe is left disabled (default state after pipe reset) +* and is accessed by a connected hardware engine, a fatal error in +* the BAM will occur. There is a small window where this could happen +* with bam_chan_init_hw(), but it is assumed that the caller has +* stopped activity on any attached hardware engine. Make sure to do +* this first so that the BAM hardware doesn't cause memory corruption +* by accessing freed resources. +*/ if (bchan->curr_txd) { +bam_chan_init_hw (bchan, bchan->curr_txd->dir);list_add (&bchan->curr_txd->vd.node, &bchan->vc.desc_issued); bchan->curr_txd =NULL ; }
drivers/firmware/Kconfig +3 -0
@@ -174,6 +174,9 @@ config QCOM_SCM_64 def_bool y depends on QCOM_SCM && ARM64 +config HAVE_ARM_SMCCC + bool + source "drivers/firmware/broadcom/Kconfig" source "drivers/firmware/google/Kconfig" source "drivers/firmware/efi/Kconfig"
drivers/firmware/psci.c +71 -7
131 lines not on this page · raw message
drivers/net/ethernet/hisilicon/hip04_eth.c +9 -6
@@ -174,6 +174,7 @@ struct hip04_priv {dma_addr_t rx_phys[RX_DESC_NUM ];unsigned int rx_head;unsigned int rx_buf_size; +unsigned int rx_cnt_remaining;struct device_node *phy_node;struct phy_device *phy;
@@ -487,7 +488,6 @@ static int hip04_rx_poll(struct napi_struct *napi, int budget) struct hip04_priv *priv = container_of(napi, struct hip04_priv, napi);struct net_device *ndev = priv->ndev;struct net_device_stats *stats = &ndev->stats; -unsigned int cnt =hip04_recv_cnt (priv);struct rx_desc *desc;struct sk_buff *skb;unsigned char *buf;
@@ -500,8 +500,8 @@ static int hip04_rx_poll(struct napi_struct *napi, int budget)/* clean up tx descriptors */ tx_remaining =hip04_tx_reclaim (ndev, false); - -while (cnt && !last) { + priv->rx_cnt_remaining +=hip04_recv_cnt (priv); +while (priv->rx_cnt_remaining && !last) { buf = priv->rx_buf[priv->rx_head]; skb =build_skb (buf, priv->rx_buf_size);if (unlikely (!skb))
@@ -544,11 +544,13 @@ static int hip04_rx_poll(struct napi_struct *napi, int budget)hip04_set_recv_desc (priv, phys); priv->rx_head =RX_NEXT (priv->rx_head); -if (rx >= budget) +if (rx >= budget) { + --priv->rx_cnt_remaining; goto done; + } -if (--cnt ==0 ) - cnt =hip04_recv_cnt (priv); +if (--priv->rx_cnt_remaining ==0 ) + priv->rx_cnt_remaining +=hip04_recv_cnt (priv); }if (!(priv->reg_inten &RCV_INT )) {
@@ -633,6 +635,7 @@ static int hip04_mac_open(struct net_device *ndev)int i; priv->rx_head =0 ; + priv->rx_cnt_remaining =0 ; priv->tx_head =0 ; priv->tx_tail =0 ;hip04_reset_ppe (priv);
drivers/net/ethernet/mellanox/mlx4/resource_tracker.c +26 -16
61 lines not on this page · raw message
drivers/net/vxlan.c +4 -1
@@ -2006,8 +2006,11 @@ static void vxlan_xmit_one(struct sk_buff *skb, struct net_device *dev, ttl = info->key.ttl; tos = info->key.tos; -if (info->options_len) +if (info->options_len) { +if (info->options_len <sizeof (*md)) + goto drop; md =ip_tunnel_info_opts (info); + } }else { md->gbp = skb->mark; }
drivers/of/unittest.c +1 -0
@@ -924,6 +924,7 @@ static int __init unittest_data_add(void)of_fdt_unflatten_tree (unittest_data, &unittest_data_node);if (!unittest_data_node) {pr_warn ("%s: No tree to attach; not running tests\n" , __func__); +kfree (unittest_data);return -ENODATA ; }of_node_set_flag (unittest_data_node,OF_DETACHED );
drivers/regulator/pfuze100-regulator.c +7 -1
@@ -609,7 +609,13 @@ static int pfuze100_regulator_probe(struct i2c_client *client,/* SW2~SW4 high bit check and modify the voltage value table */ if (i >= sw_check_start && i <= sw_check_end) { -regmap_read (pfuze_chip->regmap, desc->vsel_reg, &val); + ret =regmap_read (pfuze_chip->regmap, + desc->vsel_reg, &val); +if (ret) { +dev_err (&client->dev,"Fails to read from the register.\n" ); +return ret; + } +if (val & sw_hi) {if (pfuze_chip->chip_id ==PFUZE3000 ) { desc->volt_table = pfuze3000_sw2hi;
drivers/regulator/ti-abb-regulator.c +8 -18
@@ -173,19 +173,14 @@ static int ti_abb_wait_txdone(struct device *dev, struct ti_abb *abb)while (timeout++ <= abb->settling_time) { status =ti_abb_check_txdone (abb);if (status) -break ; +return 0 ;udelay (1 ); } -if (timeout > abb->settling_time) { -dev_warn_ratelimited (dev, -"%s:TRANXDONE timeout(%duS) int=0x%08x\n" , - __func__, timeout,readl (abb->int_base)); -return -ETIMEDOUT ; - } - -return 0 ; +dev_warn_ratelimited (dev,"%s:TRANXDONE timeout(%duS) int=0x%08x\n" , + __func__, timeout,readl (abb->int_base)); +return -ETIMEDOUT ; }/**
@@ -205,19 +200,14 @@ static int ti_abb_clear_all_txdone(struct device *dev, const struct ti_abb *abb) status =ti_abb_check_txdone (abb);if (!status) -break ; +return 0 ;udelay (1 ); } -if (timeout > abb->settling_time) { -dev_warn_ratelimited (dev, -"%s:TRANXDONE timeout(%duS) int=0x%08x\n" , - __func__, timeout,readl (abb->int_base)); -return -ETIMEDOUT ; - } - -return 0 ; +dev_warn_ratelimited (dev,"%s:TRANXDONE timeout(%duS) int=0x%08x\n" , + __func__, timeout,readl (abb->int_base)); +return -ETIMEDOUT ; }/**
drivers/scsi/Kconfig +1 -1
@@ -1013,7 +1013,7 @@ config SCSI_SNI_53C710 config 53C700_LE_ON_BE bool - depends on SCSI_LASI700 + depends on SCSI_LASI700 || SCSI_SNI_53C710 default y config SCSI_STEX
drivers/scsi/sni_53c710.c +1 -3
@@ -78,10 +78,8 @@ static int snirm710_probe(struct platform_device *dev) base = res->start; hostdata =kzalloc (sizeof (*hostdata),GFP_KERNEL ); -if (!hostdata) { -dev_printk (KERN_ERR , dev,"Failed to allocate host data\n" ); +if (!hostdata)return -ENOMEM ; - } hostdata->dev = &dev->dev;dma_set_mask (&dev->dev,DMA_BIT_MASK (32 ));
drivers/target/target_core_device.c +0 -21
@@ -1056,27 +1056,6 @@ passthrough_parse_cdb(struct se_cmd *cmd, {unsigned char *cdb = cmd->t_task_cdb; -/* -* Clear a lun set in the cdb if the initiator talking to use spoke -* and old standards version, as we can't assume the underlying device -* won't choke up on it. -*/ -switch (cdb[0 ]) { -case READ_10 :/* SBC - RDProtect */ -case READ_12 :/* SBC - RDProtect */ -case READ_16 :/* SBC - RDProtect */ -case SEND_DIAGNOSTIC :/* SPC - SELF-TEST Code */ -case VERIFY :/* SBC - VRProtect */ -case VERIFY_16 :/* SBC - VRProtect */ -case WRITE_VERIFY :/* SBC - VRProtect */ -case WRITE_VERIFY_12 :/* SBC - VRProtect */ -case MAINTENANCE_IN :/* SPC - Parameter Data Format for SA RTPG */ -break ; -default : - cdb[1 ] &=0x1f ;/* clear logical unit number */ -break ; - } -/* * For REPORT LUNS we always need to emulate the response, for everything * else, pass it up.
fs/cifs/cifsglob.h +5 -0
@@ -1152,6 +1152,11 @@ void cifsFileInfo_put(struct cifsFileInfo *cifs_file);struct cifsInodeInfo {bool can_cache_brlcks;struct list_head llist;/* locks helb by this inode */ +/* +* NOTE: Some code paths call down_read(lock_sem) twice, so +* we must always use use cifs_down_write() instead of down_write() +* for this semaphore to avoid deadlocks. +*/ struct rw_semaphore lock_sem;/* protect the fields above */ /* BB add in lists for dirty pages i.e. write caching info for oplock */ struct list_head openFileList;
fs/cifs/cifsproto.h +1 -0
@@ -138,6 +138,7 @@ extern int cifs_unlock_range(struct cifsFileInfo *cfile, struct file_lock *flock, const unsigned int xid);extern int cifs_push_mandatory_locks (struct cifsFileInfo *cfile); +extern void cifs_down_write (struct rw_semaphore *sem); extern struct cifsFileInfo *cifs_new_fileinfo(struct cifs_fid *fid, struct file *file, struct tcon_link *tlink,
fs/cifs/file.c +15 -8
@@ -280,6 +280,13 @@ cifs_has_mand_locks(struct cifsInodeInfo *cinode)return has_locks; } +void +cifs_down_write (struct rw_semaphore *sem) +{ +while (!down_write_trylock (sem)) +msleep (10 ); +} +struct cifsFileInfo *cifs_new_fileinfo (struct cifs_fid *fid,struct file *file,struct tcon_link *tlink,__u32 oplock)
@@ -305,7 +312,7 @@ cifs_new_fileinfo(struct cifs_fid *fid, struct file *file,INIT_LIST_HEAD (&fdlocks->locks); fdlocks->cfile = cfile; cfile->llist = fdlocks; -down_write (&cinode->lock_sem); +cifs_down_write (&cinode->lock_sem);list_add (&fdlocks->llist, &cinode->llist);up_write (&cinode->lock_sem);
@@ -438,7 +445,7 @@ void cifsFileInfo_put(struct cifsFileInfo *cifs_file)* Delete any outstanding lock records. We'll lose them when the file * is closed anyway. */ -down_write (&cifsi->lock_sem); +cifs_down_write (&cifsi->lock_sem);list_for_each_entry_safe (li, tmp, &cifs_file->llist->locks, llist) {list_del (&li->llist);cifs_del_lock_waiters (li);
@@ -947,7 +954,7 @@ static void cifs_lock_add(struct cifsFileInfo *cfile, struct cifsLockInfo *lock) { struct cifsInodeInfo *cinode = CIFS_I(d_inode(cfile->dentry)); -down_write (&cinode->lock_sem); +cifs_down_write (&cinode->lock_sem);list_add_tail (&lock->llist, &cfile->llist->locks);up_write (&cinode->lock_sem); }
@@ -969,7 +976,7 @@ cifs_lock_add_if(struct cifsFileInfo *cfile, struct cifsLockInfo *lock, try_again: exist = false; -down_write (&cinode->lock_sem); +cifs_down_write (&cinode->lock_sem); exist =cifs_find_lock_conflict (cfile, lock->offset, lock->length, lock->type, &conf_lock,CIFS_LOCK_OP );
@@ -991,7 +998,7 @@ try_again: (lock->blist.next == &lock->blist));if (!rc) goto try_again; -down_write (&cinode->lock_sem); +cifs_down_write (&cinode->lock_sem);list_del_init (&lock->blist); }
@@ -1044,7 +1051,7 @@ cifs_posix_lock_set(struct file *file, struct file_lock *flock)return rc; try_again: -down_write (&cinode->lock_sem); +cifs_down_write (&cinode->lock_sem);if (!cinode->can_cache_brlcks) {up_write (&cinode->lock_sem);return rc;
@@ -1242,7 +1249,7 @@ cifs_push_locks(struct cifsFileInfo *cfile)int rc =0 ;/* we are going to update can_cache_brlcks here - need a write access */ -down_write (&cinode->lock_sem); +cifs_down_write (&cinode->lock_sem);if (!cinode->can_cache_brlcks) {up_write (&cinode->lock_sem);return rc;
@@ -1430,7 +1437,7 @@ cifs_unlock_range(struct cifsFileInfo *cfile, struct file_lock *flock,if (!buf)return -ENOMEM ; -down_write (&cinode->lock_sem); +cifs_down_write (&cinode->lock_sem);for (i =0 ; i <2 ; i++) { cur = buf; num =0 ;
fs/cifs/smb2file.c +1 -1
@@ -138,7 +138,7 @@ smb2_unlock_range(struct cifsFileInfo *cfile, struct file_lock *flock, cur = buf; -down_write (&cinode->lock_sem); +cifs_down_write (&cinode->lock_sem); list_for_each_entry_safe(li, tmp, &cfile->llist->locks, llist) { if (flock->fl_start > li->offset || (flock->fl_start + length) <
fs/dcache.c +1 -1
@@ -1903,7 +1903,6 @@ void d_instantiate_new(struct dentry *entry, struct inode *inode)BUG_ON (!hlist_unhashed (&entry->d_u.d_alias));BUG_ON (!inode);lockdep_annotate_inode_mutex_key (inode); -security_d_instantiate (entry, inode);spin_lock (&inode->i_lock);__d_instantiate (entry, inode);WARN_ON (!(inode->i_state &I_NEW ));
@@ -1911,6 +1910,7 @@ void d_instantiate_new(struct dentry *entry, struct inode *inode)smp_mb ();wake_up_bit (&inode->i_state, __I_NEW);spin_unlock (&inode->i_lock); +security_d_instantiate (entry, inode); }EXPORT_SYMBOL (d_instantiate_new);
include/linux/arm-smccc.h new file +283 -0
283 lines not on this page · raw message
include/linux/gfp.h +23 -0
@@ -274,6 +274,29 @@ static inline bool gfpflags_allow_blocking(const gfp_t gfp_flags)return (bool __force )(gfp_flags & __GFP_DIRECT_RECLAIM); } +/** +* gfpflags_normal_context - is gfp_flags a normal sleepable context? +* @gfp_flags: gfp_flags to test +* +* Test whether @gfp_flags indicates that the allocation is from the +* %current context and allowed to sleep. +* +* An allocation being allowed to block doesn't mean it owns the %current +* context. When direct reclaim path tries to allocate memory, the +* allocation context is nested inside whatever %current was doing at the +* time of the original allocation. The nested allocation may be allowed +* to block but modifying anything %current owns can corrupt the outer +* context's expectations. +* +* %true result from this function indicates that the allocation context +* can sleep and use anything that's associated with %current. +*/ +static inline bool gfpflags_normal_context (const gfp_t gfp_flags) +{ +return (gfp_flags & (__GFP_DIRECT_RECLAIM | __GFP_MEMALLOC)) == + __GFP_DIRECT_RECLAIM; +} +#ifdef CONFIG_HIGHMEM #define OPT_ZONE_HIGHMEM ZONE_HIGHMEM#else
include/linux/psci.h +13 -0
@@ -24,6 +24,17 @@ bool psci_tos_resident_on(int cpu);bool psci_power_state_loses_context (u32 state);bool psci_power_state_is_valid (u32 state); +enum psci_conduit { +PSCI_CONDUIT_NONE , +PSCI_CONDUIT_SMC , +PSCI_CONDUIT_HVC , +}; + +enum smccc_version { +SMCCC_VERSION_1_0 , +SMCCC_VERSION_1_1 , +}; +struct psci_operations {int (*cpu_suspend)(u32 state,unsigned long entry_point);int (*cpu_off)(u32 state);
@@ -32,6 +43,8 @@ struct psci_operations {int (*affinity_info)(unsigned long target_affinity,unsigned long lowest_affinity_level);int (*migrate_info_type)(void ); +enum psci_conduit conduit; +enum smccc_version smccc_version; };extern struct psci_operations psci_ops;
include/linux/skbuff.h +2 -1
@@ -1073,7 +1073,8 @@ static inline __u32 skb_get_hash_flowi4(struct sk_buff *skb, const struct flowi4return skb->hash; } -__u32 skb_get_hash_perturb (const struct sk_buff *skb,u32 perturb); +__u32 skb_get_hash_perturb (const struct sk_buff *skb, +const siphash_key_t *perturb);static inline __u32 skb_get_hash_raw (const struct sk_buff *skb) {
include/net/flow_dissector.h +2 -1
@@ -3,6 +3,7 @@#include <linux/types.h> #include <linux/in6.h> +#include <linux/siphash.h> #include <uapi/linux/if_ether.h> /**
@@ -146,7 +147,7 @@ struct flow_dissector {struct flow_keys {struct flow_dissector_key_control control;#define FLOW_KEYS_HASH_START_FIELD basic -struct flow_dissector_key_basic basic; +struct flow_dissector_key_basic basic__aligned(SIPHASH_ALIGNMENT) ;struct flow_dissector_key_tags tags;struct flow_dissector_key_keyid keyid;struct flow_dissector_key_ports ports;
include/net/sock.h +8 -3
@@ -2077,12 +2077,17 @@ struct sk_buff *sk_stream_alloc_skb(struct sock *sk, int size, gfp_t gfp,* sk_page_frag - return an appropriate page_frag * @sk: socket * -* If socket allocation mode allows current thread to sleep, it means its -* safe to use the per task page_frag instead of the per socket one. +* Use the per task page_frag instead of the per socket one for +* optimization when we know that we're in the normal context and owns +* everything that's associated with %current. +* +* gfpflags_allow_blocking() isn't enough here as direct reclaim may nest +* inside other socket operations and end up recursing into sk_page_frag() +* while it's already in use. */ static inline struct page_frag *sk_page_frag (struct sock *sk) { -if (gfpflags_allow_blocking (sk->sk_allocation)) +if (gfpflags_normal_context (sk->sk_allocation))return ¤t->task_frag;return &sk->sk_frag;
kernel/time/alarmtimer.c +2 -2
@@ -573,7 +573,7 @@ static void alarm_timer_get(struct k_itimer *timr,static int alarm_timer_del (struct k_itimer *timr) {if (!rtcdev) -return -ENOTSUPP ; +return -EOPNOTSUPP ;if (alarm_try_to_cancel (&timr->it.alarm.alarmtimer) <0 )return TIMER_RETRY ;
@@ -597,7 +597,7 @@ static int alarm_timer_set(struct k_itimer *timr, int flags,ktime_t exp;if (!rtcdev) -return -ENOTSUPP ; +return -EOPNOTSUPP ;if (flags & ~TIMER_ABSTIME )return -EINVAL ;
net/core/datagram.c +1 -1
@@ -96,7 +96,7 @@ static int wait_for_more_packets(struct sock *sk, int *err, long *timeo_p,if (error) goto out_err; -if (sk->sk_receive_queue.prev != skb) +if (READ_ONCE (sk->sk_receive_queue.prev) != skb) goto out;/* Socket shut down? */
net/core/ethtool.c +3 -1
@@ -941,11 +941,13 @@ static int ethtool_reset(struct net_device *dev, char __user *useraddr)static int ethtool_get_wol (struct net_device *dev,char __user *useraddr) { -struct ethtool_wolinfo wol = { .cmd =ETHTOOL_GWOL }; +struct ethtool_wolinfo wol;if (!dev->ethtool_ops->get_wol)return -EOPNOTSUPP ; +memset (&wol,0 ,sizeof (struct ethtool_wolinfo )); + wol.cmd =ETHTOOL_GWOL ; dev->ethtool_ops->get_wol (dev, &wol);if (copy_to_user (useraddr, &wol,sizeof (wol)))
net/core/flow_dissector.c +20 -28
27 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Part of the diff is not shown here. View the raw message.