4.4.37-stable review
Greg Kroah-Hartman
maintainercover 4.4.37-stable review
This is the start of the stable review cycle for the 4.4.37 release. There are 13 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 Fri Dec 9 07:07:03 UTC 2016. 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.37-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 <[email protected]>
Linux 4.4.37-rc1
James Morse <[email protected]>
arm64: suspend: Reconfigure PSTATE after resume from idle
James Morse <[email protected]>
arm64: mm: Set PSTATE.PAN from the cpu_enable_pan() call
James Morse <[email protected]>
arm64: cpufeature: Schedule enable() calls instead of calling them via IPI
Johan Hovold <[email protected]>
pwm: Fix device reference leak
Brian Norris <[email protected]>
mwifiex: printk() overflow with 32-byte SSIDs
Johannes Thumshirn <[email protected]>
PCI: Set Read Completion Boundary to 128 iff Root Port supports it (_HPX)
Johannes Thumshirn <[email protected]>
PCI: Export pcie_find_root_port
Ding Tianhong <[email protected]>
rcu: Fix soft lockup for rcu_nocb_kthread
Takashi Iwai <[email protected]>
ALSA: pcm : Call kill_fasync() in stream lock
Andy Lutomirski <[email protected]>
x86/traps: Ignore high word of regs->cs in early_fixup_exception()
Dmitry Vyukov <[email protected]>
kasan: update kasan_global for gcc 7
Takashi Iwai <[email protected]>
zram: fix unbalanced idr management at hot removal
Vineet Gupta <[email protected]>
ARC: Don't use "+l" inline asm constraint
-------------
Diffstat:
Makefile | 4 ++-- arch/arc/include/asm/delay.h | 9 +++++---- arch/arm64/include/asm/cpufeature.h | 2 +- arch/arm64/include/asm/processor.h | 2 +- arch/arm64/kernel/cpufeature.c | 10 +++++++++- arch/arm64/kernel/suspend.c | 9 +++++++++ arch/arm64/mm/fault.c | 12 +++++++++++- arch/x86/kernel/head_32.S | 2 +- drivers/block/zram/zram_drv.c | 3 ++- drivers/net/wireless/mwifiex/cfg80211.c | 13 +++++++------ drivers/pci/pcie/aer/aer_inject.c | 14 -------------- drivers/pci/probe.c | 28 +++++++++++++++++++++++++++- drivers/pwm/sysfs.c | 2 ++ include/linux/compiler-gcc.h | 4 +++- include/linux/pci.h | 14 ++++++++++++++ kernel/rcu/tree_plugin.h | 1 + mm/kasan/kasan.h | 3 +++ sound/core/pcm_lib.c | 2 +- 18 files changed, 99 insertions(+), 35 deletions(-)
Greg Kroah-Hartman
maintainerPATCH 1/13 ARC: Dont use "+l" inline asm constraint
4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vineet Gupta <[email protected]>
commit 3c7c7a2fc8811bc7097479f69acf2527693d7562 upstream.
Apparenty this is coming in the way of gcc fix which inhibits the usage of LP_COUNT as a gpr.
--- arch/arc/include/asm/delay.h | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
arch/arc/include/asm/delay.h +5 -4
@@ -22,10 +22,11 @@static inline void __delay (unsigned long loops) { __asm__ __volatile__( -" lp 1f \n" -" nop \n" -"1: \n" - :"+l" (loops)); +" mov lp_count, %0 \n" +" lp 1f \n" +" nop \n" +"1: \n" + : :"r" (loops)); }extern void __bad_udelay (void );
Greg Kroah-Hartman
maintainerPATCH 2/13 zram: fix unbalanced idr management at hot removal
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Takashi Iwai <[email protected]>
commit 529e71e16403830ae0d737a66c55c5f360f3576b upstream.
The zram hot removal code calls idr_remove() even when zram_remove() returns an error (typically -EBUSY). This results in a leftover at the device release, eventually leading to a crash when the module is reloaded.
As described in the bug report below, the following procedure would cause an Oops with zram:
- provision three zram devices via modprobe zram num_devices=3
- configure a size for each device
+ echo "1G" > /sys/block/$zram_name/disksize
- mkfs and mount zram0 only
- attempt to hot remove all three devices
+ echo 2 > /sys/class/zram-control/hot_remove
+ echo 1 > /sys/class/zram-control/hot_remove
+ echo 0 > /sys/class/zram-control/hot_remove
- zram0 removal fails with EBUSY, as expected
- unmount zram0
- try zram0 hot remove again
+ echo 0 > /sys/class/zram-control/hot_remove
- fails with ENODEV (unexpected)
- unload zram kernel module
+ completes successfully
- zram0 device node still exists
- attempt to mount /dev/zram0
+ mount command is killed
+ following BUG is encountered
BUG: unable to handle kernel paging request at ffffffffa0002ba0 IP: get_disk+0x16/0x50 Oops: 0000 [#1] SMP CPU: 0 PID: 252 Comm: mount Not tainted 4.9.0-rc6 #176 Call Trace: exact_lock+0xc/0x20 kobj_lookup+0xdc/0x160 get_gendisk+0x2f/0x110 __blkdev_get+0x10c/0x3c0 blkdev_get+0x19d/0x2e0 blkdev_open+0x56/0x70 do_dentry_open.isra.19+0x1ff/0x310 vfs_open+0x43/0x60 path_openat+0x2c9/0xf30 do_filp_open+0x79/0xd0 do_sys_open+0x114/0x1e0 SyS_open+0x19/0x20 entry_SYSCALL_64_fastpath+0x13/0x94
This patch adds the proper error check in hot_remove_store() not to call idr_remove() unconditionally.
Bugzilla: https://bugzilla.opensuse.org/show_bug.cgi?id=1010970
--- drivers/block/zram/zram_drv.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/block/zram/zram_drv.c +2 -1
@@ -1368,7 +1368,8 @@ static ssize_t hot_remove_store(struct c zram =idr_find (&zram_index_idr, dev_id);if (zram) { ret =zram_remove (zram); -idr_remove (&zram_index_idr, dev_id); +if (!ret) +idr_remove (&zram_index_idr, dev_id); }else { ret = -ENODEV ; }
Greg Kroah-Hartman
maintainerPATCH 3/13 kasan: update kasan_global for gcc 7
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dmitry Vyukov <[email protected]>
commit 045d599a286bc01daa3510d59272440a17b23c2e upstream.
kasan_global struct is part of compiler/runtime ABI. gcc revision 241983 has added a new field to kasan_global struct. Update kernel definition of kasan_global struct to include the new field.
Without this patch KASAN is broken with gcc 7.
--- include/linux/compiler-gcc.h | 4 +++- mm/kasan/kasan.h | 3 +++ 2 files changed, 6 insertions(+), 1 deletion(-)
include/linux/compiler-gcc.h +3 -1
@@ -251,7 +251,9 @@#endif #endif /* CONFIG_ARCH_USE_BUILTIN_BSWAP */ -#if GCC_VERSION >=50000 +#if GCC_VERSION >=70000 +#define KASAN_ABI_VERSION 5 +#elif GCC_VERSION >=50000 #define KASAN_ABI_VERSION 4#elif GCC_VERSION >=40902 #define KASAN_ABI_VERSION 3
mm/kasan/kasan.h +3 -0
@@ -52,6 +52,9 @@ struct kasan_global {#if KASAN_ABI_VERSION >=4 struct kasan_source_location *location;#endif +#if KASAN_ABI_VERSION >=5 +char *odr_indicator; +#endif };static inline const void *kasan_shadow_to_mem (const void *shadow_addr)
Greg Kroah-Hartman
maintainerPATCH 4/13 x86/traps: Ignore high word of regs->cs in early_fixup_exception()
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andy Lutomirski <[email protected]>
commit fc0e81b2bea0ebceb71889b61d2240856141c9ee upstream.
On the 80486 DX, it seems that some exceptions may leave garbage in the high bits of CS. This causes sporadic failures in which early_fixup_exception() refuses to fix up an exception.
As far as I can tell, this has been buggy for a long time, but the problem seems to have been exacerbated by commits:
1e02ce4cccdc ("x86: Store a per-cpu shadow copy of CR4") e1bfc11c5a6f ("x86/init: Fix cr4_init_shadow() on CR4-less machines")
This appears to have broken for as long as we've had early exception handling.
[ This backport should apply to kernels from 3.4 - 4.5. ]
--- arch/x86/kernel/head_32.S | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/kernel/head_32.S +1 -1
@@ -571,7 +571,7 @@ early_idt_handler_common: movl %eax,%ds movl %eax,%es - cmpl $(__KERNEL_CS),32(%esp) + cmpw $(__KERNEL_CS),32(%esp) jne 10f leal 28(%esp),%eax # Pointer to %eip
Greg Kroah-Hartman
maintainerPATCH 5/13 ALSA: pcm : Call kill_fasync() in stream lock
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Takashi Iwai <[email protected]>
commit 3aa02cb664c5fb1042958c8d1aa8c35055a2ebc4 upstream.
Currently kill_fasync() is called outside the stream lock in snd_pcm_period_elapsed(). This is potentially racy, since the stream may get released even during the irq handler is running. Although snd_pcm_release_substream() calls snd_pcm_drop(), this doesn't guarantee that the irq handler finishes, thus the kill_fasync() call outside the stream spin lock may be invoked after the substream is detached, as recently reported by KASAN.
As a quick workaround, move kill_fasync() call inside the stream lock. The fasync is rarely used interface, so this shouldn't have a big impact from the performance POV.
Ideally, we should implement some sync mechanism for the proper finish of stream and irq handler. But this oneliner should suffice for most cases, so far.
--- sound/core/pcm_lib.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/core/pcm_lib.c +1 -1
@@ -1886,8 +1886,8 @@ void snd_pcm_period_elapsed(struct snd_psnd_timer_interrupt (substream->timer,1 );#endif _end: -snd_pcm_stream_unlock_irqrestore (substream, flags);kill_fasync (&runtime->fasync,SIGIO ,POLL_IN ); +snd_pcm_stream_unlock_irqrestore (substream, flags); }EXPORT_SYMBOL (snd_pcm_period_elapsed);
Greg Kroah-Hartman
maintainerPATCH 6/13 rcu: Fix soft lockup for rcu_nocb_kthread
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ding Tianhong <[email protected]>
commit bedc1969150d480c462cdac320fa944b694a7162 upstream.
Carrying out the following steps results in a softlockup in the RCU callback-offload (rcuo) kthreads:
1. Connect to ixgbevf, and set the speed to 10Gb/s.
2. Use ifconfig to bring the nic up and down repeatedly.
[ 317.005148] IPv6: ADDRCONF(NETDEV_CHANGE): eth2: link becomes ready [ 368.106005] BUG: soft lockup - CPU#1 stuck for 22s! [rcuos/1:15] [ 368.106005] Hardware name: Bochs Bochs, BIOS Bochs 01/01/2011 [ 368.106005] task: ffff88057dd8a220 ti: ffff88057dd9c000 task.ti: ffff88057dd9c000 [ 368.106005] RIP: 0010:[<ffffffff81579e04>] [<ffffffff81579e04>] fib_table_lookup+0x14/0x390 [ 368.106005] RSP: 0018:ffff88061fc83ce8 EFLAGS: 00000286 [ 368.106005] RAX: 0000000000000001 RBX: 00000000020155c0 RCX: 0000000000000001 [ 368.106005] RDX: ffff88061fc83d50 RSI: ffff88061fc83d70 RDI: ffff880036d11a00 [ 368.106005] RBP: ffff88061fc83d08 R08: 0000000000000001 R09: 0000000000000000 [ 368.106005] R10: ffff880036d11a00 R11: ffffffff819e0900 R12: ffff88061fc83c58 [ 368.106005] R13: ffffffff816154dd R14: ffff88061fc83d08 R15: 00000000020155c0 [ 368.106005] FS: 0000000000000000(0000) GS:ffff88061fc80000(0000) knlGS:0000000000000000 [ 368.106005] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 368.106005] CR2: 00007f8c2aee9c40 CR3: 000000057b222000 CR4: 00000000000407e0 [ 368.106005] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 [ 368.106005] DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400 [ 368.106005] Stack: [ 368.106005] 00000000010000c0 ffff88057b766000 ffff8802e380b000 ffff88057af03e00 [ 368.106005] ffff88061fc83dc0 ffffffff815349a6 ffff88061fc83d40 ffffffff814ee146 [ 368.106005] ffff8802e380af00 00000000e380af00 ffffffff819e0900 020155c0010000c0 [ 368.106005] Call Trace: [ 368.106005] <IRQ> [ 368.106005] [ 368.106005] [<ffffffff815349a6>] ip_route_input_noref+0x516/0xbd0 [ 368.106005] [<ffffffff814ee146>] ? skb_release_data+0xd6/0x110 [ 368.106005] [<ffffffff814ee20a>] ? kfree_skb+0x3a/0xa0 [ 368.106005] [<ffffffff8153698f>] ip_rcv_finish+0x29f/0x350 [ 368.106005] [<ffffffff81537034>] ip_rcv+0x234/0x380 [ 368.106005] [<ffffffff814fd656>] __netif_receive_skb_core+0x676/0x870 [ 368.106005] [<ffffffff814fd868>] __netif_receive_skb+0x18/0x60 [ 368.106005] [<ffffffff814fe4de>] process_backlog+0xae/0x180 [ 368.106005] [<ffffffff814fdcb2>] net_rx_action+0x152/0x240 [ 368.106005] [<ffffffff81077b3f>] __do_softirq+0xef/0x280 [ 368.106005] [<ffffffff8161619c>] call_softirq+0x1c/0x30 [ 368.106005] <EOI> [ 368.106005] [ 368.106005] [<ffffffff81015d95>] do_softirq+0x65/0xa0 [ 368.106005] [<ffffffff81077174>] local_bh_enable+0x94/0xa0 [ 368.106005] [<ffffffff81114922>] rcu_nocb_kthread+0x232/0x370 [ 368.106005] [<ffffffff81098250>] ? wake_up_bit+0x30/0x30 [ 368.106005] [<ffffffff811146f0>] ? rcu_start_gp+0x40/0x40 [ 368.106005] [<ffffffff8109728f>] kthread+0xcf/0xe0 [ 368.106005] [<ffffffff810971c0>] ? kthread_create_on_node+0x140/0x140 [ 368.106005] [<ffffffff816147d8>] ret_from_fork+0x58/0x90 [ 368.106005] [<ffffffff810971c0>] ? kthread_create_on_node+0x140/0x140
==================================cut here==============================
It turns out that the rcuos callback-offload kthread is busy processing a very large quantity of RCU callbacks, and it is not reliquishing the CPU while doing so. This commit therefore adds an cond_resched_rcu_qs() within the loop to allow other tasks to run.
--- kernel/rcu/tree_plugin.h | 1 + 1 file changed, 1 insertion(+)
kernel/rcu/tree_plugin.h +1 -0
@@ -2275,6 +2275,7 @@ static int rcu_nocb_kthread(void *arg) cl++; c++;local_bh_enable (); +cond_resched_rcu_qs (); list = next; }trace_rcu_batch_end (rdp->rsp->name, c, !!list,0 ,0 ,1 );
Greg Kroah-Hartman
maintainerPATCH 7/13 PCI: Export pcie_find_root_port
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johannes Thumshirn <[email protected]>
commit e784930bd645e7df78c66e7872fec282b0620075 upstream.
Export pcie_find_root_port() so we can use it outside of PCIe-AER error injection.
--- drivers/pci/pcie/aer/aer_inject.c | 14 -------------- include/linux/pci.h | 14 ++++++++++++++ 2 files changed, 14 insertions(+), 14 deletions(-)
drivers/pci/pcie/aer/aer_inject.c +0 -14
@@ -283,20 +283,6 @@ out:return 0 ; } -static struct pci_dev *pcie_find_root_port (struct pci_dev *dev) -{ -while (1 ) { -if (!pci_is_pcie (dev)) -break ; -if (pci_pcie_type (dev) ==PCI_EXP_TYPE_ROOT_PORT ) -return dev; -if (!dev->bus->self) -break ; - dev = dev->bus->self; - } -return NULL ; -} -static int find_aer_device_iter (struct device *device,void *data) {struct pcie_device **result = data;
include/linux/pci.h +14 -0
@@ -1802,6 +1802,20 @@ static inline int pci_pcie_type(const streturn (pcie_caps_reg (dev) &PCI_EXP_FLAGS_TYPE ) >>4 ; } +static inline struct pci_dev *pcie_find_root_port (struct pci_dev *dev) +{ +while (1 ) { +if (!pci_is_pcie (dev)) +break ; +if (pci_pcie_type (dev) ==PCI_EXP_TYPE_ROOT_PORT ) +return dev; +if (!dev->bus->self) +break ; + dev = dev->bus->self; + } +return NULL ; +} +void pci_request_acs (void );bool pci_acs_enabled (struct pci_dev *pdev,u16 acs_flags); bool pci_acs_path_enabled(struct pci_dev *start,
Greg Kroah-Hartman
maintainerPATCH 9/13 mwifiex: printk() overflow with 32-byte SSIDs
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Brian Norris <[email protected]>
commit fcd2042e8d36cf644bd2d69c26378d17158b17df upstream.
SSIDs aren't guaranteed to be 0-terminated. Let's cap the max length when we print them out.
This can be easily noticed by connecting to a network with a 32-octet SSID:
[ 3903.502925] mwifiex_pcie 0000:01:00.0: info: trying to associate to
'0123456789abcdef0123456789abcdef <uninitialized mem>' bssid xx:xx:xx:xx:xx:xx
--- drivers/net/wireless/mwifiex/cfg80211.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-)
drivers/net/wireless/mwifiex/cfg80211.c +7 -6
@@ -2144,8 +2144,9 @@ done: is_scanning_required =1 ; }else {mwifiex_dbg (priv->adapter,MSG , -"info: trying to associate to '%s' bssid %pM\n" , - (char *)req_ssid.ssid, bss->bssid); +"info: trying to associate to '%.*s' bssid %pM\n" , + req_ssid.ssid_len, (char *)req_ssid.ssid, + bss->bssid);memcpy (&priv->cfg_bssid, bss->bssid,ETH_ALEN );break ; }
@@ -2202,8 +2203,8 @@ mwifiex_cfg80211_connect(struct wiphy *w }mwifiex_dbg (adapter,INFO , -"info: Trying to associate to %s and bssid %pM\n" , - (char *)sme->ssid, sme->bssid); +"info: Trying to associate to %.*s and bssid %pM\n" , + (int )sme->ssid_len, (char *)sme->ssid, sme->bssid); ret =mwifiex_cfg80211_assoc (priv, sme->ssid_len, sme->ssid, sme->bssid, priv->bss_mode, sme->channel, sme,0 );
@@ -2333,8 +2334,8 @@ mwifiex_cfg80211_join_ibss(struct wiphy }mwifiex_dbg (priv->adapter,MSG , -"info: trying to join to %s and bssid %pM\n" , - (char *)params->ssid, params->bssid); +"info: trying to join to %.*s and bssid %pM\n" , + params->ssid_len, (char *)params->ssid, params->bssid);mwifiex_set_ibss_params (priv, params);
Greg Kroah-Hartman
maintainerPATCH 10/13 pwm: Fix device reference leak
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johan Hovold <[email protected]>
commit 0e1614ac84f1719d87bed577963bb8140d0c9ce8 upstream.
Make sure to drop the reference to the parent device taken by class_find_device() after "unexporting" any children when deregistering a PWM chip.
--- drivers/pwm/sysfs.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/pwm/sysfs.c +2 -0
@@ -366,6 +366,8 @@ void pwmchip_sysfs_unexport_children(strif (test_bit (PWMF_EXPORTED , &pwm->flags))pwm_unexport_child (parent, pwm); } + +put_device (parent); }static int __init pwm_sysfs_init (void )
Greg Kroah-Hartman
maintainerPATCH 11/13 arm64: cpufeature: Schedule enable() calls instead of calling them via IPI
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: James Morse <[email protected]>
commit 2a6dcb2b5f3e21592ca8dfa198dcce7bec09b020 upstream.
The enable() call for a cpufeature/errata is called using on_each_cpu(). This issues a cross-call IPI to get the work done. Implicitly, this stashes the running PSTATE in SPSR when the CPU receives the IPI, and restores it when we return. This means an enable() call can never modify PSTATE.
To allow PAN to do this, change the on_each_cpu() call to use stop_machine(). This schedules the work on each CPU which allows us to modify PSTATE.
This involves changing the protype of all the enable() functions.
enable_cpu_capabilities() is called during boot and enables the feature on all online CPUs. This path now uses stop_machine(). CPU features for hotplug'd CPUs are enabled by verify_local_cpu_features() which only acts on the local CPU, and can already modify the running PSTATE as it is called from secondary_start_kernel().
[Removed enable() hunks for features/errata v4.4. doesn't have. Changed
caps->enable arg in enable_cpu_capabilities()]
--- arch/arm64/include/asm/cpufeature.h | 2 +- arch/arm64/include/asm/processor.h | 2 +- arch/arm64/kernel/cpufeature.c | 10 +++++++++- arch/arm64/mm/fault.c | 3 ++- 4 files changed, 13 insertions(+), 4 deletions(-)
arch/arm64/include/asm/cpufeature.h +1 -1
@@ -77,7 +77,7 @@ struct arm64_cpu_capabilities {const char *desc;u16 capability;bool (*matches)(const struct arm64_cpu_capabilities *); -void (*enable)(void *);/* Called on all active CPUs */ +int (*enable)(void *);/* Called on all active CPUs */ union { struct { /* To be used for erratum handling only */ u32 midr_model;
arch/arm64/include/asm/processor.h +1 -1
@@ -186,6 +186,6 @@ static inline void spin_lock_prefetch(co#endif -void cpu_enable_pan (void *__unused); +int cpu_enable_pan (void *__unused);#endif /* __ASM_PROCESSOR_H */
arch/arm64/kernel/cpufeature.c +9 -1
@@ -19,7 +19,9 @@#define pr_fmt (fmt) "CPU features: " fmt#include <linux/bsearch.h> +#include <linux/cpumask.h> #include <linux/sort.h> +#include <linux/stop_machine.h> #include <linux/types.h> #include <asm/cpu.h> #include <asm/cpufeature.h>
@@ -764,7 +766,13 @@ static void enable_cpu_capabilities(consfor (i =0 ; caps[i].desc; i++)if (caps[i].enable &&cpus_have_cap (caps[i].capability)) -on_each_cpu (caps[i].enable,NULL , true); +/* +* Use stop_machine() as it schedules the work allowing +* us to modify PSTATE, instead of on_each_cpu() which +* uses an IPI, giving us a PSTATE that disappears when +* we return. +*/ +stop_machine (caps[i].enable,NULL , cpu_online_mask); }#ifdef CONFIG_HOTPLUG_CPU
arch/arm64/mm/fault.c +2 -1
@@ -606,8 +606,9 @@ asmlinkage int __exception do_debug_exce }#ifdef CONFIG_ARM64_PAN -void cpu_enable_pan (void *__unused) +int cpu_enable_pan (void *__unused) {config_sctlr_el1 (SCTLR_EL1_SPAN ,0 ); +return 0 ; }#endif /* CONFIG_ARM64_PAN */
Greg Kroah-Hartman
maintainerPATCH 12/13 arm64: mm: Set PSTATE.PAN from the cpu_enable_pan() call
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: James Morse <[email protected]>
commit 7209c868600bd8926e37c10b9aae83124ccc1dd8 upstream.
Commit 338d4f49d6f7 ("arm64: kernel: Add support for Privileged Access Never") enabled PAN by enabling the 'SPAN' feature-bit in SCTLR_EL1. This means the PSTATE.PAN bit won't be set until the next return to the kernel from userspace. On a preemptible kernel we may schedule work that accesses userspace on a CPU before it has done this.
Now that cpufeature enable() calls are scheduled via stop_machine(), we can set PSTATE.PAN from the cpu_enable_pan() call.
Add WARN_ON_ONCE(in_interrupt()) to check the PSTATE value we updated is not immediately discarded.
--- arch/arm64/mm/fault.c | 9 +++++++++ 1 file changed, 9 insertions(+)
arch/arm64/mm/fault.c +9 -0
@@ -29,7 +29,9 @@#include <linux/sched.h> #include <linux/highmem.h> #include <linux/perf_event.h> +#include <linux/preempt.h> +#include <asm/bug.h> #include <asm/cpufeature.h> #include <asm/exception.h> #include <asm/debug-monitors.h>
@@ -608,7 +610,14 @@ asmlinkage int __exception do_debug_exce#ifdef CONFIG_ARM64_PAN int cpu_enable_pan (void *__unused) { +/* +* We modify PSTATE. This won't work from irq context as the PSTATE +* is discarded once we return from the exception. +*/ +WARN_ON_ONCE (in_interrupt ()); +config_sctlr_el1 (SCTLR_EL1_SPAN ,0 ); + asm(SET_PSTATE_PAN(1));return 0 ; }#endif /* CONFIG_ARM64_PAN */
Greg Kroah-Hartman
maintainerPATCH 13/13 arm64: suspend: Reconfigure PSTATE after resume from idle
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: James Morse <[email protected]>
commit d08544127d9fb4505635e3cb6871fd50a42947bd upstream.
The suspend/resume path in kernel/sleep.S, as used by cpu-idle, does not save/restore PSTATE. As a result of this cpufeatures that were detected and have bits in PSTATE get lost when we resume from idle.
UAO gets set appropriately on the next context switch. PAN will be re-enabled next time we return from user-space, but on a preemptible kernel we may run work accessing user space before this point.
Add code to re-enable theses two features in __cpu_suspend_exit(). We re-use uao_thread_switch() passing current.
[Removed UAO hooks and commit-message references: this feature is not
present in v4.4]
--- arch/arm64/kernel/suspend.c | 9 +++++++++ 1 file changed, 9 insertions(+)
arch/arm64/kernel/suspend.c +9 -0
@@ -1,7 +1,9 @@#include <linux/ftrace.h> #include <linux/percpu.h> #include <linux/slab.h> +#include <asm/alternative.h> #include <asm/cacheflush.h> +#include <asm/cpufeature.h> #include <asm/debug-monitors.h> #include <asm/pgtable.h> #include <asm/memory.h>
@@ -111,6 +113,13 @@ int cpu_suspend(unsigned long arg, int (set_my_cpu_offset (per_cpu_offset (smp_processor_id ()));/* +* PSTATE was not saved over suspend/resume, re-enable any +* detected features that might not have been set correctly. +*/ + asm(ALTERNATIVE("nop", SET_PSTATE_PAN(1), ARM64_HAS_PAN, + CONFIG_ARM64_PAN)); + +/* * Restore HW breakpoint registers to sane values * before debug exceptions are possibly reenabled * through local_dbg_restore.
Quoted 8 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.4.37 release. There are 13 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 Fri Dec 9 07:07:03 UTC 2016. Anything received after that time might be too late.
Build results:
total: 149 pass: 149 fail: 0 Qemu test results: total: 115 pass: 115 fail: 0
Details are available at http://kerneltests.org/builders.
Guenter
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.4.37 release. There are 13 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 Fri Dec 9 07:07:03 UTC 2016. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 8 lines
kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.4.37-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-4.4.y
and the diffstat can be found below.thanks,
greg k-h
Compiled and booted on my test system. No dmesg regressions.
thanks,
-- Shuah
Signature · 5 lines
Shuah Khan Sr. Linux Kernel Developer Open Source Innovation Group Samsung Research America(Silicon Valley) [email protected]
A message that is not in the archive (sent off-list or not yet received): [email protected]
A message that is not in the archive (sent off-list or not yet received): [email protected]
Greg Kroah-Hartman
maintainerQuoted 33 lines · Kevin Hilman
+ some lab owners at Free Electrons, Collabora
Quoted 12 lines · kernelci.org bot
stable-rc boot: 156 boots: 2 failed, 153 passed with 1 conflict (v4.4.36-14-g322b9514f86e)
Full Boot Summary: https://kernelci.org/boot/all/job/stable-rc/kernel/v4.4.36-14-g322b9514f86e/
Full Build Summary: https://kernelci.org/build/stable-rc/kernel/v4.4.36-14-g322b9514f86e/Tree: stable-rc
Branch: local/linux-4.4.y
Git Describe: v4.4.36-14-g322b9514f86e
Git Commit:322b9514f86ef1be23ca2b50e0541d4d5e2d6bf3
Git URL: http://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git
Tested: 37 unique boards, 10 SoC families, 21 builds out of 202Quoted 7 lines
Boot Regressions Detected:
arm:
multi_v7_defconfig+CONFIG_LKDTM=y: am335x-boneblack: lab-collabora: new failure (last pass: v4.4.35-23-g6a11a03c8a3c)This one looks lab specific, as it passed in 2 other labs.
Quoted 3 lines
multi_v7_defconfig+CONFIG_PROVE_LOCKING=y: sama5d36ek: lab-free-electrons: failing since 38 days (last pass: v4.4.13-82-g832ada1e8e08 - first fail: v4.4.28-52-g801f6b993dc2)This one has been failing for awhile. Cc'd lab owners at Free Electrons.
Quoted 7 lines
Quoted 3 lines
multi_v7_defconfig+CONFIG_SMP=n: imx6q-sabrelite: lab-collabora: failing since 14 days (last pass: v4.4.32-28-gd60fb7232229 - first fail: v4.4.34)Also not a new one. Cc'd lab owners at collabora.
Otherwise, intrepretation: no blocking issues.
Great, thanks for letting me know.
greg k-h