On 21.01.2018 02:23, Linus Torvalds wrote:
> On Sat, Jan 20, 2018 at 5:14 PM, Laura Abbott <labbott(a)redhat.com> wrote:
>>
>> I hadn't seen this picked up yet so sending explicitly
>
> Ingo, I just took this directly as a patch.
Added stable to CC since the patch series this patch fixes
is in stable-queue.
Regards,
Gabriel C
This is a note to let you know that I've just added the patch titled
x86: Use __nostackprotect for sme_encrypt_kernel
to the 4.14-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=sum…
The filename of the patch is:
x86-use-__nostackprotect-for-sme_encrypt_kernel.patch
and it can be found in the queue-4.14 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree,
please let <stable(a)vger.kernel.org> know about it.
>From 91cfc88c66bf8ab95937606569670cf67fa73e09 Mon Sep 17 00:00:00 2001
From: Laura Abbott <labbott(a)redhat.com>
Date: Sat, 20 Jan 2018 17:14:02 -0800
Subject: x86: Use __nostackprotect for sme_encrypt_kernel
From: Laura Abbott <labbott(a)redhat.com>
commit 91cfc88c66bf8ab95937606569670cf67fa73e09 upstream.
Commit bacf6b499e11 ("x86/mm: Use a struct to reduce parameters for SME
PGD mapping") moved some parameters into a structure.
The structure was large enough to trigger the stack protection canary in
sme_encrypt_kernel which doesn't work this early, causing reboots.
Mark sme_encrypt_kernel appropriately to not use the canary.
Fixes: bacf6b499e11 ("x86/mm: Use a struct to reduce parameters for SME PGD mapping")
Signed-off-by: Laura Abbott <labbott(a)redhat.com>
Cc: Tom Lendacky <thomas.lendacky(a)amd.com>
Cc: Ingo Molnar <mingo(a)kernel.org>
Signed-off-by: Linus Torvalds <torvalds(a)linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh(a)linuxfoundation.org>
---
arch/x86/mm/mem_encrypt.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/arch/x86/mm/mem_encrypt.c
+++ b/arch/x86/mm/mem_encrypt.c
@@ -487,7 +487,7 @@ static unsigned long __init sme_pgtable_
return total;
}
-void __init sme_encrypt_kernel(struct boot_params *bp)
+void __init __nostackprotector sme_encrypt_kernel(struct boot_params *bp)
{
unsigned long workarea_start, workarea_end, workarea_len;
unsigned long execute_start, execute_end, execute_len;
Patches currently in stable-queue which might be from labbott(a)redhat.com are
queue-4.14/x86-use-__nostackprotect-for-sme_encrypt_kernel.patch
This is the start of the stable review cycle for the 4.4.108 release.
There are 78 patches in this series, all will be posted as a response
to this one. If anyone has any issues with these being applied, please
let me know.
Responses should be made by Sun Dec 24 08:45:30 UTC 2017.
Anything received after that time might be too late.
The whole patch series can be found in one patch at:
kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.4.108-rc1.gz
or in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-4.4.y
and the diffstat can be found below.
thanks,
greg k-h
-------------
Pseudo-Shortlog of commits:
Greg Kroah-Hartman <gregkh(a)linuxfoundation.org>
Linux 4.4.108-rc1
Takashi Iwai <tiwai(a)suse.de>
ALSA: hda - Fix yet another i915 pointer leftover in error path
Takashi Iwai <tiwai(a)suse.de>
ALSA: hda - Degrade i915 binding failure message
Takashi Iwai <tiwai(a)suse.de>
ALSA: hda - Clear the leftover component assignment at snd_hdac_i915_exit()
Greg Kroah-Hartman <gregkh(a)linuxfoundation.org>
Revert "Bluetooth: btusb: driver to enable the usb-wakeup feature"
Aleksandar Markovic <aleksandar.markovic(a)mips.com>
MIPS: math-emu: Fix final emulation phase for certain instructions
Arvind Yadav <arvind.yadav.cs(a)gmail.com>
thermal: hisilicon: Handle return value of clk_prepare_enable
Nicholas Piggin <npiggin(a)gmail.com>
cpuidle: fix broadcast control when broadcast can not be entered
Alexandre Belloni <alexandre.belloni(a)free-electrons.com>
rtc: set the alarm to the next expiring timer
Hoang Tran <tranviethoang.vn(a)gmail.com>
tcp: fix under-evaluated ssthresh in TCP Vegas
Jacob Keller <jacob.e.keller(a)intel.com>
fm10k: ensure we process SM mbx when processing VF mbx
Dick Kennedy <dick.kennedy(a)broadcom.com>
scsi: lpfc: PLOGI failures during NPIV testing
Dick Kennedy <dick.kennedy(a)broadcom.com>
scsi: lpfc: Fix secure firmware updates
Gabriele Paoloni <gabriele.paoloni(a)huawei.com>
PCI/AER: Report non-fatal errors only to the affected endpoint
Emil Tantilov <emil.s.tantilov(a)intel.com>
ixgbe: fix use of uninitialized padding
Christophe JAILLET <christophe.jaillet(a)wanadoo.fr>
igb: check memory allocation failure
Stuart Hayes <stuart.w.hayes(a)gmail.com>
PCI: Create SR-IOV virtfn/physfn links before attaching driver
Sreekanth Reddy <sreekanth.reddy(a)broadcom.com>
scsi: mpt3sas: Fix IO error occurs on pulling out a drive from RAID1 volume created on two SATA drive
Varun Prakash <varun(a)chelsio.com>
scsi: cxgb4i: fix Tx skb leak
David Daney <david.daney(a)cavium.com>
PCI: Avoid bus reset if bridge itself is broken
Dan Murphy <dmurphy(a)ti.com>
net: phy: at803x: Change error to EINVAL for invalid MAC
Russell King <rmk+kernel(a)armlinux.org.uk>
rtc: pl031: make interrupt optional
Christian Lamparter <chunkeey(a)gmail.com>
crypto: crypto4xx - increase context and scatter ring buffer elements
Derek Basehore <dbasehore(a)chromium.org>
backlight: pwm_bl: Fix overflow condition
Sankar Patchineelam <sankar.patchineelam(a)broadcom.com>
bnxt_en: Fix NULL pointer dereference in reopen failure path
Vaidyanathan Srinivasan <svaidy(a)linux.vnet.ibm.com>
cpuidle: powernv: Pass correct drv->cpumask for registration
Russell King <rmk+kernel(a)armlinux.org.uk>
ARM: dma-mapping: disallow dma_get_sgtable() for non-kernel managed memory
Liping Zhang <zlpnobody(a)gmail.com>
netfilter: nfnetlink_queue: fix secctx memory leak
Adam Wallis <awallis(a)codeaurora.org>
xhci: plat: Register shutdown for xhci_plat
Arnd Bergmann <arnd(a)arndb.de>
isdn: kcapi: avoid uninitialized data
Herongguang (Stephen) <herongguang.he(a)huawei.com>
KVM: pci-assign: do not map smm memory slot pages in vt-d page tables
Reizer, Eyal <eyalr(a)ti.com>
ARM: dts: am335x-evmsk: adjust mmc2 param to allow suspend
Gao Feng <fgao(a)ikuai8.com>
netfilter: nf_nat_snmp: Fix panic when snmp_trap_helper fails to register
Liping Zhang <zlpnobody(a)gmail.com>
netfilter: nfnl_cthelper: fix a race when walk the nf_ct_helper_hash table
Alexey Khoroshilov <khoroshilov(a)ispras.ru>
irda: vlsi_ir: fix check for DMA mapping errors
Sagi Grimberg <sagi(a)grimberg.me>
RDMA/iser: Fix possible mr leak on device removal event
Alexander Duyck <alexander.h.duyck(a)intel.com>
i40e: Do not enable NAPI on q_vectors that have no rings
Alexander Duyck <alexander.h.duyck(a)intel.com>
net: Do not allow negative values for busy_read and busy_poll sysctl interfaces
Arnd Bergmann <arnd(a)arndb.de>
bna: avoid writing uninitialized data into hw registers
Julian Wiedmann <jwi(a)linux.vnet.ibm.com>
s390/qeth: no ETH header for outbound AF_IUCV
hayeswang <hayeswang(a)realtek.com>
r8152: prevent the driver from transmitting packets with carrier off
Peter Stein <peter(a)stuntstein.dk>
HID: xinmo: fix for out of range for THT 2P arcade controller.
Mike Looijmans <mike.looijmans(a)topic.nl>
i2c: mux: pca954x: Add missing pca9546 definition to chip_desc
Arnd Bergmann <arnd(a)arndb.de>
hwmon: (asus_atk0110) fix uninitialized data access
Rob Herring <robh(a)kernel.org>
ARM: dts: ti: fix PCI bus dtc warnings
Wanpeng Li <wanpeng.li(a)hotmail.com>
KVM: VMX: Fix enable VPID conditions
Wanpeng Li <wanpeng.li(a)hotmail.com>
KVM: x86: correct async page present tracepoint
Dick Kennedy <dick.kennedy(a)broadcom.com>
scsi: lpfc: Fix PT2PT PRLI reject
Patrice Chotard <patrice.chotard(a)st.com>
pinctrl: st: add irq_request/release_resources callbacks
Eric Dumazet <edumazet(a)google.com>
inet: frag: release spinlock before calling icmp_send()
Jeffy Chen <jeffy.chen(a)rock-chips.com>
netfilter: nfnl_cthelper: Fix memory leak
Pablo Neira Ayuso <pablo(a)netfilter.org>
netfilter: nfnl_cthelper: fix runtime expectation policy updates
Gustavo A. R. Silva <garsilva(a)embeddedor.com>
usb: gadget: udc: remove pointer dereference after free
Roger Quadros <rogerq(a)ti.com>
usb: gadget: f_uvc: Sanity check wMaxPacketSize for SuperSpeed
Tony Lindgren <tony(a)atomide.com>
net: qmi_wwan: Add USB IDs for MDM6600 modem on Motorola Droid 4
Dan Carpenter <dan.carpenter(a)oracle.com>
bna: integer overflow bug in debugfs
Eric Dumazet <edumazet(a)google.com>
sch_dsmark: fix invalid skb_cow() usage
Herbert Xu <herbert(a)gondor.apana.org.au>
crypto: deadlock between crypto_alg_sem/rtnl_mutex/genl_mutex
hayeswang <hayeswang(a)realtek.com>
r8152: fix the list rx_done may be used without initialization
Vaidyanathan Srinivasan <svaidy(a)linux.vnet.ibm.com>
cpuidle: Validate cpu_dev in cpuidle_add_sysfs()
Jon Medhurst <tixy(a)linaro.org>
arm: kprobes: Align stack to 8-bytes in test code
Masami Hiramatsu <mhiramat(a)kernel.org>
arm: kprobes: Fix the return address of multiple kretprobes
Jaroslav Kysela <perex(a)perex.cz>
ALSA: hda - add support for docking station for HP 840 G3
Jaroslav Kysela <perex(a)perex.cz>
ALSA: hda - add support for docking station for HP 820 G2
Aaron Lu <aaron.lu(a)intel.com>
x86/irq: Do not substract irq_tlb_count from irq_call_count
Andy Lutomirski <luto(a)kernel.org>
sched/core: Idle_task_exit() shouldn't use switch_mm_irqs_off()
Steven Rostedt <rostedt(a)goodmis.org>
ARM: Hide finish_arch_post_lock_switch() from modules
Andy Lutomirski <luto(a)kernel.org>
x86/mm, sched/core: Turn off IRQs in switch_mm()
Andy Lutomirski <luto(a)kernel.org>
x86/mm, sched/core: Uninline switch_mm()
Andy Lutomirski <luto(a)kernel.org>
x86/mm: Build arch/x86/mm/tlb.c even on !SMP
Andy Lutomirski <luto(a)kernel.org>
sched/core: Add switch_mm_irqs_off() and use it in the scheduler
Ingo Molnar <mingo(a)kernel.org>
mm/mmu_context, sched/core: Fix mmu_context.h assumption
Nadav Amit <namit(a)vmware.com>
mm/rmap: batched invalidations should use existing api
Andy Lutomirski <luto(a)kernel.org>
x86/mm: If INVPCID is available, use it to flush global mappings
Andy Lutomirski <luto(a)kernel.org>
x86/mm: Add a 'noinvpcid' boot option to turn off INVPCID
Borislav Petkov <bp(a)suse.de>
x86/mm: Fix INVPCID asm constraint
Andy Lutomirski <luto(a)kernel.org>
x86/mm: Add INVPCID helpers
Vaibhav Jain <vaibhav(a)linux.vnet.ibm.com>
cxl: Check if vphb exists before iterating over AFU devices
Steve Capper <steve.capper(a)arm.com>
arm64: Initialise high_memory global variable earlier
-------------
Diffstat:
Documentation/kernel-parameters.txt | 2 +
Makefile | 4 +-
arch/arm/boot/dts/am335x-evmsk.dts | 1 +
arch/arm/boot/dts/dra7.dtsi | 2 +
arch/arm/include/asm/mmu_context.h | 2 +
arch/arm/mm/dma-mapping.c | 20 +-
arch/arm/probes/kprobes/core.c | 24 ++-
arch/arm/probes/kprobes/test-core.c | 11 +-
arch/arm64/mm/init.c | 2 +-
arch/mips/math-emu/cp1emu.c | 28 +--
arch/x86/include/asm/hardirq.h | 4 -
arch/x86/include/asm/mmu_context.h | 101 +--------
arch/x86/include/asm/tlbflush.h | 63 +++++-
arch/x86/kernel/cpu/common.c | 16 ++
arch/x86/kernel/irq.c | 3 +-
arch/x86/kvm/vmx.c | 9 +-
arch/x86/kvm/x86.c | 2 +-
arch/x86/mm/Makefile | 3 +-
arch/x86/mm/tlb.c | 118 ++++++++++-
drivers/bluetooth/btusb.c | 5 -
drivers/cpuidle/cpuidle-powernv.c | 18 ++
drivers/cpuidle/cpuidle.c | 1 +
drivers/cpuidle/sysfs.c | 12 ++
drivers/crypto/amcc/crypto4xx_core.h | 10 +-
drivers/hid/hid-core.c | 1 +
drivers/hid/hid-ids.h | 1 +
drivers/hid/hid-xinmo.c | 1 +
drivers/hwmon/asus_atk0110.c | 3 +
drivers/i2c/muxes/i2c-mux-pca954x.c | 6 +-
drivers/infiniband/ulp/iser/iscsi_iser.h | 2 +
drivers/infiniband/ulp/iser/iser_verbs.c | 8 +-
drivers/isdn/capi/kcapi.c | 1 +
drivers/misc/cxl/pci.c | 13 ++
drivers/net/ethernet/broadcom/bnxt/bnxt.c | 13 ++
drivers/net/ethernet/brocade/bna/bfa_ioc.c | 10 +-
drivers/net/ethernet/brocade/bna/bnad_debugfs.c | 2 +-
drivers/net/ethernet/intel/fm10k/fm10k_iov.c | 3 +
drivers/net/ethernet/intel/i40e/i40e_main.c | 16 +-
drivers/net/ethernet/intel/igb/igb_main.c | 2 +
drivers/net/ethernet/intel/ixgbe/ixgbe_common.c | 4 +-
drivers/net/ethernet/intel/ixgbe/ixgbe_x550.c | 2 +
drivers/net/irda/vlsi_ir.c | 8 +-
drivers/net/phy/at803x.c | 2 +-
drivers/net/usb/qmi_wwan.c | 4 +
drivers/net/usb/r8152.c | 19 +-
drivers/pci/iov.c | 3 +-
drivers/pci/pci.c | 4 +
drivers/pci/pcie/aer/aerdrv_core.c | 9 +-
drivers/pinctrl/pinctrl-st.c | 30 ++-
drivers/rtc/interface.c | 2 +-
drivers/rtc/rtc-pl031.c | 14 +-
drivers/s390/net/qeth_l3_main.c | 15 +-
drivers/scsi/cxgbi/cxgb4i/cxgb4i.c | 1 +
drivers/scsi/lpfc/lpfc_els.c | 3 +-
drivers/scsi/lpfc/lpfc_hbadisc.c | 3 +-
drivers/scsi/lpfc/lpfc_hw4.h | 2 +-
drivers/scsi/mpt3sas/mpt3sas_scsih.c | 5 +
drivers/thermal/hisi_thermal.c | 5 +-
drivers/usb/gadget/function/f_uvc.c | 8 +
drivers/usb/gadget/udc/pch_udc.c | 1 -
drivers/usb/host/xhci-plat.c | 1 +
drivers/video/backlight/pwm_bl.c | 7 +-
include/linux/mmu_context.h | 7 +
kernel/sched/core.c | 4 +-
mm/mmu_context.c | 2 +-
mm/rmap.c | 28 +--
net/core/sysctl_net_core.c | 6 +-
net/ipv4/ip_fragment.c | 25 ++-
net/ipv4/netfilter/nf_nat_snmp_basic.c | 19 +-
net/ipv4/tcp_vegas.c | 2 +-
net/netfilter/nfnetlink_cthelper.c | 267 +++++++++++++++---------
net/netfilter/nfnetlink_queue.c | 9 +-
net/netlink/af_netlink.c | 41 ++++
net/sched/sch_dsmark.c | 10 +-
sound/hda/hdac_i915.c | 4 +-
sound/pci/hda/hda_intel.c | 6 +-
sound/pci/hda/patch_conexant.c | 11 +
sound/pci/hda/patch_realtek.c | 14 +-
virt/kvm/kvm_main.c | 2 +-
79 files changed, 793 insertions(+), 359 deletions(-)
Changes since v3 [1]
* Drop 'ifence_array_ptr' and associated compile-time + run-time
switching and just use the masking approach all the time.
* Convert 'get_user' to use pointer sanitization via masking rather than
lfence. '__get_user' and associated paths still rely on
lfence. (Linus)
"Basically, the rule is trivial: find all 'stac' users, and use
address masking if those users already integrate the limit
check, and lfence they don't."
* At syscall entry sanitize the syscall number under speculation
to remove a user controlled pointer de-reference in kernel
space. (Linus)
* Fix a raw lfence in the kvm code (added for v4.15-rc8) to use
'array_ptr'.
* Propose 'array_idx' as a way to sanitize user input that is
later used as an array index, but where the validation is
happening in a different code block than the array reference.
(Christian).
* Fix grammar in speculation.txt (Kees)
---
Quoting Mark's original RFC:
"Recently, Google Project Zero discovered several classes of attack
against speculative execution. One of these, known as variant-1, allows
explicit bounds checks to be bypassed under speculation, providing an
arbitrary read gadget. Further details can be found on the GPZ blog [2]
and the Documentation patch in this series."
A precondition of using this attack on the kernel is to get a user
controlled pointer de-referenced (under speculation) in privileged code.
The primary source of user controlled pointers in the kernel is the
arguments passed to 'get_user' and '__get_user'. An example of other
user controlled pointers are user-controlled array / pointer offsets.
Better tooling is needed to find more arrays / pointers with user
controlled indices / offsets that can be converted to use 'array_ptr' or
'array_idx'. A few are included in this set, and these are not expected
to be complete. That said, the 'get_user' protections raise the bar on
finding a vulnerable gadget in the kernel.
These patches are also available via the 'nospec-v4' git branch here:
git://git.kernel.org/pub/scm/linux/kernel/git/djbw/linux nospec-v4
Note that the BPF fix for Spectre variant1 is merged for 4.15-rc8.
[2]: https://googleprojectzero.blogspot.co.uk/2018/01/reading-privileged-memory-…
---
Dan Williams (9):
asm/nospec, array_ptr: sanitize speculative array de-references
x86: implement array_ptr_mask()
x86: introduce __uaccess_begin_nospec and ifence
x86, __get_user: use __uaccess_begin_nospec
x86, get_user: use pointer masking to limit speculation
x86: narrow out of bounds syscalls to sys_read under speculation
vfs, fdtable: prevent bounds-check bypass via speculative execution
kvm, x86: fix spectre-v1 mitigation
nl80211: sanitize array index in parse_txq_params
Mark Rutland (1):
Documentation: document array_ptr
Documentation/speculation.txt | 143 +++++++++++++++++++++++++++++++++++++
arch/x86/entry/entry_64.S | 2 +
arch/x86/include/asm/barrier.h | 28 +++++++
arch/x86/include/asm/msr.h | 3 -
arch/x86/include/asm/smap.h | 24 ++++++
arch/x86/include/asm/uaccess.h | 15 +++-
arch/x86/include/asm/uaccess_32.h | 6 +-
arch/x86/include/asm/uaccess_64.h | 12 ++-
arch/x86/kvm/vmx.c | 19 ++---
arch/x86/lib/getuser.S | 5 +
arch/x86/lib/usercopy_32.c | 8 +-
include/linux/fdtable.h | 7 +-
include/linux/nospec.h | 65 +++++++++++++++++
net/wireless/nl80211.c | 10 ++-
14 files changed, 312 insertions(+), 35 deletions(-)
create mode 100644 Documentation/speculation.txt
create mode 100644 include/linux/nospec.h
This is a note to let you know that I've just added the patch titled
workqueue: avoid hard lockups in show_workqueue_state()
to the 4.9-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=sum…
The filename of the patch is:
workqueue-avoid-hard-lockups-in-show_workqueue_state.patch
and it can be found in the queue-4.9 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree,
please let <stable(a)vger.kernel.org> know about it.
>From 62635ea8c18f0f62df4cc58379e4f1d33afd5801 Mon Sep 17 00:00:00 2001
From: Sergey Senozhatsky <sergey.senozhatsky.work(a)gmail.com>
Date: Thu, 11 Jan 2018 09:53:35 +0900
Subject: workqueue: avoid hard lockups in show_workqueue_state()
From: Sergey Senozhatsky <sergey.senozhatsky.work(a)gmail.com>
commit 62635ea8c18f0f62df4cc58379e4f1d33afd5801 upstream.
show_workqueue_state() can print out a lot of messages while being in
atomic context, e.g. sysrq-t -> show_workqueue_state(). If the console
device is slow it may end up triggering NMI hard lockup watchdog.
Signed-off-by: Sergey Senozhatsky <sergey.senozhatsky(a)gmail.com>
Signed-off-by: Tejun Heo <tj(a)kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh(a)linuxfoundation.org>
---
kernel/workqueue.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
--- a/kernel/workqueue.c
+++ b/kernel/workqueue.c
@@ -48,6 +48,7 @@
#include <linux/nodemask.h>
#include <linux/moduleparam.h>
#include <linux/uaccess.h>
+#include <linux/nmi.h>
#include "workqueue_internal.h"
@@ -4424,6 +4425,12 @@ void show_workqueue_state(void)
if (pwq->nr_active || !list_empty(&pwq->delayed_works))
show_pwq(pwq);
spin_unlock_irqrestore(&pwq->pool->lock, flags);
+ /*
+ * We could be printing a lot from atomic context, e.g.
+ * sysrq-t -> show_workqueue_state(). Avoid triggering
+ * hard lockup.
+ */
+ touch_nmi_watchdog();
}
}
@@ -4451,6 +4458,12 @@ void show_workqueue_state(void)
pr_cont("\n");
next_pool:
spin_unlock_irqrestore(&pool->lock, flags);
+ /*
+ * We could be printing a lot from atomic context, e.g.
+ * sysrq-t -> show_workqueue_state(). Avoid triggering
+ * hard lockup.
+ */
+ touch_nmi_watchdog();
}
rcu_read_unlock_sched();
Patches currently in stable-queue which might be from sergey.senozhatsky.work(a)gmail.com are
queue-4.9/workqueue-avoid-hard-lockups-in-show_workqueue_state.patch
This is a note to let you know that I've just added the patch titled
tracing: Fix converting enum's from the map in trace_event_eval_update()
to the 4.9-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=sum…
The filename of the patch is:
tracing-fix-converting-enum-s-from-the-map-in-trace_event_eval_update.patch
and it can be found in the queue-4.9 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree,
please let <stable(a)vger.kernel.org> know about it.
>From 1ebe1eaf2f02784921759992ae1fde1a9bec8fd0 Mon Sep 17 00:00:00 2001
From: "Steven Rostedt (VMware)" <rostedt(a)goodmis.org>
Date: Thu, 18 Jan 2018 15:53:10 -0500
Subject: tracing: Fix converting enum's from the map in trace_event_eval_update()
From: Steven Rostedt (VMware) <rostedt(a)goodmis.org>
commit 1ebe1eaf2f02784921759992ae1fde1a9bec8fd0 upstream.
Since enums do not get converted by the TRACE_EVENT macro into their values,
the event format displaces the enum name and not the value. This breaks
tools like perf and trace-cmd that need to interpret the raw binary data. To
solve this, an enum map was created to convert these enums into their actual
numbers on boot up. This is done by TRACE_EVENTS() adding a
TRACE_DEFINE_ENUM() macro.
Some enums were not being converted. This was caused by an optization that
had a bug in it.
All calls get checked against this enum map to see if it should be converted
or not, and it compares the call's system to the system that the enum map
was created under. If they match, then they call is processed.
To cut down on the number of iterations needed to find the maps with a
matching system, since calls and maps are grouped by system, when a match is
made, the index into the map array is saved, so that the next call, if it
belongs to the same system as the previous call, could start right at that
array index and not have to scan all the previous arrays.
The problem was, the saved index was used as the variable to know if this is
a call in a new system or not. If the index was zero, it was assumed that
the call is in a new system and would keep incrementing the saved index
until it found a matching system. The issue arises when the first matching
system was at index zero. The next map, if it belonged to the same system,
would then think it was the first match and increment the index to one. If
the next call belong to the same system, it would begin its search of the
maps off by one, and miss the first enum that should be converted. This left
a single enum not converted properly.
Also add a comment to describe exactly what that index was for. It took me a
bit too long to figure out what I was thinking when debugging this issue.
Link: http://lkml.kernel.org/r/717BE572-2070-4C1E-9902-9F2E0FEDA4F8@oracle.com
Fixes: 0c564a538aa93 ("tracing: Add TRACE_DEFINE_ENUM() macro to map enums to their values")
Reported-by: Chuck Lever <chuck.lever(a)oracle.com>
Teste-by: Chuck Lever <chuck.lever(a)oracle.com>
Signed-off-by: Steven Rostedt (VMware) <rostedt(a)goodmis.org>
Signed-off-by: Greg Kroah-Hartman <gregkh(a)linuxfoundation.org>
---
kernel/trace/trace_events.c | 16 +++++++++++++++-
1 file changed, 15 insertions(+), 1 deletion(-)
--- a/kernel/trace/trace_events.c
+++ b/kernel/trace/trace_events.c
@@ -2200,6 +2200,7 @@ void trace_event_enum_update(struct trac
{
struct trace_event_call *call, *p;
const char *last_system = NULL;
+ bool first = false;
int last_i;
int i;
@@ -2207,15 +2208,28 @@ void trace_event_enum_update(struct trac
list_for_each_entry_safe(call, p, &ftrace_events, list) {
/* events are usually grouped together with systems */
if (!last_system || call->class->system != last_system) {
+ first = true;
last_i = 0;
last_system = call->class->system;
}
+ /*
+ * Since calls are grouped by systems, the likelyhood that the
+ * next call in the iteration belongs to the same system as the
+ * previous call is high. As an optimization, we skip seaching
+ * for a map[] that matches the call's system if the last call
+ * was from the same system. That's what last_i is for. If the
+ * call has the same system as the previous call, then last_i
+ * will be the index of the first map[] that has a matching
+ * system.
+ */
for (i = last_i; i < len; i++) {
if (call->class->system == map[i]->system) {
/* Save the first system if need be */
- if (!last_i)
+ if (first) {
last_i = i;
+ first = false;
+ }
update_event_printk(call, map[i]);
}
}
Patches currently in stable-queue which might be from rostedt(a)goodmis.org are
queue-4.9/sched-deadline-zero-out-positive-runtime-after-throttling-constrained-tasks.patch
queue-4.9/tracing-fix-converting-enum-s-from-the-map-in-trace_event_eval_update.patch
This is a note to let you know that I've just added the patch titled
scripts/gdb/linux/tasks.py: fix get_thread_info
to the 4.9-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=sum…
The filename of the patch is:
scripts-gdb-linux-tasks.py-fix-get_thread_info.patch
and it can be found in the queue-4.9 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree,
please let <stable(a)vger.kernel.org> know about it.
>From 883d50f56d263f70fd73c0d96b09eb36c34e9305 Mon Sep 17 00:00:00 2001
From: Xi Kangjie <imxikangjie(a)gmail.com>
Date: Thu, 18 Jan 2018 16:34:00 -0800
Subject: scripts/gdb/linux/tasks.py: fix get_thread_info
From: Xi Kangjie <imxikangjie(a)gmail.com>
commit 883d50f56d263f70fd73c0d96b09eb36c34e9305 upstream.
Since kernel 4.9, the thread_info has been moved into task_struct, no
longer locates at the bottom of kernel stack.
See commits c65eacbe290b ("sched/core: Allow putting thread_info into
task_struct") and 15f4eae70d36 ("x86: Move thread_info into
task_struct").
Before fix:
(gdb) set $current = $lx_current()
(gdb) p $lx_thread_info($current)
$1 = {flags = 1470918301}
(gdb) p $current.thread_info
$2 = {flags = 2147483648}
After fix:
(gdb) p $lx_thread_info($current)
$1 = {flags = 2147483648}
(gdb) p $current.thread_info
$2 = {flags = 2147483648}
Link: http://lkml.kernel.org/r/20180118210159.17223-1-imxikangjie@gmail.com
Fixes: 15f4eae70d36 ("x86: Move thread_info into task_struct")
Signed-off-by: Xi Kangjie <imxikangjie(a)gmail.com>
Acked-by: Jan Kiszka <jan.kiszka(a)siemens.com>
Acked-by: Kieran Bingham <kbingham(a)kernel.org>
Signed-off-by: Andrew Morton <akpm(a)linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds(a)linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh(a)linuxfoundation.org>
---
scripts/gdb/linux/tasks.py | 2 ++
1 file changed, 2 insertions(+)
--- a/scripts/gdb/linux/tasks.py
+++ b/scripts/gdb/linux/tasks.py
@@ -96,6 +96,8 @@ def get_thread_info(task):
thread_info_addr = task.address + ia64_task_size
thread_info = thread_info_addr.cast(thread_info_ptr_type)
else:
+ if task.type.fields()[0].type == thread_info_type.get_type():
+ return task['thread_info']
thread_info = task['stack'].cast(thread_info_ptr_type)
return thread_info.dereference()
Patches currently in stable-queue which might be from imxikangjie(a)gmail.com are
queue-4.9/scripts-gdb-linux-tasks.py-fix-get_thread_info.patch
This is a note to let you know that I've just added the patch titled
phy: work around 'phys' references to usb-nop-xceiv devices
to the 4.9-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=sum…
The filename of the patch is:
phy-work-around-phys-references-to-usb-nop-xceiv-devices.patch
and it can be found in the queue-4.9 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree,
please let <stable(a)vger.kernel.org> know about it.
>From b7563e2796f8b23c98afcfea7363194227fa089d Mon Sep 17 00:00:00 2001
From: Arnd Bergmann <arnd(a)arndb.de>
Date: Fri, 12 Jan 2018 11:12:05 +0100
Subject: phy: work around 'phys' references to usb-nop-xceiv devices
From: Arnd Bergmann <arnd(a)arndb.de>
commit b7563e2796f8b23c98afcfea7363194227fa089d upstream.
Stefan Wahren reports a problem with a warning fix that was merged
for v4.15: we had lots of device nodes with a 'phys' property pointing
to a device node that is not compliant with the binding documented in
Documentation/devicetree/bindings/phy/phy-bindings.txt
This generally works because USB HCD drivers that support both the generic
phy subsystem and the older usb-phy subsystem ignore most errors from
phy_get() and related calls and then use the usb-phy driver instead.
However, it turns out that making the usb-nop-xceiv device compatible with
the generic-phy binding changes the phy_get() return code from -EINVAL to
-EPROBE_DEFER, and the dwc2 usb controller driver for bcm2835 now returns
-EPROBE_DEFER from its probe function rather than ignoring the failure,
breaking all USB support on raspberry-pi when CONFIG_GENERIC_PHY is
enabled. The same code is used in the dwc3 driver and the usb_add_hcd()
function, so a reasonable assumption would be that many other platforms
are affected as well.
I have reviewed all the related patches and concluded that "usb-nop-xceiv"
is the only USB phy that is affected by the change, and since it is by far
the most commonly referenced phy, all the other USB phy drivers appear
to be used in ways that are are either safe in DT (they don't use the
'phys' property), or in the driver (they already ignore -EPROBE_DEFER
from generic-phy when usb-phy is available).
To work around the problem, this adds a special case to _of_phy_get()
so we ignore any PHY node that is compatible with "usb-nop-xceiv",
as we know that this can never load no matter how much we defer. In the
future, we might implement a generic-phy driver for "usb-nop-xceiv"
and then remove this workaround.
Since we generally want older kernels to also want to work with the
fixed devicetree files, it would be good to backport the patch into
stable kernels as well (3.13+ are possibly affected), even though they
don't contain any of the patches that may have caused regressions.
Fixes: 014d6da6cb25 ARM: dts: bcm283x: Fix DTC warnings about missing phy-cells
Fixes: c5bbf358b790 arm: dts: nspire: Add missing #phy-cells to usb-nop-xceiv
Fixes: 44e5dced2ef6 arm: dts: marvell: Add missing #phy-cells to usb-nop-xceiv
Fixes: f568f6f554b8 ARM: dts: omap: Add missing #phy-cells to usb-nop-xceiv
Fixes: d745d5f277bf ARM: dts: imx51-zii-rdu1: Add missing #phy-cells to usb-nop-xceiv
Fixes: 915fbe59cbf2 ARM: dts: imx: Add missing #phy-cells to usb-nop-xceiv
Link: https://marc.info/?l=linux-usb&m=151518314314753&w=2
Link: https://patchwork.kernel.org/patch/10158145/
Cc: Felipe Balbi <balbi(a)kernel.org>
Cc: Eric Anholt <eric(a)anholt.net>
Tested-by: Stefan Wahren <stefan.wahren(a)i2se.com>
Acked-by: Rob Herring <robh(a)kernel.org>
Tested-by: Hans Verkuil <hans.verkuil(a)cisco.com>
Acked-by: Kishon Vijay Abraham I <kishon(a)ti.com>
Signed-off-by: Arnd Bergmann <arnd(a)arndb.de>
Signed-off-by: Greg Kroah-Hartman <gregkh(a)linuxfoundation.org>
---
drivers/phy/phy-core.c | 4 ++++
1 file changed, 4 insertions(+)
--- a/drivers/phy/phy-core.c
+++ b/drivers/phy/phy-core.c
@@ -395,6 +395,10 @@ static struct phy *_of_phy_get(struct de
if (ret)
return ERR_PTR(-ENODEV);
+ /* This phy type handled by the usb-phy subsystem for now */
+ if (of_device_is_compatible(args.np, "usb-nop-xceiv"))
+ return ERR_PTR(-ENODEV);
+
mutex_lock(&phy_provider_mutex);
phy_provider = of_phy_provider_lookup(args.np);
if (IS_ERR(phy_provider) || !try_module_get(phy_provider->owner)) {
Patches currently in stable-queue which might be from arnd(a)arndb.de are
queue-4.9/phy-work-around-phys-references-to-usb-nop-xceiv-devices.patch
queue-4.9/arm-sunxi_defconfig-enable-cma.patch