3.16.77-rc1 review
cover 3.16.77-rc1 review
This is the start of the stable review cycle for the 3.16.77 release. There are 25 patches in this series, which will be posted as responses to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Fri Nov 15 00:00:00 UTC 2019. Anything received after that time might be too late.
All the patches have also been committed to the linux-3.16.y-rc branch of
https://git.kernel.org/pub/scm/linux/kernel/git/bwh/linux-stable-rc.git . A shortlog and diffstat can be found below.
Ben.
-------------
Ben Hutchings (1):
KVM: Introduce kvm_get_arch_capabilities()
[5b76a3cff011df2dcb6186c965a2e4d809a05ad4]
Hui Peng (1):
ath6kl: fix a NULL-ptr-deref bug in ath6kl_usb_alloc_urb_from_pipe()
[39d170b3cb62ba98567f5c4f40c27b5864b304e5]
Imre Deak (1):
drm/i915/gen8+: Add RC6 CTX corruption WA
[7e34f4e4aad3fd34c02b294a3cf2321adf5b4438]
Jakub Kicinski (1):
net: netem: fix error path for corrupted GSO frames
[a7fa12d15855904aff1716e1fc723c03ba38c5cc]
Josh Poimboeuf (1):
x86/speculation/taa: Fix printing of TAA_MSG_SMT on IBRS_ALL CPUs
[012206a822a8b6ac09125bfaa210a95b9eb8f1c1]
Laura Abbott (1):
rtlwifi: Fix potential overflow on P2P code
[8c55dedb795be8ec0cf488f98c03a1c2176f7fb1]
Michal Hocko (1):
x86/tsx: Add config options to set tsx=on|off|auto
[db616173d787395787ecc93eef075fa975227b10]
Ori Nimron (5):
appletalk: enforce CAP_NET_RAW for raw sockets
[6cc03e8aa36c51f3b26a0d21a3c4ce2809c842ac]
ax25: enforce CAP_NET_RAW for raw sockets
[0614e2b73768b502fc32a75349823356d98aae2c]
ieee802154: enforce CAP_NET_RAW for raw sockets
[e69dbd4619e7674c1679cba49afd9dd9ac347eef]
mISDN: enforce CAP_NET_RAW for raw sockets
[b91ee4aa2a2199ba4d4650706c272985a5a32d80]
nfc: enforce CAP_NET_RAW for raw sockets
[3a359798b176183ef09efb7a3dc59abad1cc7104]
Paolo Bonzini (1):
KVM: x86: use Intel speculation bugs and features as derived in generic x86 code
[0c54914d0c52a15db9954a76ce80fee32cf318f4]
Pawan Gupta (8):
kvm/x86: Export MDS_NO=0 to guests when TSX is enabled
[e1d38b63acd843cfdd4222bf19a26700fd5c699e]
x86/cpu: Add a "tsx=" cmdline option with TSX disabled by default
[95c5824f75f3ba4c9e8e5a4b1a623c95390ac266]
x86/cpu: Add a helper function x86_read_arch_cap_msr()
[286836a70433fb64131d2590f4bf512097c255e1]
x86/msr: Add the IA32_TSX_CTRL MSR
[c2955f270a84762343000f103e0640d29c7a96f3]
x86/speculation/taa: Add documentation for TSX Async Abort
[a7a248c593e4fd7a67c50b5f5318fe42a0db335e]
x86/speculation/taa: Add mitigation for TSX Async Abort
[1b42f017415b46c317e71d41c34ec088417a1883]
x86/speculation/taa: Add sysfs reporting for TSX Async Abort
[6608b45ac5ecb56f9e171252229c39580cc85f0f]
x86/tsx: Add "auto" option to the tsx= cmdline parameter
[7531a3596e3272d1f6841e0d601a614555dc6b65]
Sean Young (1):
media: technisat-usb2: break out of loop at end of buffer
[0c4df39e504bf925ab666132ac3c98d6cbbe380b]
Vandana BN (1):
media: usb:zr364xx:Fix KASAN:null-ptr-deref Read in zr364xx_vidioc_querycap
[5d2e73a5f80a5b5aff3caf1ec6d39b5b3f54b26e]
Vineela Tummalapalli (1):
x86/bugs: Add ITLB_MULTIHIT bug infrastructure
[db4d30fbb71b47e4ecb11c4efa5d8aad4b03dfae]
Will Deacon (1):
cfg80211: wext: avoid copying malformed SSIDs
[4ac2813cc867ae563a1ba5a9414bfb554e5796fa]
Documentation/ABI/testing/sysfs-devices-system-cpu | 2 + Documentation/hw-vuln/tsx_async_abort.rst | 268 +++++++++++++++++++++ Documentation/kernel-parameters.txt | 62 +++++ Documentation/x86/tsx_async_abort.rst | 117 +++++++++ Makefile | 4 +- arch/x86/Kconfig | 45 ++++ arch/x86/include/asm/cpufeatures.h | 2 + arch/x86/include/asm/kvm_host.h | 1 + arch/x86/include/asm/nospec-branch.h | 4 +- arch/x86/include/asm/processor.h | 7 + arch/x86/include/uapi/asm/msr-index.h | 16 ++ arch/x86/kernel/cpu/Makefile | 2 +- arch/x86/kernel/cpu/bugs.c | 143 ++++++++++- arch/x86/kernel/cpu/common.c | 93 ++++--- arch/x86/kernel/cpu/cpu.h | 18 ++ arch/x86/kernel/cpu/intel.c | 5 + arch/x86/kernel/cpu/tsx.c | 140 +++++++++++ arch/x86/kvm/cpuid.c | 7 + arch/x86/kvm/x86.c | 40 ++- drivers/base/cpu.c | 17 ++ drivers/gpu/drm/i915/i915_drv.c | 4 + drivers/gpu/drm/i915/i915_drv.h | 5 + drivers/gpu/drm/i915/i915_reg.h | 2 + drivers/gpu/drm/i915/intel_display.c | 9 + drivers/gpu/drm/i915/intel_drv.h | 3 + drivers/gpu/drm/i915/intel_pm.c | 146 ++++++++++- drivers/isdn/mISDN/socket.c | 2 + drivers/media/usb/dvb-usb/technisat-usb2.c | 21 +- drivers/media/usb/zr364xx/zr364xx.c | 3 +- drivers/net/wireless/ath/ath6kl/usb.c | 8 + drivers/net/wireless/rtlwifi/ps.c | 6 + include/linux/cpu.h | 5 + net/appletalk/ddp.c | 5 + net/ax25/af_ax25.c | 2 + net/ieee802154/af_ieee802154.c | 3 + net/nfc/llcp_sock.c | 7 +- net/sched/sch_netem.c | 9 +- net/wireless/wext-sme.c | 8 +- 38 files changed, 1172 insertions(+), 69 deletions(-)
Signature · 3 lines
Ben Hutchings I'm not a reverse psychological virus. Please don't copy me into your signature.
PATCH 1/25 KVM: Introduce kvm_get_arch_capabilities()
3.16.77-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Ben Hutchings <[email protected]>
Extracted from commit 5b76a3cff011 "KVM: VMX: Tell the nested hypervisor to skip L1D flush on vmentry". We will need this to let a nested hypervisor know that we have applied the mitigation for TAA.
--- arch/x86/include/asm/kvm_host.h | 1 + arch/x86/kvm/x86.c | 13 +++++++++++-- 2 files changed, 12 insertions(+), 2 deletions(-)
arch/x86/include/asm/kvm_host.h +1 -0
@@ -1062,6 +1062,7 @@ int kvm_arch_interrupt_allowed(struct kvint kvm_cpu_get_interrupt (struct kvm_vcpu *v);void kvm_vcpu_reset (struct kvm_vcpu *vcpu); +u64 kvm_get_arch_capabilities (void );void kvm_define_shared_msr (unsigned index,u32 msr);int kvm_set_shared_msr (unsigned index,u64 val,u64 mask);
arch/x86/kvm/x86.c +11 -2
@@ -911,6 +911,16 @@ static u32 emulated_msrs[] = {static unsigned num_emulated_msrs; +u64 kvm_get_arch_capabilities (void ) +{ +u64 data; + +rdmsrl_safe (MSR_IA32_ARCH_CAPABILITIES , &data); + +return data; +} +EXPORT_SYMBOL_GPL (kvm_get_arch_capabilities); +bool kvm_valid_efer (struct kvm_vcpu *vcpu,u64 efer) {if (efer & efer_reserved_bits)
@@ -6969,8 +6979,7 @@ int kvm_arch_vcpu_setup(struct kvm_vcpuint r;if (boot_cpu_has (X86_FEATURE_ARCH_CAPABILITIES )) -rdmsrl (MSR_IA32_ARCH_CAPABILITIES , - vcpu->arch.arch_capabilities); + vcpu->arch.arch_capabilities =kvm_get_arch_capabilities (); vcpu->arch.mtrr_state.have_fixed =1 ; r =vcpu_load (vcpu);if (r)
PATCH 2/25 KVM: x86: use Intel speculation bugs and features as derived in generic x86 code
In reply to Ben Hutchings3.16.77-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Paolo Bonzini <[email protected]>
commit 0c54914d0c52a15db9954a76ce80fee32cf318f4 upstream.
Similar to AMD bits, set the Intel bits from the vendor-independent feature and bug flags, because KVM_GET_SUPPORTED_CPUID does not care about the vendor and they should be set on AMD processors as well.
--- arch/x86/kvm/cpuid.c | 7 +++++++ arch/x86/kvm/x86.c | 8 ++++++++ 2 files changed, 15 insertions(+)
arch/x86/kvm/cpuid.c +7 -0
@@ -395,6 +395,13 @@ static inline int __do_cpuid_ent(struct entry->ebx |=F (TSC_ADJUST ); entry->edx &= kvm_cpuid_7_0_edx_x86_features;cpuid_mask (&entry->edx,10 ); +if (boot_cpu_has (X86_FEATURE_IBPB ) && +boot_cpu_has (X86_FEATURE_IBRS )) + entry->edx |=F (SPEC_CTRL ); +if (boot_cpu_has (X86_FEATURE_STIBP )) + entry->edx |=F (INTEL_STIBP ); +if (boot_cpu_has (X86_FEATURE_SSBD )) + entry->edx |=F (SPEC_CTRL_SSBD );/* * We emulate ARCH_CAPABILITIES in software even * if the host doesn't support it.
arch/x86/kvm/x86.c +8 -0
@@ -917,8 +917,16 @@ u64 kvm_get_arch_capabilities(void)rdmsrl_safe (MSR_IA32_ARCH_CAPABILITIES , &data); +if (!boot_cpu_has_bug (X86_BUG_CPU_MELTDOWN )) + data |=ARCH_CAP_RDCL_NO ; +if (!boot_cpu_has_bug (X86_BUG_SPEC_STORE_BYPASS )) + data |=ARCH_CAP_SSB_NO ; +if (!boot_cpu_has_bug (X86_BUG_MDS )) + data |=ARCH_CAP_MDS_NO ; +return data; } +EXPORT_SYMBOL_GPL (kvm_get_arch_capabilities);bool kvm_valid_efer (struct kvm_vcpu *vcpu,u64 efer)
PATCH 3/25 x86/msr: Add the IA32_TSX_CTRL MSR
In reply to Ben Hutchings3.16.77-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Pawan Gupta <[email protected]>
commit c2955f270a84762343000f103e0640d29c7a96f3 upstream.
Transactional Synchronization Extensions (TSX) may be used on certain processors as part of a speculative side channel attack. A microcode update for existing processors that are vulnerable to this attack will add a new MSR - IA32_TSX_CTRL to allow the system administrator the option to disable TSX as one of the possible mitigations.
The CPUs which get this new MSR after a microcode upgrade are the ones which do not set MSR_IA32_ARCH_CAPABILITIES.MDS_NO (bit 5) because those CPUs have CPUID.MD_CLEAR, i.e., the VERW implementation which clears all CPU buffers takes care of the TAA case as well.
[ Note that future processors that are not vulnerable will also
support the IA32_TSX_CTRL MSR. ]
Add defines for the new IA32_TSX_CTRL MSR and its bits.
TSX has two sub-features:
1. Restricted Transactional Memory (RTM) is an explicitly-used feature where new instructions begin and end TSX transactions.
2. Hardware Lock Elision (HLE) is implicitly used when certain kinds of "old" style locks are used by software.
Bit 7 of the IA32_ARCH_CAPABILITIES indicates the presence of the IA32_TSX_CTRL MSR.
There are two control bits in IA32_TSX_CTRL MSR:
Bit 0: When set, it disables the Restricted Transactional Memory (RTM)
sub-feature of TSX (will force all transactions to abort on the XBEGIN instruction).
Bit 1: When set, it disables the enumeration of the RTM and HLE feature
(i.e. it will make CPUID(EAX=7).EBX{bit4} and
CPUID(EAX=7).EBX{bit11} read as 0).
The other TSX sub-feature, Hardware Lock Elision (HLE), is unconditionally disabled by the new microcode but still enumerated as present by CPUID(EAX=7).EBX{bit4}, unless disabled by IA32_TSX_CTRL_MSR[1] - TSX_CTRL_CPUID_CLEAR.
[bwh: Backported to 3.16:
- Don't use BIT() in msr-index.h because it's a UAPI header
- Adjust filename, context, indentation]
--- arch/x86/include/uapi/asm/msr-index.h | 5 +++++ 1 file changed, 5 insertions(+)
arch/x86/include/uapi/asm/msr-index.h +5 -0
@@ -70,10 +70,15 @@* Microarchitectural Data * Sampling (MDS) vulnerabilities. */ +#define ARCH_CAP_TSX_CTRL_MSR (1UL << 7)/* MSR for TSX control is available. */ #define MSR_IA32_BBL_CR_CTL 0x00000119#define MSR_IA32_BBL_CR_CTL3 0x0000011e +#define MSR_IA32_TSX_CTRL 0x00000122 +#define TSX_CTRL_RTM_DISABLE (1UL << 0)/* Disable RTM feature */ +#define TSX_CTRL_CPUID_CLEAR (1UL << 1)/* Disable TSX enumeration */ +#define MSR_IA32_SYSENTER_CS 0x00000174#define MSR_IA32_SYSENTER_ESP 0x00000175#define MSR_IA32_SYSENTER_EIP 0x00000176
PATCH 4/25 x86/cpu: Add a helper function x86_read_arch_cap_msr()
In reply to Ben Hutchings3.16.77-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Pawan Gupta <[email protected]>
commit 286836a70433fb64131d2590f4bf512097c255e1 upstream.
Add a helper function to read the IA32_ARCH_CAPABILITIES MSR.
--- arch/x86/kernel/cpu/common.c | 15 +++++++++++---- arch/x86/kernel/cpu/cpu.h | 2 ++ 2 files changed, 13 insertions(+), 4 deletions(-)
arch/x86/kernel/cpu/common.c +11 -4
@@ -878,19 +878,26 @@ static bool __init cpu_matches(unsignedreturn m && !!(m->driver_data & which); } -static void __init cpu_set_bug_bits (struct cpuinfo_x86 *c) +u64 x86_read_arch_cap_msr (void ) {u64 ia32_cap =0 ; +if (boot_cpu_has (X86_FEATURE_ARCH_CAPABILITIES )) +rdmsrl (MSR_IA32_ARCH_CAPABILITIES , ia32_cap); + +return ia32_cap; +} + +static void __init cpu_set_bug_bits (struct cpuinfo_x86 *c) +{ +u64 ia32_cap =x86_read_arch_cap_msr (); +if (cpu_matches (NO_SPECULATION ))return ;setup_force_cpu_bug (X86_BUG_SPECTRE_V1 );setup_force_cpu_bug (X86_BUG_SPECTRE_V2 ); -if (cpu_has (c,X86_FEATURE_ARCH_CAPABILITIES )) -rdmsrl (MSR_IA32_ARCH_CAPABILITIES , ia32_cap); -if (!cpu_matches (NO_SSB ) && !(ia32_cap &ARCH_CAP_SSB_NO ) && !cpu_has (c,X86_FEATURE_AMD_SSB_NO ))setup_force_cpu_bug (X86_BUG_SPEC_STORE_BYPASS );
arch/x86/kernel/cpu/cpu.h +2 -0
@@ -48,4 +48,6 @@ extern void cpu_detect_cache_sizes(strucextern void x86_spec_ctrl_setup_ap (void ); +extern u64 x86_read_arch_cap_msr (void ); +#endif /* ARCH_X86_CPU_H */
PATCH 5/25 x86/cpu: Add a "tsx=" cmdline option with TSX disabled by default
In reply to Ben Hutchings3.16.77-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Pawan Gupta <[email protected]>
commit 95c5824f75f3ba4c9e8e5a4b1a623c95390ac266 upstream.
Add a kernel cmdline parameter "tsx" to control the Transactional Synchronization Extensions (TSX) feature. On CPUs that support TSX control, use "tsx=on|off" to enable or disable TSX. Not specifying this option is equivalent to "tsx=off". This is because on certain processors TSX may be used as a part of a speculative side channel attack.
Carve out the TSX controlling functionality into a separate compilation unit because TSX is a CPU feature while the TSX async abort control machinery will go to cpu/bugs.c.
[ bp: - Massage, shorten and clear the arg buffer.
- Clarifications of the tsx= possible options - Josh.
- Expand on TSX_CTRL availability - Pawan. ]
[bwh: Backported to 3.16:
- Drop __ro_after_init attribute
- Adjust filenames, context]
--- Documentation/kernel-parameters.txt | 26 ++++++ arch/x86/kernel/cpu/Makefile | 2 +- arch/x86/kernel/cpu/common.c | 2 + arch/x86/kernel/cpu/cpu.h | 16 ++++ arch/x86/kernel/cpu/intel.c | 5 ++ arch/x86/kernel/cpu/tsx.c | 125 ++++++++++++++++++++++++++++ 6 files changed, 175 insertions(+), 1 deletion(-) create mode 100644 arch/x86/kernel/cpu/tsx.c
Documentation/kernel-parameters.txt +26 -0
@@ -3581,6 +3581,32 @@ bytes respectively. Such letter suffixes platforms where RDTSC is slow and this accounting can add overhead. + tsx= [X86] Control Transactional Synchronization + Extensions (TSX) feature in Intel processors that + support TSX control. + + This parameter controls the TSX feature. The options are: + + on - Enable TSX on the system. Although there are + mitigations for all known security vulnerabilities, + TSX has been known to be an accelerator for + several previous speculation-related CVEs, and + so there may be unknown security risks associated + with leaving it enabled. + + off - Disable TSX on the system. (Note that this + option takes effect only on newer CPUs which are + not vulnerable to MDS, i.e., have + MSR_IA32_ARCH_CAPABILITIES.MDS_NO=1 and which get + the new IA32_TSX_CTRL MSR through a microcode + update. This new MSR allows for the reliable + deactivation of the TSX functionality.) + + Not specifying this option is equivalent to tsx=off. + + See Documentation/hw-vuln/tsx_async_abort.rst + for more details. + turbografx.map[2|3]= [HW,JOY] TurboGraFX parallel port interface Format:
arch/x86/kernel/cpu/Makefile +1 -1
@@ -18,7 +18,7 @@ obj-y += rdrand.o obj-y += match.o obj-y += bugs.o -obj-$(CONFIG_CPU_SUP_INTEL) += intel.o +obj-$(CONFIG_CPU_SUP_INTEL) += intel.o tsx.o obj-$(CONFIG_CPU_SUP_AMD) += amd.o obj-$(CONFIG_CPU_SUP_CYRIX_32) += cyrix.o obj-$(CONFIG_CPU_SUP_CENTAUR) += centaur.o
arch/x86/kernel/cpu/common.c +2 -0
@@ -1242,6 +1242,8 @@ void __init identify_boot_cpu(void)vgetcpu_set_mode ();#endif cpu_detect_tlb (&boot_cpu_data); + +tsx_init (); }void identify_secondary_cpu (struct cpuinfo_x86 *c)
arch/x86/kernel/cpu/cpu.h +16 -0
@@ -43,6 +43,22 @@ struct _tlb_table {extern const struct cpu_dev *const __x86_cpu_dev_start[], *const __x86_cpu_dev_end[]; +#ifdef CONFIG_CPU_SUP_INTEL +enum tsx_ctrl_states { +TSX_CTRL_ENABLE , +TSX_CTRL_DISABLE , +TSX_CTRL_NOT_SUPPORTED , +}; + +extern enum tsx_ctrl_states tsx_ctrl_state; + +extern void __init tsx_init (void ); +extern void tsx_enable (void ); +extern void tsx_disable (void ); +#else +static inline void tsx_init (void ) { } +#endif /* CONFIG_CPU_SUP_INTEL */ +extern void get_cpu_cap (struct cpuinfo_x86 *c);extern void cpu_detect_cache_sizes (struct cpuinfo_x86 *c);
arch/x86/kernel/cpu/intel.c +5 -0
@@ -566,6 +566,11 @@ static void init_intel(struct cpuinfo_x8wrmsrl (MSR_IA32_ENERGY_PERF_BIAS , epb); } } + +if (tsx_ctrl_state ==TSX_CTRL_ENABLE ) +tsx_enable (); +if (tsx_ctrl_state ==TSX_CTRL_DISABLE ) +tsx_disable (); }#ifdef CONFIG_X86_32
arch/x86/kernel/cpu/tsx.c new file +125 -0
125 lines not on this page · raw message
PATCH 6/25 x86/speculation/taa: Add mitigation for TSX Async Abort
In reply to Ben Hutchings3.16.77-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Pawan Gupta <[email protected]>
commit 1b42f017415b46c317e71d41c34ec088417a1883 upstream.
TSX Async Abort (TAA) is a side channel vulnerability to the internal buffers in some Intel processors similar to Microachitectural Data Sampling (MDS). In this case, certain loads may speculatively pass invalid data to dependent operations when an asynchronous abort condition is pending in a TSX transaction.
This includes loads with no fault or assist condition. Such loads may speculatively expose stale data from the uarch data structures as in MDS. Scope of exposure is within the same-thread and cross-thread. This issue affects all current processors that support TSX, but do not have ARCH_CAP_TAA_NO (bit 8) set in MSR_IA32_ARCH_CAPABILITIES.
On CPUs which have their IA32_ARCH_CAPABILITIES MSR bit MDS_NO=0, CPUID.MD_CLEAR=1 and the MDS mitigation is clearing the CPU buffers using VERW or L1D_FLUSH, there is no additional mitigation needed for TAA. On affected CPUs with MDS_NO=1 this issue can be mitigated by disabling the Transactional Synchronization Extensions (TSX) feature.
A new MSR IA32_TSX_CTRL in future and current processors after a microcode update can be used to control the TSX feature. There are two bits in that MSR:
* TSX_CTRL_RTM_DISABLE disables the TSX sub-feature Restricted Transactional Memory (RTM).
* TSX_CTRL_CPUID_CLEAR clears the RTM enumeration in CPUID. The other TSX sub-feature, Hardware Lock Elision (HLE), is unconditionally disabled with updated microcode but still enumerated as present by CPUID(EAX=7).EBX{bit4}.
The second mitigation approach is similar to MDS which is clearing the affected CPU buffers on return to user space and when entering a guest. Relevant microcode update is required for the mitigation to work. More details on this approach can be found here:
https://www.kernel.org/doc/html/latest/admin-guide/hw-vuln/mds.html
The TSX feature can be controlled by the "tsx" command line parameter. If it is force-enabled then "Clear CPU buffers" (MDS mitigation) is deployed. The effective mitigation state can be read from sysfs.
[ bp:
- massage + comments cleanup
- s/TAA_MITIGATION_TSX_DISABLE/TAA_MITIGATION_TSX_DISABLED/g - Josh.
- remove partial TAA mitigation in update_mds_branch_idle() - Josh.
- s/tsx_async_abort_cmdline/tsx_async_abort_parse_cmdline/g
]
[bwh: Backported to 3.16:
- Use next available X86_BUG bit
- Don't use BIT() in msr-index.h because it's a UAPI header
- Add #include "cpu.h" in bugs.c
- Drop __ro_after_init attribute
- Drop "nosmt" support
- Adjust context, indentation]
--- arch/x86/include/asm/cpufeatures.h | 1 + arch/x86/include/asm/nospec-branch.h | 4 +- arch/x86/include/asm/processor.h | 7 ++ arch/x86/include/uapi/asm/msr-index.h | 4 + arch/x86/kernel/cpu/bugs.c | 103 ++++++++++++++++++++++++++ arch/x86/kernel/cpu/common.c | 15 ++++ 6 files changed, 132 insertions(+), 2 deletions(-)
arch/x86/include/asm/cpufeatures.h +1 -0
@@ -279,5 +279,6 @@#define X86_BUG_MDS X86_BUG(10)/* CPU is affected by Microarchitectural data sampling */ #define X86_BUG_MSBDS_ONLY X86_BUG(11)/* CPU is only affected by the MSDBS variant of BUG_MDS */ #define X86_BUG_SWAPGS X86_BUG(12)/* CPU is affected by speculation through SWAPGS */ +#define X86_BUG_TAA X86_BUG(13)/* CPU is affected by TSX Async Abort(TAA) */ #endif /* _ASM_X86_CPUFEATURES_H */
arch/x86/include/asm/nospec-branch.h +2 -2
@@ -268,7 +268,7 @@ DECLARE_STATIC_KEY_FALSE(mds_idle_clear)#include <asm/segment.h> /** -* mds_clear_cpu_buffers - Mitigation for MDS vulnerability +* mds_clear_cpu_buffers - Mitigation for MDS and TAA vulnerability * * This uses the otherwise unused and obsolete VERW instruction in * combination with microcode which triggers a CPU buffer flush when the
@@ -291,7 +291,7 @@ static inline void mds_clear_cpu_buffers }/** -* mds_user_clear_cpu_buffers - Mitigation for MDS vulnerability +* mds_user_clear_cpu_buffers - Mitigation for MDS and TAA vulnerability * * Clear CPU buffers if the corresponding static key is enabled */
arch/x86/include/asm/processor.h +7 -0
@@ -960,4 +960,11 @@ enum mds_mitigations { MDS_MITIGATION_VMWERV, }; +enum taa_mitigations { +TAA_MITIGATION_OFF , +TAA_MITIGATION_UCODE_NEEDED , +TAA_MITIGATION_VERW , +TAA_MITIGATION_TSX_DISABLED , +}; +#endif /* _ASM_X86_PROCESSOR_H */
arch/x86/include/uapi/asm/msr-index.h +4 -0
@@ -71,6 +71,10 @@* Sampling (MDS) vulnerabilities. */ #define ARCH_CAP_TSX_CTRL_MSR (1UL << 7)/* MSR for TSX control is available. */ +#define ARCH_CAP_TAA_NO (1UL << 8)/* +* Not susceptible to +* TSX Async Abort (TAA) vulnerabilities. +*/ #define MSR_IA32_BBL_CR_CTL 0x00000119#define MSR_IA32_BBL_CR_CTL3 0x0000011e
arch/x86/kernel/cpu/bugs.c +103 -0
138 lines not on this page · raw message
arch/x86/kernel/cpu/common.c +15 -0
@@ -914,6 +914,21 @@ static void __init cpu_set_bug_bits(struif (!cpu_matches (NO_SWAPGS ))setup_force_cpu_bug (X86_BUG_SWAPGS ); +/* +* When the CPU is not mitigated for TAA (TAA_NO=0) set TAA bug when: +* - TSX is supported or +* - TSX_CTRL is present +* +* TSX_CTRL check is needed for cases when TSX could be disabled before +* the kernel boot e.g. kexec. +* TSX_CTRL check alone is not sufficient for cases when the microcode +* update is not present or running as guest that don't get TSX_CTRL. +*/ +if (!(ia32_cap &ARCH_CAP_TAA_NO ) && + (cpu_has (c,X86_FEATURE_RTM ) || + (ia32_cap &ARCH_CAP_TSX_CTRL_MSR ))) +setup_force_cpu_bug (X86_BUG_TAA ); +if (cpu_matches (NO_MELTDOWN ))return ;
PATCH 7/25 x86/speculation/taa: Add sysfs reporting for TSX Async Abort
In reply to Ben Hutchings3.16.77-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Pawan Gupta <[email protected]>
commit 6608b45ac5ecb56f9e171252229c39580cc85f0f upstream.
Add the sysfs reporting file for TSX Async Abort. It exposes the vulnerability and the mitigation state similar to the existing files for the other hardware vulnerabilities.
Sysfs file path is:/sys/devices/system/cpu/vulnerabilities/tsx_async_abort
--- arch/x86/kernel/cpu/bugs.c | 23 +++++++++++++++++++++++ drivers/base/cpu.c | 9 +++++++++ include/linux/cpu.h | 3 +++ 3 files changed, 35 insertions(+)
arch/x86/kernel/cpu/bugs.c +23 -0
@@ -1365,6 +1365,21 @@ static ssize_t mds_show_state(char *buf) sched_smt_active() ? "vulnerable" : "disabled"); } +static ssize_t tsx_async_abort_show_state (char *buf) +{ +if ((taa_mitigation ==TAA_MITIGATION_TSX_DISABLED ) || + (taa_mitigation ==TAA_MITIGATION_OFF )) +return sprintf (buf,"%s\n" , taa_strings[taa_mitigation]); + +if (boot_cpu_has (X86_FEATURE_HYPERVISOR )) { +return sprintf (buf,"%s; SMT Host state unknown\n" , + taa_strings[taa_mitigation]); + } + +return sprintf (buf,"%s; SMT %s\n" , taa_strings[taa_mitigation], +sched_smt_active () ?"vulnerable" :"disabled" ); +} +static char *stibp_state (void ) {if (spectre_v2_enabled ==SPECTRE_V2_IBRS_ENHANCED )
@@ -1430,6 +1445,9 @@ static ssize_t cpu_show_common(struct decase X86_BUG_MDS :return mds_show_state (buf); +case X86_BUG_TAA : +return tsx_async_abort_show_state (buf); +default :break ; }
@@ -1466,4 +1484,9 @@ ssize_t cpu_show_mds(struct device *dev, {return cpu_show_common (dev, attr, buf,X86_BUG_MDS ); } + +ssize_t cpu_show_tsx_async_abort (struct device *dev,struct device_attribute *attr,char *buf) +{ +return cpu_show_common (dev, attr, buf,X86_BUG_TAA ); +}#endif
drivers/base/cpu.c +9 -0
@@ -456,12 +456,20 @@ ssize_t __weak cpu_show_mds(struct devicreturn sprintf (buf,"Not affected\n" ); } +ssize_t __weak cpu_show_tsx_async_abort (struct device *dev, +struct device_attribute *attr, +char *buf) +{ +return sprintf (buf,"Not affected\n" ); +} + static DEVICE_ATTR(meltdown, 0444, cpu_show_meltdown, NULL); static DEVICE_ATTR(spectre_v1, 0444, cpu_show_spectre_v1, NULL); static DEVICE_ATTR(spectre_v2, 0444, cpu_show_spectre_v2, NULL); static DEVICE_ATTR(spec_store_bypass, 0444, cpu_show_spec_store_bypass, NULL); static DEVICE_ATTR(l1tf, 0444, cpu_show_l1tf, NULL); static DEVICE_ATTR(mds, 0444, cpu_show_mds, NULL); +static DEVICE_ATTR(tsx_async_abort, 0444, cpu_show_tsx_async_abort, NULL);static struct attribute *cpu_root_vulnerabilities_attrs[] = { &dev_attr_meltdown.attr,
@@ -470,6 +478,7 @@ static struct attribute *cpu_root_vulner &dev_attr_spec_store_bypass.attr, &dev_attr_l1tf.attr, &dev_attr_mds.attr, + &dev_attr_tsx_async_abort.attr, NULL };
include/linux/cpu.h +3 -0
@@ -51,6 +51,9 @@ extern ssize_t cpu_show_l1tf(struct devi struct device_attribute *attr, char *buf);extern ssize_t cpu_show_mds (struct device *dev,struct device_attribute *attr,char *buf); +extern ssize_t cpu_show_tsx_async_abort (struct device *dev, +struct device_attribute *attr, +char *buf);#ifdef CONFIG_HOTPLUG_CPU extern void unregister_cpu (struct cpu *cpu);
PATCH 8/25 kvm/x86: Export MDS_NO=0 to guests when TSX is enabled
In reply to Ben Hutchings3.16.77-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Pawan Gupta <[email protected]>
commit e1d38b63acd843cfdd4222bf19a26700fd5c699e upstream.
Export the IA32_ARCH_CAPABILITIES MSR bit MDS_NO=0 to guests on TSX Async Abort(TAA) affected hosts that have TSX enabled and updated microcode. This is required so that the guests don't complain,
"Vulnerable: Clear CPU buffers attempted, no microcode"
when the host has the updated microcode to clear CPU buffers.
Microcode update also adds support for MSR_IA32_TSX_CTRL which is enumerated by the ARCH_CAP_TSX_CTRL bit in IA32_ARCH_CAPABILITIES MSR. Guests can't do this check themselves when the ARCH_CAP_TSX_CTRL bit is not exported to the guests.
In this case export MDS_NO=0 to the guests. When guests have CPUID.MD_CLEAR=1, they deploy MDS mitigation which also mitigates TAA.
--- arch/x86/kvm/x86.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+)
arch/x86/kvm/x86.c +19 -0
@@ -924,6 +924,25 @@ u64 kvm_get_arch_capabilities(void)if (!boot_cpu_has_bug (X86_BUG_MDS )) data |=ARCH_CAP_MDS_NO ; +/* +* On TAA affected systems, export MDS_NO=0 when: +* - TSX is enabled on the host, i.e. X86_FEATURE_RTM=1. +* - Updated microcode is present. This is detected by +* the presence of ARCH_CAP_TSX_CTRL_MSR and ensures +* that VERW clears CPU buffers. +* +* When MDS_NO=0 is exported, guests deploy clear CPU buffer +* mitigation and don't complain: +* +* "Vulnerable: Clear CPU buffers attempted, no microcode" +* +* If TSX is disabled on the system, guests are also mitigated against +* TAA and clear CPU buffer mitigation is not required for guests. +*/ +if (boot_cpu_has_bug (X86_BUG_TAA ) &&boot_cpu_has (X86_FEATURE_RTM ) && + (data &ARCH_CAP_TSX_CTRL_MSR )) + data &= ~ARCH_CAP_MDS_NO ; +return data; }
PATCH 9/25 x86/tsx: Add "auto" option to the tsx= cmdline parameter
In reply to Ben Hutchings3.16.77-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Pawan Gupta <[email protected]>
commit 7531a3596e3272d1f6841e0d601a614555dc6b65 upstream.
Platforms which are not affected by X86_BUG_TAA may want the TSX feature enabled. Add "auto" option to the TSX cmdline parameter. When tsx=auto disable TSX when X86_BUG_TAA is present, otherwise enable TSX.
More details on X86_BUG_TAA can be found here:
https://www.kernel.org/doc/html/latest/admin-guide/hw-vuln/tsx_async_abort.html
[ bp: Extend the arg buffer to accommodate "auto\0". ]
--- Documentation/kernel-parameters.txt | 3 +++ arch/x86/kernel/cpu/tsx.c | 7 ++++++- 2 files changed, 9 insertions(+), 1 deletion(-)
Documentation/kernel-parameters.txt +3 -0
@@ -3602,6 +3602,9 @@ bytes respectively. Such letter suffixes update. This new MSR allows for the reliable deactivation of the TSX functionality.) + auto - Disable TSX if X86_BUG_TAA is present, + otherwise enable TSX on the system. + Not specifying this option is equivalent to tsx=off. See Documentation/hw-vuln/tsx_async_abort.rst
arch/x86/kernel/cpu/tsx.c +6 -1
@@ -75,7 +75,7 @@ static bool __init tsx_ctrl_is_supportedvoid __init tsx_init (void ) { -char arg[4 ] = {}; +char arg[5 ] = {};int ret;if (!tsx_ctrl_is_supported ())
@@ -87,6 +87,11 @@ void __init tsx_init(void) tsx_ctrl_state =TSX_CTRL_ENABLE ; }else if (!strcmp (arg,"off" )) { tsx_ctrl_state =TSX_CTRL_DISABLE ; + }else if (!strcmp (arg,"auto" )) { +if (boot_cpu_has_bug (X86_BUG_TAA )) + tsx_ctrl_state =TSX_CTRL_DISABLE ; +else + tsx_ctrl_state =TSX_CTRL_ENABLE ; }else { tsx_ctrl_state =TSX_CTRL_DISABLE ;pr_err ("tsx: invalid option, defaulting to off\n" );
PATCH 10/25 x86/speculation/taa: Add documentation for TSX Async Abort
In reply to Ben Hutchings3.16.77-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Pawan Gupta <[email protected]>
commit a7a248c593e4fd7a67c50b5f5318fe42a0db335e upstream.
Add the documenation for TSX Async Abort. Include the description of the issue, how to check the mitigation state, control the mitigation, guidance for system administrators.
[ bp: Add proper SPDX tags, touch ups by Josh and me. ]
[bwh: Backported to 4.4:
- Drop changes to ReST index files
- Drop "nosmt" documentation
- Adjust filenames, context]
--- .../ABI/testing/sysfs-devices-system-cpu | 1 + Documentation/hw-vuln/tsx_async_abort.rst | 268 ++++++++++++++++++ Documentation/kernel-parameters.txt | 33 +++ Documentation/x86/tsx_async_abort.rst | 117 ++++++++ 4 files changed, 419 insertions(+) create mode 100644 Documentation/hw-vuln/tsx_async_abort.rst create mode 100644 Documentation/x86/tsx_async_abort.rst
Documentation/ABI/testing/sysfs-devices-system-cpu +1 -0
@@ -232,6 +232,7 @@ What: /sys/devices/system/cpu/vulnerabi /sys/devices/system/cpu/vulnerabilities/spec_store_bypass /sys/devices/system/cpu/vulnerabilities/l1tf /sys/devices/system/cpu/vulnerabilities/mds + /sys/devices/system/cpu/vulnerabilities/tsx_async_abort Date: January 2018 Contact: Linux kernel mailing list <[email protected]> Description: Information about CPU vulnerabilities
Documentation/hw-vuln/tsx_async_abort.rst new file +268 -0
268 lines not on this page · raw message
Documentation/kernel-parameters.txt +33 -0
@@ -1922,6 +1922,7 @@ bytes respectively. Such letter suffixes spectre_v2_user=off [X86] spec_store_bypass_disable=off [X86] mds=off [X86] + tsx_async_abort=off [X86] auto (default) Mitigate all CPU vulnerabilities, but leave SMT
@@ -3610,6 +3611,38 @@ bytes respectively. Such letter suffixes See Documentation/hw-vuln/tsx_async_abort.rst for more details. + tsx_async_abort= [X86,INTEL] Control mitigation for the TSX Async + Abort (TAA) vulnerability. + + Similar to Micro-architectural Data Sampling (MDS) + certain CPUs that support Transactional + Synchronization Extensions (TSX) are vulnerable to an + exploit against CPU internal buffers which can forward + information to a disclosure gadget under certain + conditions. + + In vulnerable processors, the speculatively forwarded + data can be used in a cache side channel attack, to + access data to which the attacker does not have direct + access. + + This parameter controls the TAA mitigation. The + options are: + + full - Enable TAA mitigation on vulnerable CPUs + if TSX is enabled. + + off - Unconditionally disable TAA mitigation + + Not specifying this option is equivalent to + tsx_async_abort=full. On CPUs which are MDS affected + and deploy MDS mitigation, TAA mitigation is not + required and doesn't provide any additional + mitigation. + + For details see: + Documentation/hw-vuln/tsx_async_abort.rst + turbografx.map[2|3]= [HW,JOY] TurboGraFX parallel port interface Format:
Documentation/x86/tsx_async_abort.rst new file +117 -0
117 lines not on this page · raw message
PATCH 11/25 x86/tsx: Add config options to set tsx=on|off|auto
In reply to Ben Hutchings3.16.77-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Michal Hocko <[email protected]>
commit db616173d787395787ecc93eef075fa975227b10 upstream.
There is a general consensus that TSX usage is not largely spread while the history shows there is a non trivial space for side channel attacks possible. Therefore the tsx is disabled by default even on platforms that might have a safe implementation of TSX according to the current knowledge. This is a fair trade off to make.
There are, however, workloads that really do benefit from using TSX and updating to a newer kernel with TSX disabled might introduce a noticeable regressions. This would be especially a problem for Linux distributions which will provide TAA mitigations.
Introduce config options X86_INTEL_TSX_MODE_OFF, X86_INTEL_TSX_MODE_ON and X86_INTEL_TSX_MODE_AUTO to control the TSX feature. The config setting can be overridden by the tsx cmdline options.
[ bp: Text cleanups from Josh. ]
--- arch/x86/Kconfig | 45 +++++++++++++++++++++++++++++++++++++++ arch/x86/kernel/cpu/tsx.c | 22 +++++++++++++------ 2 files changed, 61 insertions(+), 6 deletions(-)
arch/x86/Kconfig +45 -0
@@ -1531,6 +1531,51 @@ config X86_SMAP If unsure, say Y. +choice + prompt "TSX enable mode" + depends on CPU_SUP_INTEL + default X86_INTEL_TSX_MODE_OFF + help + Intel's TSX (Transactional Synchronization Extensions) feature + allows to optimize locking protocols through lock elision which + can lead to a noticeable performance boost. + + On the other hand it has been shown that TSX can be exploited + to form side channel attacks (e.g. TAA) and chances are there + will be more of those attacks discovered in the future. + + Therefore TSX is not enabled by default (aka tsx=off). An admin + might override this decision by tsx=on the command line parameter. + Even with TSX enabled, the kernel will attempt to enable the best + possible TAA mitigation setting depending on the microcode available + for the particular machine. + + This option allows to set the default tsx mode between tsx=on, =off + and =auto. See Documentation/kernel-parameters.txt for more + details. + + Say off if not sure, auto if TSX is in use but it should be used on safe + platforms or on if TSX is in use and the security aspect of tsx is not + relevant. + +config X86_INTEL_TSX_MODE_OFF + bool "off" + help + TSX is disabled if possible - equals to tsx=off command line parameter. + +config X86_INTEL_TSX_MODE_ON + bool "on" + help + TSX is always enabled on TSX capable HW - equals the tsx=on command + line parameter. + +config X86_INTEL_TSX_MODE_AUTO + bool "auto" + help + TSX is enabled on TSX capable HW that is believed to be safe against + side channel attacks- equals the tsx=auto command line parameter. +endchoice + config EFI bool "EFI runtime service support" depends on ACPI
arch/x86/kernel/cpu/tsx.c +16 -6
@@ -73,6 +73,14 @@ static bool __init tsx_ctrl_is_supportedreturn !!(ia32_cap &ARCH_CAP_TSX_CTRL_MSR ); } +static enum tsx_ctrl_states x86_get_tsx_auto_mode (void ) +{ +if (boot_cpu_has_bug (X86_BUG_TAA )) +return TSX_CTRL_DISABLE ; + +return TSX_CTRL_ENABLE ; +} +void __init tsx_init (void ) {char arg[5 ] = {};
@@ -88,17 +96,19 @@ void __init tsx_init(void) }else if (!strcmp (arg,"off" )) { tsx_ctrl_state =TSX_CTRL_DISABLE ; }else if (!strcmp (arg,"auto" )) { -if (boot_cpu_has_bug (X86_BUG_TAA )) - tsx_ctrl_state =TSX_CTRL_DISABLE ; -else - tsx_ctrl_state =TSX_CTRL_ENABLE ; + tsx_ctrl_state =x86_get_tsx_auto_mode (); }else { tsx_ctrl_state =TSX_CTRL_DISABLE ;pr_err ("tsx: invalid option, defaulting to off\n" ); } }else { -/* tsx= not provided, defaulting to off */ - tsx_ctrl_state =TSX_CTRL_DISABLE ; +/* tsx= not provided */ +if (IS_ENABLED (CONFIG_X86_INTEL_TSX_MODE_AUTO )) + tsx_ctrl_state =x86_get_tsx_auto_mode (); +else if (IS_ENABLED (CONFIG_X86_INTEL_TSX_MODE_OFF )) + tsx_ctrl_state =TSX_CTRL_DISABLE ; +else + tsx_ctrl_state =TSX_CTRL_ENABLE ; }if (tsx_ctrl_state ==TSX_CTRL_DISABLE ) {
PATCH 12/25 x86/speculation/taa: Fix printing of TAA_MSG_SMT on IBRS_ALL CPUs
In reply to Ben Hutchings3.16.77-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Josh Poimboeuf <[email protected]>
commit 012206a822a8b6ac09125bfaa210a95b9eb8f1c1 upstream.
For new IBRS_ALL CPUs, the Enhanced IBRS check at the beginning of cpu_bugs_smt_update() causes the function to return early, unintentionally skipping the MDS and TAA logic.
This is not a problem for MDS, because there appears to be no overlap between IBRS_ALL and MDS-affected CPUs. So the MDS mitigation would be disabled and nothing would need to be done in this function anyway.
But for TAA, the TAA_MSG_SMT string will never get printed on Cascade Lake and newer.
The check is superfluous anyway: when 'spectre_v2_enabled' is SPECTRE_V2_IBRS_ENHANCED, 'spectre_v2_user' is always SPECTRE_V2_USER_NONE, and so the 'spectre_v2_user' switch statement handles it appropriately by doing nothing. So just remove the check.
--- arch/x86/kernel/cpu/bugs.c | 4 ---- 1 file changed, 4 deletions(-)
arch/x86/kernel/cpu/bugs.c +0 -4
@@ -919,10 +919,6 @@ static void update_mds_branch_idle(void)void arch_smt_update (void ) { -/* Enhanced IBRS implies STIBP. No update required. */ -if (spectre_v2_enabled ==SPECTRE_V2_IBRS_ENHANCED ) -return ; -mutex_lock (&spec_ctrl_mutex);switch (spectre_v2_user) {
PATCH 13/25 x86/bugs: Add ITLB_MULTIHIT bug infrastructure
In reply to Ben Hutchings3.16.77-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Vineela Tummalapalli <[email protected]>
commit db4d30fbb71b47e4ecb11c4efa5d8aad4b03dfae upstream.
Some processors may incur a machine check error possibly resulting in an unrecoverable CPU lockup when an instruction fetch encounters a TLB multi-hit in the instruction TLB. This can occur when the page size is changed along with either the physical address or cache type. The relevant erratum can be found here:
https://bugzilla.kernel.org/show_bug.cgi?id=205195
There are other processors affected for which the erratum does not fully disclose the impact.
This issue affects both bare-metal x86 page tables and EPT.
It can be mitigated by either eliminating the use of large pages or by using careful TLB invalidations when changing the page size in the page tables.
Just like Spectre, Meltdown, L1TF and MDS, a new bit has been allocated in MSR_IA32_ARCH_CAPABILITIES (PSCHANGE_MC_NO) and will be set on CPUs which are mitigated against this issue.
[bwh: Backported to 3.16:
- Use next available X86_BUG bit
- Don't use BIT() in msr-index.h because it's a UAPI header
- No support for X86_VENDOR_HYGON, ATOM_AIRMONT_NP
- Adjust filename, context, indentation]
--- .../ABI/testing/sysfs-devices-system-cpu | 1 + arch/x86/include/asm/cpufeatures.h | 1 + arch/x86/include/uapi/asm/msr-index.h | 7 +++ arch/x86/kernel/cpu/bugs.c | 13 ++++ arch/x86/kernel/cpu/common.c | 61 ++++++++++--------- drivers/base/cpu.c | 8 +++ include/linux/cpu.h | 2 + 7 files changed, 65 insertions(+), 28 deletions(-)
Documentation/ABI/testing/sysfs-devices-system-cpu +1 -0
@@ -233,6 +233,7 @@ What: /sys/devices/system/cpu/vulnerabi /sys/devices/system/cpu/vulnerabilities/l1tf /sys/devices/system/cpu/vulnerabilities/mds /sys/devices/system/cpu/vulnerabilities/tsx_async_abort + /sys/devices/system/cpu/vulnerabilities/itlb_multihit Date: January 2018 Contact: Linux kernel mailing list <[email protected]> Description: Information about CPU vulnerabilities
arch/x86/include/asm/cpufeatures.h +1 -0
@@ -280,5 +280,6 @@#define X86_BUG_MSBDS_ONLY X86_BUG(11)/* CPU is only affected by the MSDBS variant of BUG_MDS */ #define X86_BUG_SWAPGS X86_BUG(12)/* CPU is affected by speculation through SWAPGS */ #define X86_BUG_TAA X86_BUG(13)/* CPU is affected by TSX Async Abort(TAA) */ +#define X86_BUG_ITLB_MULTIHIT X86_BUG(14)/* CPU may incur MCE during certain page attribute changes */ #endif /* _ASM_X86_CPUFEATURES_H */
arch/x86/include/uapi/asm/msr-index.h +7 -0
@@ -70,6 +70,13 @@* Microarchitectural Data * Sampling (MDS) vulnerabilities. */ +#define ARCH_CAP_PSCHANGE_MC_NO (1UL << 6)/* +* The processor is not susceptible to a +* machine check error due to modifying the +* code page size along with either the +* physical address or cache type +* without TLB invalidation. +*/ #define ARCH_CAP_TSX_CTRL_MSR (1UL << 7)/* MSR for TSX control is available. */ #define ARCH_CAP_TAA_NO (1UL << 8)/* * Not susceptible to
arch/x86/kernel/cpu/bugs.c +13 -0
@@ -1342,6 +1342,11 @@ static void __init l1tf_select_mitigatio#ifdef CONFIG_SYSFS +static ssize_t itlb_multihit_show_state (char *buf) +{ +return sprintf (buf,"Processor vulnerable\n" ); +} +static ssize_t mds_show_state (char *buf) {#ifdef CONFIG_HYPERVISOR_GUEST
@@ -1444,6 +1449,9 @@ static ssize_t cpu_show_common(struct decase X86_BUG_TAA :return tsx_async_abort_show_state (buf); +case X86_BUG_ITLB_MULTIHIT : +return itlb_multihit_show_state (buf); +default :break ; }
@@ -1485,4 +1493,9 @@ ssize_t cpu_show_tsx_async_abort(struct {return cpu_show_common (dev, attr, buf,X86_BUG_TAA ); } + +ssize_t cpu_show_itlb_multihit (struct device *dev,struct device_attribute *attr,char *buf) +{ +return cpu_show_common (dev, attr, buf,X86_BUG_ITLB_MULTIHIT ); +}#endif
arch/x86/kernel/cpu/common.c +33 -28
91 lines not on this page · raw message
drivers/base/cpu.c +8 -0
@@ -463,6 +463,12 @@ ssize_t __weak cpu_show_tsx_async_abort(return sprintf (buf,"Not affected\n" ); } +ssize_t __weak cpu_show_itlb_multihit (struct device *dev, +struct device_attribute *attr,char *buf) +{ +return sprintf (buf,"Not affected\n" ); +} + static DEVICE_ATTR(meltdown, 0444, cpu_show_meltdown, NULL); static DEVICE_ATTR(spectre_v1, 0444, cpu_show_spectre_v1, NULL); static DEVICE_ATTR(spectre_v2, 0444, cpu_show_spectre_v2, NULL);
@@ -470,6 +476,7 @@ static DEVICE_ATTR(spec_store_bypass, 04 static DEVICE_ATTR(l1tf, 0444, cpu_show_l1tf, NULL); static DEVICE_ATTR(mds, 0444, cpu_show_mds, NULL); static DEVICE_ATTR(tsx_async_abort, 0444, cpu_show_tsx_async_abort, NULL); +static DEVICE_ATTR(itlb_multihit, 0444, cpu_show_itlb_multihit, NULL);static struct attribute *cpu_root_vulnerabilities_attrs[] = { &dev_attr_meltdown.attr,
@@ -479,6 +486,7 @@ static struct attribute *cpu_root_vulner &dev_attr_l1tf.attr, &dev_attr_mds.attr, &dev_attr_tsx_async_abort.attr, + &dev_attr_itlb_multihit.attr, NULL };
include/linux/cpu.h +2 -0
@@ -54,6 +54,8 @@ extern ssize_t cpu_show_mds(struct devicextern ssize_t cpu_show_tsx_async_abort (struct device *dev,struct device_attribute *attr,char *buf); +extern ssize_t cpu_show_itlb_multihit (struct device *dev, +struct device_attribute *attr,char *buf);#ifdef CONFIG_HOTPLUG_CPU extern void unregister_cpu (struct cpu *cpu);
PATCH 14/25 drm/i915/gen8+: Add RC6 CTX corruption WA
In reply to Ben Hutchings3.16.77-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Imre Deak <[email protected]>
commit 7e34f4e4aad3fd34c02b294a3cf2321adf5b4438 upstream.
In some circumstances the RC6 context can get corrupted. We can detect this and take the required action, that is disable RC6 and runtime PM. The HW recovers from the corrupted state after a system suspend/resume cycle, so detect the recovery and re-enable RC6 and runtime PM.
v2: rebase (Mika)
v3:
- Move intel_suspend_gt_powersave() to the end of the GEM suspend sequence.
- Add commit message.
v4:
- Rebased on intel_uncore_forcewake_put(i915->uncore, ...) API change.
v5:
- Rebased on latest upstream gt_pm refactoring.
--- drivers/gpu/drm/i915/i915_drv.c | 4 + drivers/gpu/drm/i915/i915_drv.h | 5 + drivers/gpu/drm/i915/i915_reg.h | 2 + drivers/gpu/drm/i915/intel_display.c | 9 ++ drivers/gpu/drm/i915/intel_drv.h | 3 + drivers/gpu/drm/i915/intel_pm.c | 146 +++++++++++++++++++++++++-- 6 files changed, 162 insertions(+), 7 deletions(-)
drivers/gpu/drm/i915/i915_drv.c +4 -0
@@ -604,6 +604,8 @@ static int i915_drm_thaw_early(struct drintel_uncore_sanitize (dev);intel_power_domains_init_hw (dev_priv); +i915_rc6_ctx_wa_resume (dev_priv); +return 0 ; }
@@ -926,6 +928,8 @@ static int i915_pm_suspend_late(struct dif (drm_dev->switch_power_state ==DRM_SWITCH_POWER_OFF )return 0 ; +i915_rc6_ctx_wa_suspend (to_i915 (drm_dev)); +pci_disable_device (pdev);pci_set_power_state (pdev, PCI_D3hot);
drivers/gpu/drm/i915/i915_drv.h +5 -0
@@ -910,6 +910,7 @@ struct intel_gen6_power_mgmt {enum {LOW_POWER ,BETWEEN ,HIGH_POWER } power;bool enabled; +bool ctx_corrupted;struct delayed_work delayed_resume_work;/*
@@ -1959,6 +1960,10 @@ struct drm_i915_cmd_table {/* Early gen2 have a totally busted CS tlb and require pinned batches. */ #define HAS_BROKEN_CS_TLB (dev) (IS_I830(dev) || IS_845G(dev)) + +#define NEEDS_RC6_CTX_CORRUPTION_WA (dev) \ + (IS_BROADWELL(dev) || INTEL_INFO(dev)->gen == 9) +/* * dp aux and gmbus irq on gen4 seems to be able to generate legacy interrupts * even when in MSI mode. This results in spurious interrupt warnings if the
drivers/gpu/drm/i915/i915_reg.h +2 -0
@@ -136,6 +136,8 @@#define ECOCHK_PPGTT_WT_HSW (0x2<<3)#define ECOCHK_PPGTT_WB_HSW (0x3<<3) +#define GEN8_RC6_CTX_INFO 0x8504 +#define GAC_ECO_BITS 0x14090#define ECOBITS_SNB_BIT (1<<13)#define ECOBITS_PPGTT_CACHE64B (3<<8)
drivers/gpu/drm/i915/intel_display.c +9 -0
@@ -8787,6 +8787,10 @@ void intel_mark_busy(struct drm_device *return ;intel_runtime_pm_get (dev_priv); + +if (NEEDS_RC6_CTX_CORRUPTION_WA (dev)) +gen6_gt_force_wake_get (dev_priv,FORCEWAKE_ALL ); +i915_update_gfx_val (dev_priv); dev_priv->mm.busy = true; }
@@ -8814,6 +8818,11 @@ void intel_mark_idle(struct drm_device *if (INTEL_INFO (dev)->gen >=6 )gen6_rps_idle (dev->dev_private); +if (NEEDS_RC6_CTX_CORRUPTION_WA (dev)) { +i915_rc6_ctx_wa_check (dev_priv); +gen6_gt_force_wake_put (dev_priv,FORCEWAKE_ALL ); + } + out:intel_runtime_pm_put (dev_priv); }
drivers/gpu/drm/i915/intel_drv.h +3 -0
@@ -965,6 +965,9 @@ void intel_enable_gt_powersave(struct drvoid intel_disable_gt_powersave (struct drm_device *dev);void intel_reset_gt_powersave (struct drm_device *dev);void ironlake_teardown_rc6 (struct drm_device *dev); +bool i915_rc6_ctx_wa_check (struct drm_i915_private *i915); +void i915_rc6_ctx_wa_suspend (struct drm_i915_private *i915); +void i915_rc6_ctx_wa_resume (struct drm_i915_private *i915);void gen6_update_ring_freq (struct drm_device *dev);void gen6_rps_idle (struct drm_i915_private *dev_priv);void gen6_rps_boost (struct drm_i915_private *dev_priv);
drivers/gpu/drm/i915/intel_pm.c +139 -7
197 lines not on this page · raw message
PATCH 15/25 net: netem: fix error path for corrupted GSO frames
In reply to Ben Hutchings3.16.77-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Jakub Kicinski <[email protected]>
commit a7fa12d15855904aff1716e1fc723c03ba38c5cc upstream.
To corrupt a GSO frame we first perform segmentation. We then proceed using the first segment instead of the full GSO skb and requeue the rest of the segments as separate packets.
If there are any issues with processing the first segment we still want to process the rest, therefore we jump to the finish_segs label.
Commit 177b8007463c ("net: netem: fix backlog accounting for corrupted GSO frames") started using the pointer to the first segment in the "rest of segments processing", but as mentioned above the first segment may had already been freed at this point.
Backlog corrections for parent qdiscs have to be adjusted.
--- net/sched/sch_netem.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
net/sched/sch_netem.c +6 -3
@@ -506,6 +506,7 @@ static int netem_enqueue(struct sk_buff (skb->ip_summed == CHECKSUM_PARTIAL && skb_checksum_help(skb))) { rc =qdisc_drop (skb, sch); + skb =NULL ; goto finish_segs; }
@@ -576,9 +577,10 @@ static int netem_enqueue(struct sk_buff finish_segs:if (segs) {unsigned int len, last_len; -int nb =0 ; +int nb; - len = skb->len; + len = skb ? skb->len :0 ; + nb = skb ?1 :0 ;while (segs) { skb2 = segs->next;
@@ -595,7 +597,8 @@ finish_segs: } segs = skb2; } -qdisc_tree_reduce_backlog (sch, -nb, prev_len - len); +/* Parent qdiscs accounted for 1 skb of size @prev_len */ +qdisc_tree_reduce_backlog (sch, -(nb -1 ), -(len - prev_len)); }return NET_XMIT_SUCCESS ; }
PATCH 16/25 ath6kl: fix a NULL-ptr-deref bug in ath6kl_usb_alloc_urb_from_pipe()
In reply to Ben Hutchings3.16.77-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Hui Peng <[email protected]>
commit 39d170b3cb62ba98567f5c4f40c27b5864b304e5 upstream.
The ar_usb field of ath6kl_usb_pipe_usb_pipe objects are initialized to point to the containing ath6kl_usb object according to endpoint descriptors read from the device side, as shown below in ath6kl_usb_setup_pipe_resources:
for (i = 0; i < iface_desc->desc.bNumEndpoints; ++i) {
endpoint = &iface_desc->endpoint[i].desc;
// get the address from endpoint descriptor
pipe_num = ath6kl_usb_get_logical_pipe_num(ar_usb,
endpoint->bEndpointAddress,
&urbcount);
......
// select the pipe object
pipe = &ar_usb->pipes[pipe_num];
// initialize the ar_usb field
pipe->ar_usb = ar_usb;
}The driver assumes that the addresses reported in endpoint descriptors from device side to be complete. If a device is malicious and does not report complete addresses, it may trigger NULL-ptr-deref ath6kl_usb_alloc_urb_from_pipe and ath6kl_usb_free_urb_to_pipe.
This patch fixes the bug by preventing potential NULL-ptr-deref (CVE-2019-15098).
--- drivers/net/wireless/ath/ath6kl/usb.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/net/wireless/ath/ath6kl/usb.c +8 -0
@@ -132,6 +132,10 @@ ath6kl_usb_alloc_urb_from_pipe(struct atstruct ath6kl_urb_context *urb_context =NULL ;unsigned long flags; +/* bail if this pipe is not initialized */ +if (!pipe->ar_usb) +return NULL ; +spin_lock_irqsave (&pipe->ar_usb->cs_lock, flags);if (!list_empty (&pipe->urb_list_head)) { urb_context =
@@ -150,6 +154,10 @@ static void ath6kl_usb_free_urb_to_pipe( {unsigned long flags; +/* bail if this pipe is not initialized */ +if (!pipe->ar_usb) +return ; +spin_lock_irqsave (&pipe->ar_usb->cs_lock, flags); pipe->urb_cnt++;
PATCH 17/25 media: usb:zr364xx:Fix KASAN:null-ptr-deref Read in zr364xx_vidioc_querycap
In reply to Ben Hutchings3.16.77-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Vandana BN <[email protected]>
commit 5d2e73a5f80a5b5aff3caf1ec6d39b5b3f54b26e upstream.
SyzKaller hit the null pointer deref while reading from uninitialized udev->product in zr364xx_vidioc_querycap().
==================================================================
BUG: KASAN: null-ptr-deref in read_word_at_a_time+0xe/0x20 include/linux/compiler.h:274 Read of size 1 at addr 0000000000000000 by task v4l_id/5287 CPU: 1 PID: 5287 Comm: v4l_id Not tainted 5.1.0-rc3-319004-g43151d6 #6 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 Call Trace: __dump_stack lib/dump_stack.c:77 [inline] dump_stack+0xe8/0x16e lib/dump_stack.c:113 kasan_report.cold+0x5/0x3c mm/kasan/report.c:321 read_word_at_a_time+0xe/0x20 include/linux/compiler.h:274 strscpy+0x8a/0x280 lib/string.c:207 zr364xx_vidioc_querycap+0xb5/0x210 drivers/media/usb/zr364xx/zr364xx.c:706 v4l_querycap+0x12b/0x340 drivers/media/v4l2-core/v4l2-ioctl.c:1062 __video_do_ioctl+0x5bb/0xb40 drivers/media/v4l2-core/v4l2-ioctl.c:2874 video_usercopy+0x44e/0xf00 drivers/media/v4l2-core/v4l2-ioctl.c:3056 v4l2_ioctl+0x14e/0x1a0 drivers/media/v4l2-core/v4l2-dev.c:364 vfs_ioctl fs/ioctl.c:46 [inline] file_ioctl fs/ioctl.c:509 [inline] do_vfs_ioctl+0xced/0x12f0 fs/ioctl.c:696 ksys_ioctl+0xa0/0xc0 fs/ioctl.c:713 __do_sys_ioctl fs/ioctl.c:720 [inline] __se_sys_ioctl fs/ioctl.c:718 [inline] __x64_sys_ioctl+0x74/0xb0 fs/ioctl.c:718 do_syscall_64+0xcf/0x4f0 arch/x86/entry/common.c:290 entry_SYSCALL_64_after_hwframe+0x49/0xbe RIP: 0033:0x7f3b56d8b347 Code: 90 90 90 48 8b 05 f1 fa 2a 00 64 c7 00 26 00 00 00 48 c7 c0 ff ff ff
ff c3 90 90 90 90 90 90 90 90 90 90 b8 10 00 00 00 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 8b 0d c1 fa 2a 00 31 d2 48 29 c2 64
RSP: 002b:00007ffe005d5d68 EFLAGS: 00000202 ORIG_RAX: 0000000000000010
RAX: ffffffffffffffda RBX: 0000000000000003 RCX: 00007f3b56d8b347
RDX: 00007ffe005d5d70 RSI: 0000000080685600 RDI: 0000000000000003
RBP: 0000000000000000 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000202 R12: 0000000000400884
R13: 00007ffe005d5ec0 R14: 0000000000000000 R15: 0000000000000000
==================================================================
For this device udev->product is not initialized and accessing it causes a NULL pointer deref.
The fix is to check for NULL before strscpy() and copy empty string, if product is NULL
--- drivers/media/usb/zr364xx/zr364xx.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/media/usb/zr364xx/zr364xx.c +2 -1
@@ -712,7 +712,8 @@ static int zr364xx_vidioc_querycap(strucstruct zr364xx_camera *cam =video_drvdata (file);strlcpy (cap->driver,DRIVER_DESC ,sizeof (cap->driver)); -strlcpy (cap->card, cam->udev->product,sizeof (cap->card)); +if (cam->udev->product) +strlcpy (cap->card, cam->udev->product,sizeof (cap->card));strlcpy (cap->bus_info,dev_name (&cam->udev->dev),sizeof (cap->bus_info)); cap->device_caps = V4L2_CAP_VIDEO_CAPTURE |
PATCH 18/25 media: technisat-usb2: break out of loop at end of buffer
In reply to Ben Hutchings3.16.77-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Sean Young <[email protected]>
commit 0c4df39e504bf925ab666132ac3c98d6cbbe380b upstream.
Ensure we do not access the buffer beyond the end if no 0xff byte is encountered.
[bwh: Backported to 3.16: technisat_usb2_get_ir() still uses a stack
buffer, which is not worth fixing on this branch]
--- drivers/media/usb/dvb-usb/technisat-usb2.c | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-)
drivers/media/usb/dvb-usb/technisat-usb2.c +10 -11
@@ -591,9 +591,9 @@ static int technisat_usb2_frontend_attacstatic int technisat_usb2_get_ir (struct dvb_usb_device *d) { -u8 buf[62 ], *b; -int ret;struct ir_raw_event ev; +u8 buf[62 ]; +int i, ret; buf[0 ] =GET_IR_DATA_VENDOR_REQUEST ; buf[1 ] =0x08 ;
@@ -629,26 +629,25 @@ unlock:return 0 ;/* no key pressed */ /* decoding */ - b = buf+1 ;#if 0 deb_rc ("RC: %d " , ret); -debug_dump (b, ret, deb_rc); +debug_dump (buf +1 , ret, deb_rc);#endif ev.pulse =0 ; -while (1 ) { - ev.pulse = !ev.pulse; - ev.duration = (*b *FIRMWARE_CLOCK_DIVISOR *FIRMWARE_CLOCK_TICK ) /1000 ; -ir_raw_event_store (d->rc_dev, &ev); - - b++; -if (*b ==0xff ) { +for (i =1 ; i <ARRAY_SIZE (buf); i++) { +if (buf[i] ==0xff ) { ev.pulse =0 ; ev.duration =888888 *2 ;ir_raw_event_store (d->rc_dev, &ev);break ; } + + ev.pulse = !ev.pulse; + ev.duration = (buf[i] *FIRMWARE_CLOCK_DIVISOR * +FIRMWARE_CLOCK_TICK ) /1000 ; +ir_raw_event_store (d->rc_dev, &ev); }ir_raw_event_handle (d->rc_dev);
PATCH 19/25 ax25: enforce CAP_NET_RAW for raw sockets
In reply to Ben Hutchings3.16.77-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Ori Nimron <[email protected]>
commit 0614e2b73768b502fc32a75349823356d98aae2c upstream.
When creating a raw AF_AX25 socket, CAP_NET_RAW needs to be checked first.
--- net/ax25/af_ax25.c | 2 ++ 1 file changed, 2 insertions(+)
net/ax25/af_ax25.c +2 -0
@@ -853,6 +853,8 @@ static int ax25_create(struct net *net,break ;case SOCK_RAW : +if (!capable (CAP_NET_RAW )) +return -EPERM ;break ;default :return -ESOCKTNOSUPPORT ;
PATCH 20/25 ieee802154: enforce CAP_NET_RAW for raw sockets
In reply to Ben Hutchings3.16.77-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Ori Nimron <[email protected]>
commit e69dbd4619e7674c1679cba49afd9dd9ac347eef upstream.
When creating a raw AF_IEEE802154 socket, CAP_NET_RAW needs to be checked first.
--- net/ieee802154/af_ieee802154.c | 3 +++ 1 file changed, 3 insertions(+)
net/ieee802154/af_ieee802154.c +3 -0
@@ -255,6 +255,9 @@ static int ieee802154_create(struct netswitch (sock->type) {case SOCK_RAW : + rc = -EPERM ; +if (!capable (CAP_NET_RAW )) + goto out; proto = &ieee802154_raw_prot; ops = &ieee802154_raw_ops;break ;
PATCH 21/25 appletalk: enforce CAP_NET_RAW for raw sockets
In reply to Ben Hutchings3.16.77-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Ori Nimron <[email protected]>
commit 6cc03e8aa36c51f3b26a0d21a3c4ce2809c842ac upstream.
When creating a raw AF_APPLETALK socket, CAP_NET_RAW needs to be checked first.
--- net/appletalk/ddp.c | 5 +++++ 1 file changed, 5 insertions(+)
net/appletalk/ddp.c +5 -0
@@ -1029,6 +1029,11 @@ static int atalk_create(struct net *net,*/ if (sock->type !=SOCK_RAW && sock->type !=SOCK_DGRAM ) goto out; + + rc = -EPERM ; +if (sock->type ==SOCK_RAW && !kern && !capable (CAP_NET_RAW )) + goto out; + rc = -ENOMEM ; sk =sk_alloc (net,PF_APPLETALK ,GFP_KERNEL , &ddp_proto);if (!sk)
PATCH 22/25 mISDN: enforce CAP_NET_RAW for raw sockets
In reply to Ben Hutchings3.16.77-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Ori Nimron <[email protected]>
commit b91ee4aa2a2199ba4d4650706c272985a5a32d80 upstream.
When creating a raw AF_ISDN socket, CAP_NET_RAW needs to be checked first.
--- drivers/isdn/mISDN/socket.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/isdn/mISDN/socket.c +2 -0
@@ -763,6 +763,8 @@ base_sock_create(struct net *net, structif (sock->type !=SOCK_RAW )return -ESOCKTNOSUPPORT ; +if (!capable (CAP_NET_RAW )) +return -EPERM ; sk =sk_alloc (net,PF_ISDN ,GFP_KERNEL , &mISDN_proto);if (!sk)
PATCH 23/25 nfc: enforce CAP_NET_RAW for raw sockets
In reply to Ben Hutchings3.16.77-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Ori Nimron <[email protected]>
commit 3a359798b176183ef09efb7a3dc59abad1cc7104 upstream.
When creating a raw AF_NFC socket, CAP_NET_RAW needs to be checked first.
--- net/nfc/llcp_sock.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
net/nfc/llcp_sock.c +5 -2
@@ -1004,10 +1004,13 @@ static int llcp_sock_create(struct net * sock->type != SOCK_RAW)return -ESOCKTNOSUPPORT ; -if (sock->type ==SOCK_RAW ) +if (sock->type ==SOCK_RAW ) { +if (!capable (CAP_NET_RAW )) +return -EPERM ; sock->ops = &llcp_rawsock_ops; -else + }else { sock->ops = &llcp_sock_ops; + } sk =nfc_llcp_sock_alloc (sock, sock->type,GFP_ATOMIC );if (sk ==NULL )
PATCH 24/25 cfg80211: wext: avoid copying malformed SSIDs
In reply to Ben Hutchings3.16.77-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Will Deacon <[email protected]>
commit 4ac2813cc867ae563a1ba5a9414bfb554e5796fa upstream.
Ensure the SSID element is bounds-checked prior to invoking memcpy() with its length field, when copying to userspace.
--- net/wireless/wext-sme.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
net/wireless/wext-sme.c +6 -2
@@ -225,6 +225,7 @@ int cfg80211_mgd_wext_giwessid(struct ne struct iw_point *data, char *ssid) { struct wireless_dev *wdev = dev->ieee80211_ptr; +int ret =0 ;/* call only for station! */ if (WARN_ON (wdev->iftype !=NL80211_IFTYPE_STATION ))
@@ -242,7 +243,10 @@ int cfg80211_mgd_wext_giwessid(struct neif (ie) { data->flags =1 ; data->length = ie[1 ]; -memcpy (ssid, ie +2 , data->length); +if (data->length >IW_ESSID_MAX_SIZE ) + ret = -EINVAL ; +else +memcpy (ssid, ie +2 , data->length); }rcu_read_unlock (); }else if (wdev->wext.connect.ssid && wdev->wext.connect.ssid_len) {
@@ -252,7 +256,7 @@ int cfg80211_mgd_wext_giwessid(struct ne }wdev_unlock (wdev); -return 0 ; +return ret; } int cfg80211_mgd_wext_siwap(struct net_device *dev,
PATCH 25/25 rtlwifi: Fix potential overflow on P2P code
In reply to Ben Hutchings3.16.77-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Laura Abbott <[email protected]>
commit 8c55dedb795be8ec0cf488f98c03a1c2176f7fb1 upstream.
Nicolas Waisman noticed that even though noa_len is checked for a compatible length it's still possible to overrun the buffers of p2pinfo since there's no check on the upper bound of noa_num. Bound noa_num against P2P_MAX_NOA_NUM.
--- drivers/net/wireless/rtlwifi/ps.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/net/wireless/rtlwifi/ps.c +6 -0
@@ -801,6 +801,9 @@ static void rtl_p2p_noa_ie(struct ieee80return ; }else { noa_num = (noa_len -2 ) /13 ; +if (noa_num >P2P_MAX_NOA_NUM ) + noa_num =P2P_MAX_NOA_NUM ; + } noa_index = ie[3 ]; if (rtlpriv->psc.p2p_ps_info.p2p_ps_mode ==
@@ -895,6 +898,9 @@ static void rtl_p2p_action_ie(struct ieereturn ; }else { noa_num = (noa_len -2 ) /13 ; +if (noa_num >P2P_MAX_NOA_NUM ) + noa_num =P2P_MAX_NOA_NUM ; + } noa_index = ie[3 ]; if (rtlpriv->psc.p2p_ps_info.p2p_ps_mode ==
Quoted 8 lines · Ben Hutchings
This is the start of the stable review cycle for the 3.16.77 release. There are 25 patches in this series, which will be posted as responses to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Fri Nov 15 00:00:00 UTC 2019. Anything received after that time might be too late.
Build results:
total: 136 pass: 136 fail: 0 Qemu test results: total: 229 pass: 229 fail: 0
Guenter
Quoted 6 lines · Guenter Roeck
Quoted 5 lines · Ben Hutchings
This is the start of the stable review cycle for the 3.16.77 release. There are 25 patches in this series, which will be posted as responses to this one. If anyone has any issues with these being applied, please let me know.
Quoted 8 lines
Quoted 3 lines
Responses should be made by Fri Nov 15 00:00:00 UTC 2019. Anything received after that time might be too late.
Build results:
total: 136 pass: 136 fail: 0 Qemu test results: total: 229 pass: 229 fail: 0
Great, thanks for testing,
Ben.
Signature · 2 lines
Ben Hutchings Anthony's Law of Force: Don't force it, get a larger hammer.