Linux 4.4.245
Greg Kroah-Hartman
maintainerI'm announcing the release of the 4.4.245 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
------------
Documentation/kernel-parameters.txt | 7 Makefile | 2 arch/powerpc/include/asm/book3s/64/kup-radix.h | 23 ++ arch/powerpc/include/asm/exception-64s.h | 15 + arch/powerpc/include/asm/feature-fixups.h | 19 ++ arch/powerpc/include/asm/futex.h | 4 arch/powerpc/include/asm/kup.h | 40 ++++ arch/powerpc/include/asm/security_features.h | 7 arch/powerpc/include/asm/setup.h | 4 arch/powerpc/include/asm/uaccess.h | 142 +++++++++++++--- arch/powerpc/kernel/exceptions-64s.S | 210 +++++++++++++++---------- arch/powerpc/kernel/head_8xx.S | 8 arch/powerpc/kernel/ppc_ksyms.c | 10 + arch/powerpc/kernel/setup_64.c | 138 ++++++++++++++++ arch/powerpc/kernel/vmlinux.lds.S | 14 + arch/powerpc/lib/checksum_wrappers_64.c | 4 arch/powerpc/lib/feature-fixups.c | 104 ++++++++++++ arch/powerpc/lib/string.S | 2 arch/powerpc/lib/string_64.S | 4 arch/powerpc/platforms/powernv/setup.c | 15 + arch/powerpc/platforms/pseries/setup.c | 8 arch/x86/kvm/emulate.c | 8 drivers/i2c/busses/i2c-imx.c | 25 +- drivers/input/keyboard/sunkbd.c | 41 +++- fs/xfs/xfs_icache.c | 58 ++++++ net/mac80211/sta_info.c | 18 ++ 26 files changed, 781 insertions(+), 149 deletions(-)
Andrew Donnellan (1):
powerpc: Fix __clear_user() with KUAP enabled
Christophe Leroy (3):
powerpc: Add a framework for user access tracking
powerpc: Implement user_access_begin and friends powerpc/8xx: Always fault when _PAGE_ACCESSED is not set
Daniel Axtens (2):
powerpc/64s: Define MASKABLE_RELON_EXCEPTION_PSERIES_OOL powerpc/64s: move some exception handlers out of line
Dave Chinner (2):
xfs: catch inode allocation state mismatch corruption
xfs: validate cached inodes are free when allocated
David Edmondson (1):
KVM: x86: clflushopt should be treated as a no-op by emulation
Dmitry Torokhov (1):
Input: sunkbd - avoid use-after-free in teardown paths
Greg Kroah-Hartman (1):
Linux 4.4.245
Johannes Berg (1):
mac80211: always wind down STA state
Krzysztof Kozlowski (1):
i2c: imx: Fix external abort on interrupt in exit paths
Nicholas Piggin (3):
powerpc/64s: flush L1D on kernel entry
powerpc/uaccess: Evaluate macro arguments once, before user access is allowed powerpc/64s: flush L1D after user accesses
Greg Kroah-Hartman
maintainerDocumentation/kernel-parameters.txt +7 -0
@@ -2196,6 +2196,8 @@ bytes respectively. Such letter suffixes can also be entirely omitted. spec_store_bypass_disable=off [X86] mds=off [X86] tsx_async_abort=off [X86] + no_entry_flush [PPC] + no_uaccess_flush [PPC] auto (default) Mitigate all CPU vulnerabilities, but leave SMT
@@ -2476,6 +2478,8 @@ bytes respectively. Such letter suffixes can also be entirely omitted. noefi Disable EFI runtime services support. + no_entry_flush [PPC] Don't flush the L1-D cache when entering the kernel. + noexec [IA-64] noexec [X86]
@@ -2518,6 +2522,9 @@ bytes respectively. Such letter suffixes can also be entirely omitted. nospec_store_bypass_disable [HW] Disable all mitigations for the Speculative Store Bypass vulnerability + no_uaccess_flush + [PPC] Don't flush the L1-D cache after accessing user data. + noxsave [BUGS=X86] Disables x86 extended register state save and restore using xsave. The kernel will fallback to enabling legacy floating-point and sse state.
Makefile +1 -1
@@ -1,6 +1,6 @@ VERSION = 4 PATCHLEVEL = 4 -SUBLEVEL = 244 +SUBLEVEL = 245 EXTRAVERSION = NAME = Blurry Fish Butt
arch/powerpc/include/asm/book3s/64/kup-radix.h new file +23 -0
@@ -0,0 +1,23 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef _ASM_POWERPC_BOOK3S_64_KUP_RADIX_H +#define _ASM_POWERPC_BOOK3S_64_KUP_RADIX_H +#include <linux/jump_label.h> + +DECLARE_STATIC_KEY_FALSE (uaccess_flush_key); + +/* Prototype for function defined in exceptions-64s.S */ +void do_uaccess_flush (void ); + +static __always_inline void allow_user_access(void __user *to, const void __user *from, +unsigned long size) +{ +} + +static inline void prevent_user_access (void __user *to,const void __user *from, +unsigned long size) +{ +if (static_branch_unlikely (&uaccess_flush_key)) +do_uaccess_flush (); +} + +#endif /* _ASM_POWERPC_BOOK3S_64_KUP_RADIX_H */
arch/powerpc/include/asm/exception-64s.h +14 -1
@@ -65,11 +65,18 @@nop ; \ nop +#define ENTRY_FLUSH_SLOT \ + ENTRY_FLUSH_FIXUP_SECTION; \ + nop; \ + nop; \ + nop; +/* * r10 must be free to use, r13 must be paca */ #define INTERRUPT_TO_KERNEL \ - STF_ENTRY_BARRIER_SLOT + STF_ENTRY_BARRIER_SLOT; \ + ENTRY_FLUSH_SLOT/* * Macros for annotating the expected destination of (h)rfid
@@ -597,6 +604,12 @@ label##_relon_hv: \EXCEPTION_PROLOG_1 (PACA_EXGEN ,SOFTEN_NOTEST_HV , vec); \ EXCEPTION_PROLOG_PSERIES_1(label##_common, EXC_HV); +#define MASKABLE_RELON_EXCEPTION_PSERIES_OOL (vec, label) \ + .globl label##_relon_pSeries; \ +label##_relon_pSeries: \ + EXCEPTION_PROLOG_1(PACA_EXGEN, SOFTEN_NOTEST_PR, vec); \ + EXCEPTION_PROLOG_PSERIES_1(label##_common, EXC_STD) +/* * Our exception common code can be passed various "additions" * to specify the behaviour of interrupts, whether to kick the
arch/powerpc/include/asm/feature-fixups.h +19 -0
@@ -200,6 +200,22 @@ label##3: \ FTR_ENTRY_OFFSET 955b-956b; \ .popsection; +#define UACCESS_FLUSH_FIXUP_SECTION \ +959: \ + .pushsection __uaccess_flush_fixup,"a"; \ + .align 2; \ +960: \ + FTR_ENTRY_OFFSET 959b-960b; \ + .popsection; + +#define ENTRY_FLUSH_FIXUP_SECTION \ +957: \ + .pushsection __entry_flush_fixup,"a"; \ + .align 2; \ +958: \ + FTR_ENTRY_OFFSET 957b-958b; \ + .popsection; +#define RFI_FLUSH_FIXUP_SECTION \ 951: \ .pushsection __rfi_flush_fixup,"a"; \
@@ -231,8 +247,11 @@ label##3: \#ifndef __ASSEMBLY__extern long stf_barrier_fallback; +extern long entry_flush_fallback;extern long __start___stf_entry_barrier_fixup, __stop___stf_entry_barrier_fixup;extern long __start___stf_exit_barrier_fixup, __stop___stf_exit_barrier_fixup; +extern long __start___uaccess_flush_fixup, __stop___uaccess_flush_fixup; +extern long __start___entry_flush_fixup, __stop___entry_flush_fixup;extern long __start___rfi_flush_fixup, __stop___rfi_flush_fixup;extern long __start___barrier_nospec_fixup, __stop___barrier_nospec_fixup;extern long __start__btb_flush_fixup, __stop__btb_flush_fixup;
arch/powerpc/include/asm/futex.h +4 -0
@@ -36,6 +36,7 @@ static inline int arch_futex_atomic_op_inuser(int op, int oparg, int *oval, {int oldval =0 , ret; +allow_write_to_user (uaddr,sizeof (*uaddr));pagefault_disable ();switch (op) {
@@ -62,6 +63,7 @@ static inline int arch_futex_atomic_op_inuser(int op, int oparg, int *oval, *oval = oldval; +prevent_write_to_user (uaddr,sizeof (*uaddr));return ret; }
@@ -75,6 +77,7 @@ futex_atomic_cmpxchg_inatomic(u32 *uval, u32 __user *uaddr,if (!access_ok (VERIFY_WRITE , uaddr,sizeof (u32)))return -EFAULT ; +allow_write_to_user (uaddr,sizeof (*uaddr)); __asm__ __volatile__ ( PPC_ATOMIC_ENTRY_BARRIER "1: lwarx %1,0,%3 # futex_atomic_cmpxchg_inatomic\n\
@@ -97,6 +100,7 @@ futex_atomic_cmpxchg_inatomic(u32 *uval, u32 __user *uaddr, : "cc", "memory"); *uval = prev; +prevent_write_to_user (uaddr,sizeof (*uaddr));return ret; }
arch/powerpc/include/asm/kup.h new file +40 -0
@@ -0,0 +1,40 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef _ASM_POWERPC_KUP_H_ +#define _ASM_POWERPC_KUP_H_ + +#ifndef __ASSEMBLY__ + +#include <asm/pgtable.h> + +#ifdef CONFIG_PPC_BOOK3S_64 +#include <asm/book3s/64/kup-radix.h> +#else +static inline void allow_user_access (void __user *to,const void __user *from, +unsigned long size) { } +static inline void prevent_user_access (void __user *to,const void __user *from, +unsigned long size) { } +#endif /* CONFIG_PPC_BOOK3S_64 */ + +static inline void allow_read_from_user (const void __user *from,unsigned long size) +{ +allow_user_access (NULL , from, size); +} + +static inline void allow_write_to_user (void __user *to,unsigned long size) +{ +allow_user_access (to,NULL , size); +} + +static inline void prevent_read_from_user (const void __user *from,unsigned long size) +{ +prevent_user_access (NULL , from, size); +} + +static inline void prevent_write_to_user (void __user *to,unsigned long size) +{ +prevent_user_access (to,NULL , size); +} + +#endif /* !__ASSEMBLY__ */ + +#endif /* _ASM_POWERPC_KUP_H_ */
arch/powerpc/include/asm/security_features.h +7 -0
@@ -84,12 +84,19 @@ static inline bool security_ftr_enabled(unsigned long feature)// Software required to flush link stack on context switch #define SEC_FTR_FLUSH_LINK_STACK 0x0000000000001000ull +// The L1-D cache should be flushed when entering the kernel +#define SEC_FTR_L1D_FLUSH_ENTRY 0x0000000000004000ull + +// The L1-D cache should be flushed after user accesses from the kernel +#define SEC_FTR_L1D_FLUSH_UACCESS 0x0000000000008000ull// Features enabled by default #define SEC_FTR_DEFAULT \ (SEC_FTR_L1D_FLUSH_HV | \ SEC_FTR_L1D_FLUSH_PR | \ SEC_FTR_BNDS_CHK_SPEC_BAR | \ + SEC_FTR_L1D_FLUSH_ENTRY | \ + SEC_FTR_L1D_FLUSH_UACCESS | \ SEC_FTR_FAVOUR_SECURITY)#endif /* _ASM_POWERPC_SECURITY_FEATURES_H */
arch/powerpc/include/asm/setup.h +4 -0
@@ -38,12 +38,16 @@ enum l1d_flush_type { };void setup_rfi_flush (enum l1d_flush_type ,bool enable); +void setup_entry_flush (bool enable); +void setup_uaccess_flush (bool enable);void do_rfi_flush_fixups (enum l1d_flush_type types);#ifdef CONFIG_PPC_BARRIER_NOSPEC void setup_barrier_nospec (void );#else static inline void setup_barrier_nospec (void ) { };#endif +void do_uaccess_flush_fixups (enum l1d_flush_type types); +void do_entry_flush_fixups (enum l1d_flush_type types);void do_barrier_nospec_fixups (bool enable);extern bool barrier_nospec_enabled;
arch/powerpc/include/asm/uaccess.h +111 -31
281 lines not on this page · raw message
arch/powerpc/kernel/exceptions-64s.S +128 -82
291 lines not on this page · raw message
arch/powerpc/kernel/head_8xx.S +2 -6
@@ -361,11 +361,9 @@ InstructionTLBMiss: /* Load the MI_TWC with the attributes for this "segment." */ MTSPR_CPU6(SPRN_MI_TWC, r11, r3) /* Set segment attributes */ -#ifdef CONFIG_SWAP - rlwinm r11, r10, 32-5, _PAGE_PRESENT + rlwinm r11, r10, 32-11, _PAGE_PRESENT and r11, r11, r10 rlwimi r10, r11, 0, _PAGE_PRESENT -#endif li r11, RPN_PATTERN /* The Linux PTE won't go exactly into the MMU TLB. * Software indicator bits 20-23 and 28 must be clear.
@@ -436,11 +434,9 @@ DataStoreTLBMiss: * r11 = ((r10 & PRESENT) & ((r10 & ACCESSED) >> 5)); * r10 = (r10 & ~PRESENT) | r11; */ -#ifdef CONFIG_SWAP - rlwinm r11, r10, 32-5, _PAGE_PRESENT + rlwinm r11, r10, 32-11, _PAGE_PRESENT and r11, r11, r10 rlwimi r10, r11, 0, _PAGE_PRESENT -#endif /* The Linux PTE won't go exactly into the MMU TLB. * Software indicator bits 22 and 28 must be clear. * Software indicator bits 24, 25, 26, and 27 must be
arch/powerpc/kernel/ppc_ksyms.c +10 -0
@@ -5,6 +5,10 @@#include <asm/switch_to.h> #include <asm/cacheflush.h> #include <asm/epapr_hcalls.h> +#include <asm/uaccess.h> +#ifdef CONFIG_PPC64 +#include <asm/book3s/64/kup-radix.h> +#endif EXPORT_SYMBOL (flush_dcache_range);EXPORT_SYMBOL (flush_icache_range);
@@ -43,3 +47,9 @@ EXPORT_SYMBOL(epapr_hypercall_start);#endif EXPORT_SYMBOL (current_stack_pointer); + +EXPORT_SYMBOL (__arch_clear_user); + +#ifdef CONFIG_PPC64 +EXPORT_SYMBOL (do_uaccess_flush); +#endif
arch/powerpc/kernel/setup_64.c +138 -0
174 lines not on this page · raw message
arch/powerpc/kernel/vmlinux.lds.S +14 -0
@@ -80,6 +80,20 @@ SECTIONS __stop___stf_entry_barrier_fixup = .; } + . = ALIGN(8); + __uaccess_flush_fixup : AT(ADDR(__uaccess_flush_fixup) - LOAD_OFFSET) { + __start___uaccess_flush_fixup = .; + *(__uaccess_flush_fixup) + __stop___uaccess_flush_fixup = .; + } + + . = ALIGN(8); + __entry_flush_fixup : AT(ADDR(__entry_flush_fixup) - LOAD_OFFSET) { + __start___entry_flush_fixup = .; + *(__entry_flush_fixup) + __stop___entry_flush_fixup = .; + } + . = ALIGN(8); __stf_exit_barrier_fixup : AT(ADDR(__stf_exit_barrier_fixup) - LOAD_OFFSET) { __start___stf_exit_barrier_fixup = .;
arch/powerpc/lib/checksum_wrappers_64.c +4 -0
@@ -29,6 +29,7 @@ __wsum csum_and_copy_from_user(const void __user *src, void *dst,unsigned int csum;might_sleep (); +allow_read_from_user (src, len); *err_ptr =0 ;
@@ -60,6 +61,7 @@ __wsum csum_and_copy_from_user(const void __user *src, void *dst, } out: +prevent_read_from_user (src, len);return (__force __wsum )csum; }EXPORT_SYMBOL (csum_and_copy_from_user);
@@ -70,6 +72,7 @@ __wsum csum_and_copy_to_user(const void *src, void __user *dst, int len,unsigned int csum;might_sleep (); +allow_write_to_user (dst, len); *err_ptr =0 ;
@@ -97,6 +100,7 @@ __wsum csum_and_copy_to_user(const void *src, void __user *dst, int len, } out: +prevent_write_to_user (dst, len);return (__force __wsum )csum; }EXPORT_SYMBOL (csum_and_copy_to_user);
arch/powerpc/lib/feature-fixups.c +104 -0
110 lines not on this page · raw message
arch/powerpc/lib/string.S +1 -1
@@ -122,7 +122,7 @@ _GLOBAL(memchr) blr #ifdef CONFIG_PPC32 -_GLOBAL(__clear_user) +_GLOBAL(__arch_clear_user) addi r6,r3,-4 li r3,0 li r5,0
arch/powerpc/lib/string_64.S +2 -2
@@ -27,7 +27,7 @@ PPC64_CACHES: .section ".text" /** - * __clear_user: - Zero a block of memory in user space, with less checking. + * __arch_clear_user: - Zero a block of memory in user space, with less checking. * @to: Destination address, in user space. * @n: Number of bytes to zero. *
@@ -77,7 +77,7 @@ err3; stb r0,0(r3) mr r3,r4 blr -_GLOBAL_TOC(__clear_user) +_GLOBAL_TOC(__arch_clear_user) cmpdi r4,32 neg r6,r3 li r0,0
arch/powerpc/platforms/powernv/setup.c +15 -0
@@ -124,12 +124,27 @@ static void pnv_setup_rfi_flush(void) type =L1D_FLUSH_ORI ; } +/* +* 4.4 doesn't support Power9 bare metal, so we don't need to flush +* here - the flushes fix a P9 specific vulnerability. +*/ +security_ftr_clear (SEC_FTR_L1D_FLUSH_ENTRY ); +security_ftr_clear (SEC_FTR_L1D_FLUSH_UACCESS ); + enable =security_ftr_enabled (SEC_FTR_FAVOUR_SECURITY ) && \ (security_ftr_enabled (SEC_FTR_L1D_FLUSH_PR ) || \security_ftr_enabled (SEC_FTR_L1D_FLUSH_HV ));setup_rfi_flush (type, enable);setup_count_cache_flush (); + + enable =security_ftr_enabled (SEC_FTR_FAVOUR_SECURITY ) && +security_ftr_enabled (SEC_FTR_L1D_FLUSH_ENTRY ); +setup_entry_flush (enable); + + enable =security_ftr_enabled (SEC_FTR_FAVOUR_SECURITY ) && +security_ftr_enabled (SEC_FTR_L1D_FLUSH_UACCESS ); +setup_uaccess_flush (enable); }static void __init pnv_setup_arch (void )
arch/powerpc/platforms/pseries/setup.c +8 -0
@@ -584,6 +584,14 @@ void pseries_setup_rfi_flush(void)setup_rfi_flush (types, enable);setup_count_cache_flush (); + + enable =security_ftr_enabled (SEC_FTR_FAVOUR_SECURITY ) && +security_ftr_enabled (SEC_FTR_L1D_FLUSH_ENTRY ); +setup_entry_flush (enable); + + enable =security_ftr_enabled (SEC_FTR_FAVOUR_SECURITY ) && +security_ftr_enabled (SEC_FTR_L1D_FLUSH_UACCESS ); +setup_uaccess_flush (enable); }static void __init pSeries_setup_arch (void )
arch/x86/kvm/emulate.c +7 -1
@@ -3922,6 +3922,12 @@ static int em_clflush(struct x86_emulate_ctxt *ctxt)return X86EMUL_CONTINUE ; } +static int em_clflushopt (struct x86_emulate_ctxt *ctxt) +{ +/* emulating clflushopt regardless of cpuid */ +return X86EMUL_CONTINUE ; +} +static int em_movsxd (struct x86_emulate_ctxt *ctxt) { ctxt->dst.val = (s32 ) ctxt->src.val;
@@ -4411,7 +4417,7 @@ static const struct opcode group11[] = { };static const struct gprefix pfx_0f_ae_7 = { -I (SrcMem | ByteOp, em_clflush),N ,N ,N , +I (SrcMem | ByteOp, em_clflush),I (SrcMem | ByteOp, em_clflushopt),N ,N , };static const struct group_dual group15 = { {
drivers/i2c/busses/i2c-imx.c +16 -9
@@ -1093,20 +1093,20 @@ static int i2c_imx_probe(struct platform_device *pdev) goto clk_disable; } -/* Request IRQ */ - ret =devm_request_irq (&pdev->dev, irq, i2c_imx_isr,0 , - pdev->name, i2c_imx); -if (ret) { -dev_err (&pdev->dev,"can't claim irq %d\n" , irq); - goto clk_disable; - } -/* Init queue */ init_waitqueue_head (&i2c_imx->queue);/* Set up adapter data */ i2c_set_adapdata (&i2c_imx->adapter, i2c_imx); +/* Request IRQ */ + ret =request_threaded_irq (irq, i2c_imx_isr,NULL ,0 , + pdev->name, i2c_imx); +if (ret) { +dev_err (&pdev->dev,"can't claim irq %d\n" , irq); + goto clk_disable; + } +/* Set up clock divider */ i2c_imx->bitrate =IMX_I2C_BIT_RATE ; ret = of_property_read_u32(pdev->dev.of_node,
@@ -1125,7 +1125,7 @@ static int i2c_imx_probe(struct platform_device *pdev) ret =i2c_add_numbered_adapter (&i2c_imx->adapter);if (ret <0 ) {dev_err (&pdev->dev,"registration failed\n" ); - goto clk_disable; + goto clk_free_irq; }/* Set up platform driver data */
@@ -1143,6 +1143,8 @@ static int i2c_imx_probe(struct platform_device *pdev)return 0 ;/* Return OK */ +clk_free_irq: +free_irq (irq, i2c_imx); clk_disable:clk_disable_unprepare (i2c_imx->clk);return ret;
@@ -1151,6 +1153,7 @@ clk_disable:static int i2c_imx_remove (struct platform_device *pdev) {struct imx_i2c_struct *i2c_imx =platform_get_drvdata (pdev); +int irq;/* remove adapter */ dev_dbg (&i2c_imx->adapter.dev,"adapter removed\n" );
@@ -1165,6 +1168,10 @@ static int i2c_imx_remove(struct platform_device *pdev)imx_i2c_write_reg (0 , i2c_imx,IMX_I2C_I2CR );imx_i2c_write_reg (0 , i2c_imx,IMX_I2C_I2SR ); + irq =platform_get_irq (pdev,0 ); +if (irq >=0 ) +free_irq (irq, i2c_imx); +return 0 ; }
drivers/input/keyboard/sunkbd.c +33 -8
67 lines not on this page · raw message
fs/xfs/xfs_icache.c +51 -7
79 lines not on this page · raw message
net/mac80211/sta_info.c +18 -0
@@ -242,6 +242,24 @@ struct sta_info *sta_info_get_by_idx(struct ieee80211_sub_if_data *sdata,*/ void sta_info_free (struct ieee80211_local *local,struct sta_info *sta) { +/* +* If we had used sta_info_pre_move_state() then we might not +* have gone through the state transitions down again, so do +* it here now (and warn if it's inserted). +* +* This will clear state such as fast TX/RX that may have been +* allocated during state transitions. +*/ +while (sta->sta_state >IEEE80211_STA_NONE ) { +int ret; + +WARN_ON_ONCE (test_sta_flag (sta,WLAN_STA_INSERTED )); + + ret =sta_info_move_state (sta, sta->sta_state -1 ); +if (WARN_ONCE (ret,"sta_info_move_state() returned %d\n" , ret)) +break ; + } +if (sta->rate_ctrl)rate_control_free_sta (sta);