3.14.16-stable review
Greg Kroah-Hartman
maintainercover 3.14.16-stable review
This is the start of the stable review cycle for the 3.14.16 release. There are 39 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 Thu Aug 7 18:13:27 UTC 2014. 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/v3.0/stable-review/patch-3.14.16-rc1.gz
and the diffstat can be found below.
thanks,
greg k-h
-------------
Pseudo-Shortlog of commits:
Greg Kroah-Hartman <[email protected]>
Linux 3.14.16-rc1
Boris Ostrovsky <[email protected]>
x86/espfix/xen: Fix allocation of pages for paravirt page tables
Minfei Huang <[email protected]>
lib/btree.c: fix leak of whole btree nodes
Sasha Levin <[email protected]>
net/l2tp: don't fall back on UDP [get|set]sockopt
Max Filippov <[email protected]>
xtensa: add fixup for double exception raised in window overflow
David Vrabel <[email protected]>
x86/xen: no need to explicitly register an NMI callback
Viresh Kumar <[email protected]>
cpufreq: move policy kobj to policy->cpu at resume
Johannes Berg <[email protected]>
Revert "mac80211: move "bufferable MMPDU" check to fix AP mode scan"
Malcolm Priestley <[email protected]>
staging: vt6655: Fix Warning on boot handle_irq_event_percpu.
Roger Quadros <[email protected]>
ARM: dts: dra7-evm: Make VDDA_1V8_PHY supply always on
Nishanth Menon <[email protected]>
pinctrl: dra: dt-bindings: Fix pull enable/disable
Andy Lutomirski <[email protected]>
x86_64/entry/xen: Do not invoke espfix64 on Xen
H. Peter Anvin <[email protected]>
x86, espfix: Make it possible to disable 16-bit support
H. Peter Anvin <[email protected]>
x86, espfix: Make espfix64 a Kconfig option, fix UML
H. Peter Anvin <[email protected]>
x86, espfix: Fix broken header guard
H. Peter Anvin <[email protected]>
x86, espfix: Move espfix definitions into a separate header file
H. Peter Anvin <[email protected]>
x86-64, espfix: Don't leak bits 31:16 of %esp returning to 16-bit stack
H. Peter Anvin <[email protected]>
Revert "x86-64, modify_ldt: Make support for 16-bit segments a runtime option"
Jan Kara <[email protected]>
timer: Fix lock inversion between hrtimer_bases.lock and scheduler locks
Stephen Boyd <[email protected]>
sched_clock: Avoid corrupting hrtimer tree during suspend
John Stultz <[email protected]>
printk: rename printk_sched to printk_deferred
Anssi Hannula <[email protected]>
dm cache: fix race affecting dirty block count
Greg Thelen <[email protected]>
dm bufio: fully initialize shrinker
Lars-Peter Clausen <[email protected]>
iio: buffer: Fix demux table creation
Peter Meerwald <[email protected]>
iio:bma180: Missing check for frequency fractional part
Peter Meerwald <[email protected]>
iio:bma180: Fix scale factors to report correct acceleration units
Rafael J. Wysocki <[email protected]>
ACPI / PNP: Fix acpi_pnp_match()
Malcolm Priestley <[email protected]>
staging: vt6655: Fix disassociated messages every 10 seconds
Michal Hocko <[email protected]>
memcg: oom_notify use-after-free fix
David Rientjes <[email protected]>
mm, thp: do not allow thp faults to avoid cpuset restrictions
Maxim Patlasov <[email protected]>
mm/page-writeback.c: fix divide by zero in bdi_dirty_limits()
James Bottomley <[email protected]>
scsi: handle flush errors properly
Alexandre Bounine <[email protected]>
rapidio/tsi721_dma: fix failure to obtain transaction descriptor
Eliad Peller <[email protected]>
cfg80211: fix mic_failure tracing
Felix Fietkau <[email protected]>
ath9k: fix aggregation session lockup
Konstantin Khlebnikov <[email protected]>
ARM: 8115/1: LPAE: reduce damage caused by idmap to virtual memory layout
Russell King <[email protected]>
ARM: fix alignment of keystone page table fixup
Haojian Zhuang <[email protected]>
ARM: dts: fix L2 address in Hi3620
Milan Broz <[email protected]>
crypto: af_alg - properly label AF_ALG socket
Mikulas Patocka <[email protected]>
crypto: arm-aes - fix encryption of unaligned data
-------------
Diffstat:
Documentation/x86/x86_64/mm.txt | 2 + Makefile | 4 +- arch/arm/boot/dts/dra7-evm.dts | 1 + arch/arm/boot/dts/hi3620.dtsi | 2 +- arch/arm/crypto/aesbs-glue.c | 10 +- arch/arm/mm/idmap.c | 7 ++ arch/arm/mm/mmu.c | 6 +- arch/x86/Kconfig | 25 +++- arch/x86/include/asm/espfix.h | 16 +++ arch/x86/include/asm/irqflags.h | 2 +- arch/x86/include/asm/pgtable_64_types.h | 2 + arch/x86/include/asm/setup.h | 2 + arch/x86/kernel/Makefile | 1 + arch/x86/kernel/entry_32.S | 12 ++ arch/x86/kernel/entry_64.S | 77 +++++++++++- arch/x86/kernel/espfix_64.c | 208 ++++++++++++++++++++++++++++++++ arch/x86/kernel/ldt.c | 10 +- arch/x86/kernel/paravirt_patch_64.c | 2 - arch/x86/kernel/smpboot.c | 7 ++ arch/x86/mm/dump_pagetables.c | 31 +++-- arch/x86/vdso/vdso32-setup.c | 8 -- arch/x86/xen/setup.c | 9 +- arch/xtensa/kernel/vectors.S | 158 ++++++++++++++++++++---- arch/xtensa/kernel/vmlinux.lds.S | 4 +- crypto/af_alg.c | 2 + drivers/cpufreq/cpufreq.c | 6 +- drivers/iio/accel/bma180.c | 8 +- drivers/iio/industrialio-buffer.c | 2 +- drivers/md/dm-bufio.c | 2 +- drivers/md/dm-cache-target.c | 13 +- drivers/net/wireless/ath/ath9k/xmit.c | 9 ++ drivers/pnp/pnpacpi/core.c | 3 +- drivers/rapidio/devices/tsi721_dma.c | 8 +- drivers/scsi/scsi_lib.c | 8 ++ drivers/staging/vt6655/bssdb.c | 2 +- drivers/staging/vt6655/device_main.c | 7 +- include/dt-bindings/pinctrl/dra.h | 7 +- include/linux/printk.h | 6 +- init/main.c | 4 + kernel/printk/printk.c | 2 +- kernel/sched/core.c | 2 +- kernel/sched/deadline.c | 2 +- kernel/sched/rt.c | 2 +- kernel/time/clockevents.c | 10 +- kernel/time/sched_clock.c | 4 +- lib/btree.c | 1 + mm/memcontrol.c | 4 + mm/page-writeback.c | 6 +- mm/page_alloc.c | 16 +-- net/l2tp/l2tp_ppp.c | 4 +- net/mac80211/tx.c | 27 ++--- net/wireless/trace.h | 3 +- 52 files changed, 629 insertions(+), 147 deletions(-)
Greg Kroah-Hartman
maintainerPATCH 1/39 crypto: arm-aes - fix encryption of unaligned data
3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mikulas Patocka <[email protected]>
commit f3c400ef473e00c680ea713a66196b05870b3710 upstream.
Fix the same alignment bug as in arm64 - we need to pass residue unprocessed bytes as the last argument to blkcipher_walk_done.
--- arch/arm/crypto/aesbs-glue.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
arch/arm/crypto/aesbs-glue.c +5 -5
@@ -137,7 +137,7 @@ static int aesbs_cbc_encrypt(struct blkc dst +=AES_BLOCK_SIZE ; }while (--blocks); } - err =blkcipher_walk_done (desc, &walk,0 ); + err =blkcipher_walk_done (desc, &walk, walk.nbytes %AES_BLOCK_SIZE ); }return err; }
@@ -158,7 +158,7 @@ static int aesbs_cbc_decrypt(struct blkcbsaes_cbc_encrypt (walk.src.virt.addr, walk.dst.virt.addr, walk.nbytes, &ctx->dec, walk.iv);kernel_neon_end (); - err =blkcipher_walk_done (desc, &walk,0 ); + err =blkcipher_walk_done (desc, &walk, walk.nbytes %AES_BLOCK_SIZE ); }while (walk.nbytes) {u32 blocks = walk.nbytes /AES_BLOCK_SIZE ;
@@ -182,7 +182,7 @@ static int aesbs_cbc_decrypt(struct blkc dst +=AES_BLOCK_SIZE ; src +=AES_BLOCK_SIZE ; }while (--blocks); - err =blkcipher_walk_done (desc, &walk,0 ); + err =blkcipher_walk_done (desc, &walk, walk.nbytes %AES_BLOCK_SIZE ); }return err; }
@@ -268,7 +268,7 @@ static int aesbs_xts_encrypt(struct blkcbsaes_xts_encrypt (walk.src.virt.addr, walk.dst.virt.addr, walk.nbytes, &ctx->enc, walk.iv);kernel_neon_end (); - err =blkcipher_walk_done (desc, &walk,0 ); + err =blkcipher_walk_done (desc, &walk, walk.nbytes %AES_BLOCK_SIZE ); }return err; }
@@ -292,7 +292,7 @@ static int aesbs_xts_decrypt(struct blkcbsaes_xts_decrypt (walk.src.virt.addr, walk.dst.virt.addr, walk.nbytes, &ctx->dec, walk.iv);kernel_neon_end (); - err =blkcipher_walk_done (desc, &walk,0 ); + err =blkcipher_walk_done (desc, &walk, walk.nbytes %AES_BLOCK_SIZE ); }return err; }
Greg Kroah-Hartman
maintainerPATCH 2/39 crypto: af_alg - properly label AF_ALG socket
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Milan Broz <[email protected]>
commit 4c63f83c2c2e16a13ce274ee678e28246bd33645 upstream.
Th AF_ALG socket was missing a security label (e.g. SELinux) which means that socket was in "unlabeled" state.
This was recently demonstrated in the cryptsetup package (cryptsetup v1.6.5 and later.)
See https://bugzilla.redhat.com/show_bug.cgi?id=1115120
This patch clones the sock's label from the parent sock and resolves the issue (similar to AF_BLUETOOTH protocol family).
--- crypto/af_alg.c | 2 ++ 1 file changed, 2 insertions(+)
crypto/af_alg.c +2 -0
@@ -21,6 +21,7 @@#include <linux/module.h> #include <linux/net.h> #include <linux/rwsem.h> +#include <linux/security.h> struct alg_type_list {const struct af_alg_type *type;
@@ -243,6 +244,7 @@ int af_alg_accept(struct sock *sk, strucsock_init_data (newsock, sk2);sock_graft (sk2, newsock); +security_sk_clone (sk, sk2); err = type->accept (ask->private, sk2);if (err) {
Greg Kroah-Hartman
maintainerPATCH 3/39 ARM: dts: fix L2 address in Hi3620
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Haojian Zhuang <[email protected]>
commit 28c9770bcbd2b6dbab99669825a2f8fa69e6d35b upstream.
Fix the address of L2 controler register in hi3620 SoC. This has been wrong from the point that the file was merged in v3.14.
--- arch/arm/boot/dts/hi3620.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/boot/dts/hi3620.dtsi +1 -1
@@ -73,7 +73,7 @@ L2: l2-cache { compatible = "arm,pl310-cache"; - reg = <0xfc10000 0x100000>; + reg = <0x100000 0x100000>; interrupts = <0 15 4>; cache-unified; cache-level = <2>;
Greg Kroah-Hartman
maintainerPATCH 4/39 ARM: fix alignment of keystone page table fixup
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Russell King <[email protected]>
commit 823a19cd3b91b0729d7417f1848413846be61712 upstream.
If init_mm.brk is not section aligned, the LPAE fixup code will miss updating the final PMD. Fix this by aligning map_end.
--- arch/arm/mm/mmu.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
arch/arm/mm/mmu.c +3 -3
@@ -1436,8 +1436,8 @@ void __init early_paging_init(const strureturn ;/* remap kernel code and data */ - map_start = init_mm.start_code; - map_end = init_mm.brk; + map_start = init_mm.start_code &PMD_MASK ; + map_end =ALIGN (init_mm.brk,PMD_SIZE );/* get a handle on things... */ pgd0 =pgd_offset_k (0 );
@@ -1472,7 +1472,7 @@ void __init early_paging_init(const stru }/* remap pmds for kernel mapping */ - phys =__pa (map_start) &PMD_MASK ; + phys =__pa (map_start); do { *pmdk++ = __pmd(phys | pmdprot); phys += PMD_SIZE;
Greg Kroah-Hartman
maintainerPATCH 5/39 ARM: 8115/1: LPAE: reduce damage caused by idmap to virtual memory layout
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Konstantin Khlebnikov <[email protected]>
commit 811a2407a3cf7bbd027fbe92d73416f17485a3d8 upstream.
On LPAE, each level 1 (pgd) page table entry maps 1GiB, and the level 2 (pmd) entries map 2MiB.
When the identity mapping is created on LPAE, the pgd pointers are copied from the swapper_pg_dir. If we find that we need to modify the contents of a pmd, we allocate a new empty pmd table and insert it into the appropriate 1GB slot, before then filling it with the identity mapping.
However, if the 1GB slot covers the kernel lowmem mappings, we obliterate those mappings.
When replacing a PMD, first copy the old PMD contents to the new PMD, so that we preserve the existing mappings, particularly the mappings of the kernel itself.
[rewrote commit message and added code comment -- rmk]
--- arch/arm/mm/idmap.c | 7 +++++++ 1 file changed, 7 insertions(+)
arch/arm/mm/idmap.c +7 -0
@@ -25,6 +25,13 @@ static void idmap_add_pmd(pud_t *pud, unpr_warning ("Failed to allocate identity pmd.\n" );return ; } +/* +* Copy the original PMD to ensure that the PMD entries for +* the kernel image are preserved. +*/ +if (!pud_none (*pud)) +memcpy (pmd,pmd_offset (pud,0 ), +PTRS_PER_PMD *sizeof (pmd_t));pud_populate (&init_mm, pud, pmd); pmd +=pmd_index (addr); }else
Greg Kroah-Hartman
maintainerPATCH 6/39 ath9k: fix aggregation session lockup
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Felix Fietkau <[email protected]>
commit c01fac1c77a00227f706a1654317023e3f4ac7f0 upstream.
If an aggregation session fails, frames still end up in the driver queue with IEEE80211_TX_CTL_AMPDU set.
This causes tx for the affected station/tid to stall, since ath_tx_get_tid_subframe returning packets to send.
Fix this by clearing IEEE80211_TX_CTL_AMPDU as long as no aggregation session is running.
--- drivers/net/wireless/ath/ath9k/xmit.c | 9 +++++++++ 1 file changed, 9 insertions(+)
drivers/net/wireless/ath/ath9k/xmit.c +9 -0
@@ -890,6 +890,15 @@ ath_tx_get_tid_subframe(struct ath_softc tx_info =IEEE80211_SKB_CB (skb); tx_info->flags &= ~IEEE80211_TX_CTL_CLEAR_PS_FILT ; + +/* +* No aggregation session is running, but there may be frames +* from a previous session or a failed attempt in the queue. +* Send them out as normal data frames +*/ +if (!tid->active) + tx_info->flags &= ~IEEE80211_TX_CTL_AMPDU ; +if (!(tx_info->flags &IEEE80211_TX_CTL_AMPDU )) { bf->bf_state.bf_type =0 ;return bf;
Greg Kroah-Hartman
maintainerPATCH 7/39 cfg80211: fix mic_failure tracing
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eliad Peller <[email protected]>
commit 8c26d458394be44e135d1c6bd4557e1c4e1a0535 upstream.
tsc can be NULL (mac80211 currently always passes NULL), resulting in NULL-dereference. check before copying it.
--- net/wireless/trace.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
net/wireless/trace.h +2 -1
@@ -2068,7 +2068,8 @@ TRACE_EVENT(cfg80211_michael_mic_failureMAC_ASSIGN (addr, addr); __entry->key_type = key_type; __entry->key_id = key_id; -memcpy (__entry->tsc, tsc,6 ); +if (tsc) +memcpy (__entry->tsc, tsc,6 ); ), TP_printk(NETDEV_PR_FMT ", " MAC_PR_FMT ", key type: %d, key id: %d, tsc: %pm", NETDEV_PR_ARG, MAC_PR_ARG(addr), __entry->key_type,
Greg Kroah-Hartman
maintainerPATCH 8/39 rapidio/tsi721_dma: fix failure to obtain transaction descriptor
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexandre Bounine <[email protected]>
commit 0193ed8225e1a79ed64632106ec3cc81798cb13c upstream.
This is a bug fix for the situation when function tsi721_desc_get() fails to obtain a free transaction descriptor.
The bug usually results in a memory access crash dump when data transfer scatter-gather list has more entries than size of hardware buffer descriptors ring. This fix ensures that error is properly returned to a caller instead of an invalid entry.
This patch is applicable to kernel versions starting from v3.5.
--- drivers/rapidio/devices/tsi721_dma.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/rapidio/devices/tsi721_dma.c +7 -1
@@ -287,6 +287,12 @@ struct tsi721_tx_desc *tsi721_desc_get(s "desc %p not ACKed\n", tx_desc); } +if (ret ==NULL ) { +dev_dbg (bdma_chan->dchan.device->dev, +"%s: unable to obtain tx descriptor\n" , __func__); + goto err_out; + } + i = bdma_chan->wr_count_next % bdma_chan->bd_num;if (i == bdma_chan->bd_num -1 ) { i =0 ;
@@ -297,7 +303,7 @@ struct tsi721_tx_desc *tsi721_desc_get(s tx_desc->txd.phys = bdma_chan->bd_phys + i *sizeof (struct tsi721_dma_desc ); tx_desc->hw_desc = &((struct tsi721_dma_desc *)bdma_chan->bd_base)[i]; - +err_out:spin_unlock_bh (&bdma_chan->lock);return ret;
Greg Kroah-Hartman
maintainerPATCH 9/39 scsi: handle flush errors properly
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: James Bottomley <[email protected]>
commit 89fb4cd1f717a871ef79fa7debbe840e3225cd54 upstream.
Flush commands don't transfer data and thus need to be special cased in the I/O completion handler so that we can propagate errors to the block layer and filesystem.
--- drivers/scsi/scsi_lib.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/scsi/scsi_lib.c +8 -0
@@ -831,6 +831,14 @@ void scsi_io_completion(struct scsi_cmndscsi_next_command (cmd);return ; } + }else if (blk_rq_bytes (req) ==0 && result && !sense_deferred) { +/* +* Certain non BLOCK_PC requests are commands that don't +* actually transfer anything (FLUSH), so cannot use +* good_bytes != blk_rq_bytes(req) as the signal for an error. +* This sets the error explicitly for the problem case. +*/ + error =__scsi_error_from_host_byte (cmd, result); }/* no bidi support for !REQ_TYPE_BLOCK_PC yet */
Greg Kroah-Hartman
maintainerPATCH 10/39 mm/page-writeback.c: fix divide by zero in bdi_dirty_limits()
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Maxim Patlasov <[email protected]>
commit f6789593d5cea42a4ecb1cbeab6a23ade5ebbba7 upstream.
Under memory pressure, it is possible for dirty_thresh, calculated by global_dirty_limits() in balance_dirty_pages(), to equal zero. Then, if strictlimit is true, bdi_dirty_limits() tries to resolve the proportion:
bdi_bg_thresh : bdi_thresh = background_thresh : dirty_thresh
by dividing by zero.
--- mm/page-writeback.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
mm/page-writeback.c +3 -3
@@ -1324,9 +1324,9 @@ static inline void bdi_dirty_limits(stru *bdi_thresh =bdi_dirty_limit (bdi, dirty_thresh);if (bdi_bg_thresh) - *bdi_bg_thresh =div_u64 ((u64)*bdi_thresh * - background_thresh, - dirty_thresh); + *bdi_bg_thresh = dirty_thresh ?div_u64 ((u64)*bdi_thresh * + background_thresh, + dirty_thresh) :0 ;/* * In order to avoid the stacked BDI deadlock we need
Greg Kroah-Hartman
maintainerPATCH 11/39 mm, thp: do not allow thp faults to avoid cpuset restrictions
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Rientjes <[email protected]>
commit b104a35d32025ca740539db2808aa3385d0f30eb upstream.
The page allocator relies on __GFP_WAIT to determine if ALLOC_CPUSET should be set in allocflags. ALLOC_CPUSET controls if a page allocation should be restricted only to the set of allowed cpuset mems.
Transparent hugepages clears __GFP_WAIT when defrag is disabled to prevent the fault path from using memory compaction or direct reclaim. Thus, it is unfairly able to allocate outside of its cpuset mems restriction as a side-effect.
This patch ensures that ALLOC_CPUSET is only cleared when the gfp mask is truly GFP_ATOMIC by verifying it is also not a thp allocation.
--- mm/page_alloc.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
mm/page_alloc.c +8 -8
@@ -2434,7 +2434,7 @@ static inline int gfp_to_alloc_flags(gfp_t gfp_mask) {int alloc_flags =ALLOC_WMARK_MIN |ALLOC_CPUSET ; -const gfp_t wait = gfp_mask & __GFP_WAIT; +const bool atomic = !(gfp_mask & (__GFP_WAIT | __GFP_NO_KSWAPD));/* __GFP_HIGH is assumed to be the same as ALLOC_HIGH to save a branch. */ BUILD_BUG_ON (__GFP_HIGH != (__force gfp_t )ALLOC_HIGH );
@@ -2443,20 +2443,20 @@ gfp_to_alloc_flags(gfp_t gfp_mask)* The caller may dip into page reserves a bit more if the caller * cannot run direct reclaim, or if the caller has realtime scheduling * policy or is asking for __GFP_HIGH memory. GFP_ATOMIC requests will -* set both ALLOC_HARDER (!wait) and ALLOC_HIGH (__GFP_HIGH). +* set both ALLOC_HARDER (atomic == true) and ALLOC_HIGH (__GFP_HIGH). */ alloc_flags |= (__force int ) (gfp_mask & __GFP_HIGH); -if (!wait) { +if (atomic) {/* -* Not worth trying to allocate harder for -* __GFP_NOMEMALLOC even if it can't schedule. +* Not worth trying to allocate harder for __GFP_NOMEMALLOC even +* if it can't schedule. */ -if (!(gfp_mask & __GFP_NOMEMALLOC)) +if (!(gfp_mask & __GFP_NOMEMALLOC)) alloc_flags |=ALLOC_HARDER ;/* -* Ignore cpuset if GFP_ATOMIC (!wait) rather than fail alloc. -* See also cpuset_zone_allowed() comment in kernel/cpuset.c. +* Ignore cpuset mems for GFP_ATOMIC rather than fail, see the +* comment for __cpuset_node_allowed_softwall(). */ alloc_flags &= ~ALLOC_CPUSET ; }else if (unlikely (rt_task (current)) && !in_interrupt ())
Greg Kroah-Hartman
maintainerPATCH 12/39 memcg: oom_notify use-after-free fix
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michal Hocko <[email protected]>
commit 2bcf2e92c3918ce62ab4e934256e47e9a16d19c3 upstream.
Paul Furtado has reported the following GPF:
general protection fault: 0000 [#1] SMP
Modules linked in: ipv6 dm_mod xen_netfront coretemp hwmon x86_pkg_temp_thermal crc32_pclmul crc32c_intel ghash_clmulni_intel aesni_intel ablk_helper cryptd lrw gf128mul glue_helper aes_x86_64 microcode pcspkr ext4 jbd2 mbcache raid0 xen_blkfront
CPU: 3 PID: 3062 Comm: java Not tainted 3.16.0-rc5 #1
task: ffff8801cfe8f170 ti: ffff8801d2ec4000 task.ti: ffff8801d2ec4000
RIP: e030:mem_cgroup_oom_synchronize+0x140/0x240
RSP: e02b:ffff8801d2ec7d48 EFLAGS: 00010283
RAX: 0000000000000001 RBX: ffff88009d633800 RCX: 000000000000000e
RDX: fffffffffffffffe RSI: ffff88009d630200 RDI: ffff88009d630200
RBP: ffff8801d2ec7da8 R08: 0000000000000012 R09: 00000000fffffffe
R10: 0000000000000000 R11: 0000000000000000 R12: ffff88009d633800
R13: ffff8801d2ec7d48 R14: dead000000100100 R15: ffff88009d633a30
FS: 00007f1748bb4700(0000) GS:ffff8801def80000(0000) knlGS:0000000000000000
CS: e033 DS: 0000 ES: 0000 CR0: 000000008005003b
CR2: 00007f4110300308 CR3: 00000000c05f7000 CR4: 0000000000002660
Call Trace:
pagefault_out_of_memory+0x18/0x90
mm_fault_error+0xa9/0x1a0
__do_page_fault+0x478/0x4c0
do_page_fault+0x2c/0x40
page_fault+0x28/0x30
Code: 44 00 00 48 89 df e8 40 ca ff ff 48 85 c0 49 89 c4 74 35 4c 8b b0 30 02 00 00 4c 8d b8 30 02 00 00 4d 39 fe 74 1b 0f 1f 44 00 00 <49> 8b 7e 10 be 01 00 00 00 e8 42 d2 04 00 4d 8b 36 4d 39 fe 75
RIP mem_cgroup_oom_synchronize+0x140/0x240Commit fb2a6fc56be6 ("mm: memcg: rework and document OOM waiting and wakeup") has moved mem_cgroup_oom_notify outside of memcg_oom_lock assuming it is protected by the hierarchical OOM-lock.
Although this is true for the notification part the protection doesn't cover unregistration of event which can happen in parallel now so mem_cgroup_oom_notify can see already unlinked and/or freed mem_cgroup_eventfd_list.
Fix this by using memcg_oom_lock also in mem_cgroup_oom_notify.
Addresses https://bugzilla.kernel.org/show_bug.cgi?id=80881
--- mm/memcontrol.c | 4 ++++ 1 file changed, 4 insertions(+)
mm/memcontrol.c +4 -0
@@ -5670,8 +5670,12 @@ static int mem_cgroup_oom_notify_cb(stru {struct mem_cgroup_eventfd_list *ev; +spin_lock (&memcg_oom_lock); +list_for_each_entry (ev, &memcg->oom_notify, list)eventfd_signal (ev->eventfd,1 ); + +spin_unlock (&memcg_oom_lock);return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 13/39 staging: vt6655: Fix disassociated messages every 10 seconds
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Malcolm Priestley <[email protected]>
commit 4aa0abed3a2a11b7d71ad560c1a3e7631c5a31cd upstream.
byReAssocCount is incremented every second resulting in disassociated message being send every 10 seconds whether connection or not.
byReAssocCount should only advance while eCommandState is in WLAN_ASSOCIATE_WAIT
Change existing scope to if condition.
--- drivers/staging/vt6655/bssdb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/vt6655/bssdb.c +1 -1
@@ -983,7 +983,7 @@ start: pDevice->byERPFlag &= ~(WLAN_SET_ERP_USE_PROTECTION (1 )); } - { +if (pDevice->eCommandState ==WLAN_ASSOCIATE_WAIT ) { pDevice->byReAssocCount++;/* 10 sec timeout */ if ((pDevice->byReAssocCount >10 ) && (!pDevice->bLinkPass)) {
Greg Kroah-Hartman
maintainerPATCH 14/39 ACPI / PNP: Fix acpi_pnp_match()
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: "Rafael J. Wysocki" <[email protected]>
commit b6328a07bd6b3d31b64f85864fe74f3b08c010ca upstream.
The acpi_pnp_match() function is used for finding the ACPI device object that should be associated with the given PNP device. Unfortunately, the check used by that function is not strict enough and may cause success to be returned for a wrong ACPI device object.
To fix that, use the observation that the pointer to the ACPI device object in question is already stored in the data field in struct pnp_dev, so acpi_pnp_match() can simply use that field to do its job.
This problem was uncovered in 3.14 by commit 202317a573b2 (ACPI / scan:
Add acpi_device objects for all device nodes in the namespace).
--- drivers/pnp/pnpacpi/core.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/pnp/pnpacpi/core.c +1 -2
@@ -339,8 +339,7 @@ static int __init acpi_pnp_match(structstruct pnp_dev *pnp = _pnp;/* true means it matched */ -return !acpi->physical_node_count - &&compare_pnp_id (pnp->id,acpi_device_hid (acpi)); +return pnp->data == acpi; }static struct acpi_device *__init acpi_pnp_find_companion (struct device *dev)
Greg Kroah-Hartman
maintainerPATCH 15/39 iio:bma180: Fix scale factors to report correct acceleration units
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Peter Meerwald <[email protected]>
commit 381676d5e86596b11e22a62f196e192df6091373 upstream.
The userspace interface for acceleration sensors is documented as using m/s^2 units [Documentation/ABI/testing/sysfs-bus-iio]
The fullscale raw values for the BMA80 corresponds to -/+ 1, 1.5, 2, etc G depending on the selected mode.
The scale table was converting to G rather than m/s^2. Change the scaling table to match the documented interface.
See commit 71702e6e, iio: mma8452: Use correct acceleration units, for a related fix.
--- drivers/iio/accel/bma180.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/iio/accel/bma180.c +3 -3
@@ -68,13 +68,13 @@/* Defaults values */ #define BMA180_DEF_PMODE 0#define BMA180_DEF_BW 20 -#define BMA180_DEF_SCALE 250 +#define BMA180_DEF_SCALE 2452/* Available values for sysfs */ #define BMA180_FLP_FREQ_AVAILABLE \ "10 20 40 75 150 300"#define BMA180_SCALE_AVAILABLE \ - "0.000130 0.000190 0.000250 0.000380 0.000500 0.000990 0.001980" + "0.001275 0.001863 0.002452 0.003727 0.004903 0.009709 0.019417"struct bma180_data {struct i2c_client *client;
@@ -94,7 +94,7 @@ enum bma180_axis { };static int bw_table[] = {10 ,20 ,40 ,75 ,150 ,300 };/* Hz */ -static int scale_table[] = {130 ,190 ,250 ,380 ,500 ,990 ,1980 }; +static int scale_table[] = {1275 ,1863 ,2452 ,3727 ,4903 ,9709 ,19417 };static int bma180_get_acc_reg (struct bma180_data *data,enum bma180_axis axis) {
Greg Kroah-Hartman
maintainerPATCH 16/39 iio:bma180: Missing check for frequency fractional part
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Peter Meerwald <[email protected]>
commit 9b2a4d35a6ceaf217be61ed8eb3c16986244f640 upstream.
val2 should be zero
This will make no difference for correct inputs but will reject incorrect ones with a decimal part in the value written to the sysfs interface.
--- drivers/iio/accel/bma180.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/iio/accel/bma180.c +2 -0
@@ -376,6 +376,8 @@ static int bma180_write_raw(struct iio_dmutex_unlock (&data->mutex);return ret;case IIO_CHAN_INFO_LOW_PASS_FILTER_3DB_FREQUENCY : +if (val2) +return -EINVAL ;mutex_lock (&data->mutex); ret =bma180_set_bw (data, val);mutex_unlock (&data->mutex);
Greg Kroah-Hartman
maintainerPATCH 17/39 iio: buffer: Fix demux table creation
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lars-Peter Clausen <[email protected]>
commit 61bd55ce1667809f022be88da77db17add90ea4e upstream.
When creating the demux table we need to iterate over the selected scan mask for the buffer to get the samples which should be copied to destination buffer. Right now the code uses the mask which contains all active channels, which means the demux table contains entries which causes it to copy all the samples from source to destination buffer one by one without doing any demuxing.
--- drivers/iio/industrialio-buffer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/industrialio-buffer.c +1 -1
@@ -953,7 +953,7 @@ static int iio_buffer_update_demux(struc/* Now we have the two masks, work from least sig and build up sizes */ for_each_set_bit (out_ind, - indio_dev->active_scan_mask, + buffer->scan_mask, indio_dev->masklength) { in_ind = find_next_bit(indio_dev->active_scan_mask, indio_dev->masklength,
Greg Kroah-Hartman
maintainerPATCH 18/39 dm bufio: fully initialize shrinker
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Greg Thelen <[email protected]>
commit d8c712ea471ce7a4fd1734ad2211adf8469ddddc upstream.
1d3d4437eae1 ("vmscan: per-node deferred work") added a flags field to struct shrinker assuming that all shrinkers were zero filled. The dm bufio shrinker is not zero filled, which leaves arbitrary kmalloc() data in flags. So far the only defined flags bit is SHRINKER_NUMA_AWARE. But there are proposed patches which add other bits to shrinker.flags (e.g. memcg awareness).
Rather than simply initializing the shrinker, this patch uses kzalloc() when allocating the dm_bufio_client to ensure that the embedded shrinker and any other similar structures are zeroed.
This fixes theoretical over aggressive shrinking of dm bufio objects. If the uninitialized dm_bufio_client.shrinker.flags contains SHRINKER_NUMA_AWARE then shrink_slab() would call the dm shrinker for each numa node rather than just once. This has been broken since 3.12.
--- drivers/md/dm-bufio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/md/dm-bufio.c +1 -1
@@ -1541,7 +1541,7 @@ struct dm_bufio_client *dm_bufio_client_BUG_ON (block_size <1 <<SECTOR_SHIFT || (block_size & (block_size -1 ))); - c =kmalloc (sizeof (*c),GFP_KERNEL ); + c =kzalloc (sizeof (*c),GFP_KERNEL );if (!c) { r = -ENOMEM ; goto bad_client;
Greg Kroah-Hartman
maintainerPATCH 19/39 dm cache: fix race affecting dirty block count
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Anssi Hannula <[email protected]>
commit 44fa816bb778edbab6b6ddaaf24908dd6295937e upstream.
nr_dirty is updated without locking, causing it to drift so that it is non-zero (either a small positive integer, or a very large one when an underflow occurs) even when there are no actual dirty blocks. This was due to a race between the workqueue and map function accessing nr_dirty in parallel without proper protection.
People were seeing under runs due to a race on increment/decrement of nr_dirty, see: https://lkml.org/lkml/2014/6/3/648
Fix this by using an atomic_t for nr_dirty.
--- drivers/md/dm-cache-target.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-)
drivers/md/dm-cache-target.c +6 -7
@@ -231,7 +231,7 @@ struct cache {/* * cache_size entries, dirty if set */ -dm_cblock_t nr_dirty; +atomic_t nr_dirty;unsigned long *dirty_bitset;/*
@@ -493,7 +493,7 @@ static bool is_dirty(struct cache *cachestatic void set_dirty (struct cache *cache,dm_oblock_t oblock,dm_cblock_t cblock) {if (!test_and_set_bit (from_cblock (cblock), cache->dirty_bitset)) { - cache->nr_dirty =to_cblock (from_cblock (cache->nr_dirty) +1 ); +atomic_inc (&cache->nr_dirty);policy_set_dirty (cache->policy, oblock); } }
@@ -502,8 +502,7 @@ static void clear_dirty(struct cache *ca {if (test_and_clear_bit (from_cblock (cblock), cache->dirty_bitset)) {policy_clear_dirty (cache->policy, oblock); - cache->nr_dirty =to_cblock (from_cblock (cache->nr_dirty) -1 ); -if (!from_cblock (cache->nr_dirty)) +if (atomic_dec_return (&cache->nr_dirty) ==0 )dm_table_event (cache->ti->table); } }
@@ -2286,7 +2285,7 @@ static int cache_create(struct cache_argatomic_set (&cache->quiescing_ack,0 ); r = -ENOMEM ; - cache->nr_dirty =0 ; +atomic_set (&cache->nr_dirty,0 ); cache->dirty_bitset =alloc_bitset (from_cblock (cache->cache_size));if (!cache->dirty_bitset) { *error ="could not allocate dirty bitset" ;
@@ -2828,7 +2827,7 @@ static void cache_status(struct dm_targe residency =policy_residency (cache->policy); - DMEMIT("%u %llu/%llu %u %llu/%llu %u %u %u %u %u %u %llu ", + DMEMIT("%u %llu/%llu %u %llu/%llu %u %u %u %u %u %u %lu ", (unsigned)(DM_CACHE_METADATA_BLOCK_SIZE >> SECTOR_SHIFT), (unsigned long long)(nr_blocks_metadata - nr_free_blocks_metadata), (unsigned long long)nr_blocks_metadata,
@@ -2841,7 +2840,7 @@ static void cache_status(struct dm_targe (unsigned )atomic_read (&cache->stats.write_miss), (unsigned )atomic_read (&cache->stats.demotion), (unsigned )atomic_read (&cache->stats.promotion), - (unsigned long long) from_cblock(cache->nr_dirty)); + (unsigned long) atomic_read(&cache->nr_dirty));if (writethrough_mode (&cache->features))DMEMIT ("1 writethrough " );
Greg Kroah-Hartman
maintainerPATCH 20/39 printk: rename printk_sched to printk_deferred
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: John Stultz <[email protected]>
commit aac74dc495456412c4130a1167ce4beb6c1f0b38 upstream.
After learning we'll need some sort of deferred printk functionality in the timekeeping core, Peter suggested we rename the printk_sched function so it can be reused by needed subsystems.
This only changes the function name. No logic changes.
--- include/linux/printk.h | 6 +++--- kernel/printk/printk.c | 2 +- kernel/sched/core.c | 2 +- kernel/sched/deadline.c | 2 +- kernel/sched/rt.c | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-)
include/linux/printk.h +3 -3
@@ -132,9 +132,9 @@ asmlinkage __printf(1, 2) __coldint printk (const char *fmt, ...);/* -* Special printk facility for scheduler use only, _DO_NOT_USE_ ! +* Special printk facility for scheduler/timekeeping use only, _DO_NOT_USE_ ! */ -__printf(1, 2) __cold int printk_sched(const char *fmt, ...); +__printf(1, 2) __cold int printk_deferred(const char *fmt, ...);/* * Please don't use printk_ratelimit(), because it shares ratelimiting state
@@ -169,7 +169,7 @@ int printk(const char *s, ...)return 0 ; } static inline __printf(1, 2) __cold -int printk_sched(const char *s, ...) +int printk_deferred(const char *s, ...) {return 0 ; }
kernel/printk/printk.c +1 -1
@@ -2468,7 +2468,7 @@ void wake_up_klogd(void)preempt_enable (); } -int printk_sched (const char *fmt, ...) +int printk_deferred (const char *fmt, ...) {unsigned long flags;va_list args;
kernel/sched/core.c +1 -1
@@ -1322,7 +1322,7 @@ out:* leave kernel. */ if (p->mm &&printk_ratelimit ()) { -printk_sched ("process %d (%s) no longer affine to cpu%d\n" , +printk_deferred ("process %d (%s) no longer affine to cpu%d\n" ,task_pid_nr (p), p->comm, cpu); } }
kernel/sched/deadline.c +1 -1
@@ -329,7 +329,7 @@ static void replenish_dl_entity(struct sif (!lag_once) { lag_once = true; -printk_sched ("sched: DL replenish lagged to much\n" ); +printk_deferred ("sched: DL replenish lagged to much\n" ); } dl_se->deadline =rq_clock (rq) + pi_se->dl_deadline; dl_se->runtime = pi_se->dl_runtime;
kernel/sched/rt.c +1 -1
@@ -837,7 +837,7 @@ static int sched_rt_runtime_exceeded(strif (!once) { once = true; -printk_sched ("sched: RT throttling activated\n" ); +printk_deferred ("sched: RT throttling activated\n" ); } }else {/*
Greg Kroah-Hartman
maintainerPATCH 21/39 sched_clock: Avoid corrupting hrtimer tree during suspend
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stephen Boyd <[email protected]>
commit f723aa1817dd8f4fe005aab52ba70c8ab0ef9457 upstream.
During suspend we call sched_clock_poll() to update the epoch and accumulated time and reprogram the sched_clock_timer to fire before the next wrap-around time. Unfortunately, sched_clock_poll() doesn't restart the timer, instead it relies on the hrtimer layer to do that and during suspend we aren't calling that function from the hrtimer layer. Instead, we're reprogramming the expires time while the hrtimer is enqueued, which can cause the hrtimer tree to be corrupted. Furthermore, we restart the timer during suspend but we update the epoch during resume which seems counter-intuitive.
Let's fix this by saving the accumulated state and canceling the timer during suspend. On resume we can update the epoch and restart the timer similar to what we would do if we were starting the clock for the first time.
--- kernel/time/sched_clock.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
kernel/time/sched_clock.c +3 -1
@@ -204,7 +204,8 @@ void __init sched_clock_postinit(void)static int sched_clock_suspend (void ) { -sched_clock_poll (&sched_clock_timer); +update_sched_clock (); +hrtimer_cancel (&sched_clock_timer); cd.suspended = true;return 0 ; }
@@ -212,6 +213,7 @@ static int sched_clock_suspend(void)static void sched_clock_resume (void ) { cd.epoch_cyc =read_sched_clock (); +hrtimer_start (&sched_clock_timer, cd.wrap_kt,HRTIMER_MODE_REL ); cd.suspended = false; }
Greg Kroah-Hartman
maintainerPATCH 22/39 timer: Fix lock inversion between hrtimer_bases.lock and scheduler locks
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jan Kara <[email protected]>
commit 504d58745c9ca28d33572e2d8a9990b43e06075d upstream.
clockevents_increase_min_delta() calls printk() from under hrtimer_bases.lock. That causes lock inversion on scheduler locks because printk() can call into the scheduler. Lockdep puts it as:
======================================================
[ INFO: possible circular locking dependency detected ] 3.15.0-rc8-06195-g939f04b #2 Not tainted
-------------------------------------------------------
trinity-main/74 is trying to acquire lock:
(&port_lock_key){-.....}, at: [<811c60be>] serial8250_console_write+0x8c/0x10c
but task is already holding lock:
(hrtimer_bases.lock){-.-...}, at: [<8103caeb>] hrtimer_try_to_cancel+0x13/0x66
which lock already depends on the new lock.
the existing dependency chain (in reverse order) is:
-> #5 (hrtimer_bases.lock){-.-...}:
[<8104a942>] lock_acquire+0x92/0x101
[<8142f11d>] _raw_spin_lock_irqsave+0x2e/0x3e
[<8103c918>] __hrtimer_start_range_ns+0x1c/0x197
[<8107ec20>] perf_swevent_start_hrtimer.part.41+0x7a/0x85
[<81080792>] task_clock_event_start+0x3a/0x3f
[<810807a4>] task_clock_event_add+0xd/0x14
[<8108259a>] event_sched_in+0xb6/0x17a
[<810826a2>] group_sched_in+0x44/0x122
[<81082885>] ctx_sched_in.isra.67+0x105/0x11f
[<810828e6>] perf_event_sched_in.isra.70+0x47/0x4b
[<81082bf6>] __perf_install_in_context+0x8b/0xa3
[<8107eb8e>] remote_function+0x12/0x2a
[<8105f5af>] smp_call_function_single+0x2d/0x53
[<8107e17d>] task_function_call+0x30/0x36
[<8107fb82>] perf_install_in_context+0x87/0xbb
[<810852c9>] SYSC_perf_event_open+0x5c6/0x701
[<810856f9>] SyS_perf_event_open+0x17/0x19
[<8142f8ee>] syscall_call+0x7/0xb-> #4 (&ctx->lock){......}:
[<8104a942>] lock_acquire+0x92/0x101
[<8142f04c>] _raw_spin_lock+0x21/0x30
[<81081df3>] __perf_event_task_sched_out+0x1dc/0x34f
[<8142cacc>] __schedule+0x4c6/0x4cb
[<8142cae0>] schedule+0xf/0x11
[<8142f9a6>] work_resched+0x5/0x30-> #3 (&rq->lock){-.-.-.}:
[<8104a942>] lock_acquire+0x92/0x101
[<8142f04c>] _raw_spin_lock+0x21/0x30
[<81040873>] __task_rq_lock+0x33/0x3a
[<8104184c>] wake_up_new_task+0x25/0xc2
[<8102474b>] do_fork+0x15c/0x2a0
[<810248a9>] kernel_thread+0x1a/0x1f
[<814232a2>] rest_init+0x1a/0x10e
[<817af949>] start_kernel+0x303/0x308
[<817af2ab>] i386_start_kernel+0x79/0x7d-> #2 (&p->pi_lock){-.-...}:
[<8104a942>] lock_acquire+0x92/0x101
[<8142f11d>] _raw_spin_lock_irqsave+0x2e/0x3e
[<810413dd>] try_to_wake_up+0x1d/0xd6
[<810414cd>] default_wake_function+0xb/0xd
[<810461f3>] __wake_up_common+0x39/0x59
[<81046346>] __wake_up+0x29/0x3b
[<811b8733>] tty_wakeup+0x49/0x51
[<811c3568>] uart_write_wakeup+0x17/0x19
[<811c5dc1>] serial8250_tx_chars+0xbc/0xfb
[<811c5f28>] serial8250_handle_irq+0x54/0x6a
[<811c5f57>] serial8250_default_handle_irq+0x19/0x1c
[<811c56d8>] serial8250_interrupt+0x38/0x9e
[<810510e7>] handle_irq_event_percpu+0x5f/0x1e2
[<81051296>] handle_irq_event+0x2c/0x43
[<81052cee>] handle_level_irq+0x57/0x80
[<81002a72>] handle_irq+0x46/0x5c
[<810027df>] do_IRQ+0x32/0x89
[<8143036e>] common_interrupt+0x2e/0x33
[<8142f23c>] _raw_spin_unlock_irqrestore+0x3f/0x49
[<811c25a4>] uart_start+0x2d/0x32
[<811c2c04>] uart_write+0xc7/0xd6
[<811bc6f6>] n_tty_write+0xb8/0x35e
[<811b9beb>] tty_write+0x163/0x1e4
[<811b9cd9>] redirected_tty_write+0x6d/0x75
[<810b6ed6>] vfs_write+0x75/0xb0
[<810b7265>] SyS_write+0x44/0x77
[<8142f8ee>] syscall_call+0x7/0xb-> #1 (&tty->write_wait){-.....}:
[<8104a942>] lock_acquire+0x92/0x101
[<8142f11d>] _raw_spin_lock_irqsave+0x2e/0x3e
[<81046332>] __wake_up+0x15/0x3b
[<811b8733>] tty_wakeup+0x49/0x51
[<811c3568>] uart_write_wakeup+0x17/0x19
[<811c5dc1>] serial8250_tx_chars+0xbc/0xfb
[<811c5f28>] serial8250_handle_irq+0x54/0x6a
[<811c5f57>] serial8250_default_handle_irq+0x19/0x1c
[<811c56d8>] serial8250_interrupt+0x38/0x9e
[<810510e7>] handle_irq_event_percpu+0x5f/0x1e2
[<81051296>] handle_irq_event+0x2c/0x43
[<81052cee>] handle_level_irq+0x57/0x80
[<81002a72>] handle_irq+0x46/0x5c
[<810027df>] do_IRQ+0x32/0x89
[<8143036e>] common_interrupt+0x2e/0x33
[<8142f23c>] _raw_spin_unlock_irqrestore+0x3f/0x49
[<811c25a4>] uart_start+0x2d/0x32
[<811c2c04>] uart_write+0xc7/0xd6
[<811bc6f6>] n_tty_write+0xb8/0x35e
[<811b9beb>] tty_write+0x163/0x1e4
[<811b9cd9>] redirected_tty_write+0x6d/0x75
[<810b6ed6>] vfs_write+0x75/0xb0
[<810b7265>] SyS_write+0x44/0x77
[<8142f8ee>] syscall_call+0x7/0xb-> #0 (&port_lock_key){-.....}:
[<8104a62d>] __lock_acquire+0x9ea/0xc6d
[<8104a942>] lock_acquire+0x92/0x101
[<8142f11d>] _raw_spin_lock_irqsave+0x2e/0x3e
[<811c60be>] serial8250_console_write+0x8c/0x10c
[<8104e402>] call_console_drivers.constprop.31+0x87/0x118
[<8104f5d5>] console_unlock+0x1d7/0x398
[<8104fb70>] vprintk_emit+0x3da/0x3e4
[<81425f76>] printk+0x17/0x19
[<8105bfa0>] clockevents_program_min_delta+0x104/0x116
[<8105c548>] clockevents_program_event+0xe7/0xf3
[<8105cc1c>] tick_program_event+0x1e/0x23
[<8103c43c>] hrtimer_force_reprogram+0x88/0x8f
[<8103c49e>] __remove_hrtimer+0x5b/0x79
[<8103cb21>] hrtimer_try_to_cancel+0x49/0x66
[<8103cb4b>] hrtimer_cancel+0xd/0x18
[<8107f102>] perf_swevent_cancel_hrtimer.part.60+0x2b/0x30
[<81080705>] task_clock_event_stop+0x20/0x64
[<81080756>] task_clock_event_del+0xd/0xf
[<81081350>] event_sched_out+0xab/0x11e
[<810813e0>] group_sched_out+0x1d/0x66
[<81081682>] ctx_sched_out+0xaf/0xbf
[<81081e04>] __perf_event_task_sched_out+0x1ed/0x34f
[<8142cacc>] __schedule+0x4c6/0x4cb
[<8142cae0>] schedule+0xf/0x11
[<8142f9a6>] work_resched+0x5/0x30other info that might help us debug this:
Chain exists of: &port_lock_key --> &ctx->lock --> hrtimer_bases.lock Possible unsafe locking scenario:
CPU0 CPU1
---- ----
lock(hrtimer_bases.lock);
lock(&ctx->lock);
lock(hrtimer_bases.lock); lock(&port_lock_key);
*** DEADLOCK ***
4 locks held by trinity-main/74:
#0: (&rq->lock){-.-.-.}, at: [<8142c6f3>] __schedule+0xed/0x4cb
#1: (&ctx->lock){......}, at: [<81081df3>] __perf_event_task_sched_out+0x1dc/0x34f
#2: (hrtimer_bases.lock){-.-...}, at: [<8103caeb>] hrtimer_try_to_cancel+0x13/0x66
#3: (console_lock){+.+...}, at: [<8104fb5d>] vprintk_emit+0x3c7/0x3e4stack backtrace: CPU: 0 PID: 74 Comm: trinity-main Not tainted 3.15.0-rc8-06195-g939f04b #2 00000000 81c3a310 8b995c14 81426f69 8b995c44 81425a99 8161f671 8161f570 8161f538 8161f559 8161f538 8b995c78 8b142bb0 00000004 8b142fdc 8b142bb0 8b995ca8 8104a62d 8b142fac 000016f2 81c3a310 00000001 00000001 00000003 Call Trace: [<81426f69>] dump_stack+0x16/0x18 [<81425a99>] print_circular_bug+0x18f/0x19c [<8104a62d>] __lock_acquire+0x9ea/0xc6d [<8104a942>] lock_acquire+0x92/0x101 [<811c60be>] ? serial8250_console_write+0x8c/0x10c [<811c6032>] ? wait_for_xmitr+0x76/0x76 [<8142f11d>] _raw_spin_lock_irqsave+0x2e/0x3e [<811c60be>] ? serial8250_console_write+0x8c/0x10c [<811c60be>] serial8250_console_write+0x8c/0x10c [<8104af87>] ? lock_release+0x191/0x223 [<811c6032>] ? wait_for_xmitr+0x76/0x76 [<8104e402>] call_console_drivers.constprop.31+0x87/0x118 [<8104f5d5>] console_unlock+0x1d7/0x398 [<8104fb70>] vprintk_emit+0x3da/0x3e4 [<81425f76>] printk+0x17/0x19 [<8105bfa0>] clockevents_program_min_delta+0x104/0x116 [<8105cc1c>] tick_program_event+0x1e/0x23 [<8103c43c>] hrtimer_force_reprogram+0x88/0x8f [<8103c49e>] __remove_hrtimer+0x5b/0x79 [<8103cb21>] hrtimer_try_to_cancel+0x49/0x66 [<8103cb4b>] hrtimer_cancel+0xd/0x18 [<8107f102>] perf_swevent_cancel_hrtimer.part.60+0x2b/0x30 [<81080705>] task_clock_event_stop+0x20/0x64 [<81080756>] task_clock_event_del+0xd/0xf [<81081350>] event_sched_out+0xab/0x11e [<810813e0>] group_sched_out+0x1d/0x66 [<81081682>] ctx_sched_out+0xaf/0xbf [<81081e04>] __perf_event_task_sched_out+0x1ed/0x34f [<8104416d>] ? __dequeue_entity+0x23/0x27 [<81044505>] ? pick_next_task_fair+0xb1/0x120 [<8142cacc>] __schedule+0x4c6/0x4cb [<81047574>] ? trace_hardirqs_off_caller+0xd7/0x108 [<810475b0>] ? trace_hardirqs_off+0xb/0xd [<81056346>] ? rcu_irq_exit+0x64/0x77
Fix the problem by using printk_deferred() which does not call into the scheduler.
--- kernel/time/clockevents.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
kernel/time/clockevents.c +6 -4
@@ -146,7 +146,8 @@ static int clockevents_increase_min_delt {/* Nothing to do if we already reached the limit */ if (dev->min_delta_ns >=MIN_DELTA_LIMIT ) { -printk (KERN_WARNING "CE: Reprogramming failure. Giving up\n" ); +printk_deferred (KERN_WARNING +"CE: Reprogramming failure. Giving up\n" ); dev->next_event.tv64 =KTIME_MAX ;return -ETIME ; }
@@ -159,9 +160,10 @@ static int clockevents_increase_min_deltif (dev->min_delta_ns >MIN_DELTA_LIMIT ) dev->min_delta_ns =MIN_DELTA_LIMIT ; -printk (KERN_WARNING "CE: %s increased min_delta_ns to %llu nsec\n" , - dev->name ? dev->name :"?" , - (unsigned long long ) dev->min_delta_ns); +printk_deferred (KERN_WARNING +"CE: %s increased min_delta_ns to %llu nsec\n" , + dev->name ? dev->name :"?" , + (unsigned long long ) dev->min_delta_ns);return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 23/39 Revert "x86-64, modify_ldt: Make support for 16-bit segments a runtime option"
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: "H. Peter Anvin" <[email protected]>
commit 7ed6fb9b5a5510e4ef78ab27419184741169978a upstream.
This reverts commit fa81511bb0bbb2b1aace3695ce869da9762624ff in preparation of merging in the proper fix (espfix64).
--- arch/x86/kernel/ldt.c | 4 +--- arch/x86/vdso/vdso32-setup.c | 8 -------- 2 files changed, 1 insertion(+), 11 deletions(-)
arch/x86/kernel/ldt.c +1 -3
@@ -20,8 +20,6 @@#include <asm/mmu_context.h> #include <asm/syscalls.h> -int sysctl_ldt16 =0 ; -#ifdef CONFIG_SMP static void flush_ldt (void *current_mm) {
@@ -236,7 +234,7 @@ static int write_ldt(void __user *ptr, u* IRET leaking the high bits of the kernel stack address. */ #ifdef CONFIG_X86_64 -if (!ldt_info.seg_32bit && !sysctl_ldt16) { +if (!ldt_info.seg_32bit) { error = -EINVAL ; goto out_unlock; }
arch/x86/vdso/vdso32-setup.c +0 -8
@@ -41,7 +41,6 @@ enum {#ifdef CONFIG_X86_64 #define vdso_enabled sysctl_vsyscall32#define arch_setup_additional_pages syscall32_setup_pages -extern int sysctl_ldt16;#endif /*
@@ -380,13 +379,6 @@ static struct ctl_table abi_table2[] = { .maxlen = sizeof(int), .mode = 0644, .proc_handler = proc_dointvec - }, - { - .procname = "ldt16", - .data = &sysctl_ldt16, - .maxlen = sizeof(int), - .mode = 0644, - .proc_handler = proc_dointvec }, {} };
Greg Kroah-Hartman
maintainerPATCH 24/39 x86-64, espfix: Dont leak bits 31:16 of %esp returning to 16-bit stack
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: "H. Peter Anvin" <[email protected]>
commit 3891a04aafd668686239349ea58f3314ea2af86b upstream.
The IRET instruction, when returning to a 16-bit segment, only restores the bottom 16 bits of the user space stack pointer. This causes some 16-bit software to break, but it also leaks kernel state to user space. We have a software workaround for that ("espfix") for the 32-bit kernel, but it relies on a nonzero stack segment base which is not available in 64-bit mode.
In checkin:
b3b42ac2cbae x86-64, modify_ldt: Ban 16-bit segments on 64-bit kernels
we "solved" this by forbidding 16-bit segments on 64-bit kernels, with the logic that 16-bit support is crippled on 64-bit kernels anyway (no V86 support), but it turns out that people are doing stuff like running old Win16 binaries under Wine and expect it to work.
This works around this by creating percpu "ministacks", each of which is mapped 2^16 times 64K apart. When we detect that the return SS is on the LDT, we copy the IRET frame to the ministack and use the relevant alias to return to userspace. The ministacks are mapped readonly, so if IRET faults we promote #GP to #DF which is an IST vector and thus has its own stack; we then do the fixup in the #DF handler.
(Making #GP an IST exception would make the msr_safe functions unsafe in NMI/MC context, and quite possibly have other effects.)
Special thanks to:
- Andy Lutomirski, for the suggestion of using very small stack slots and copy (as opposed to map) the IRET frame there, and for the suggestion to mark them readonly and let the fault promote to #DF.
- Konrad Wilk for paravirt fixup and testing.
- Borislav Petkov for testing help and useful comments.
--- Documentation/x86/x86_64/mm.txt | 2 arch/x86/include/asm/pgtable_64_types.h | 2 arch/x86/include/asm/setup.h | 3 arch/x86/kernel/Makefile | 1 arch/x86/kernel/entry_64.S | 73 ++++++++++- arch/x86/kernel/espfix_64.c | 208 ++++++++++++++++++++++++++++++++ arch/x86/kernel/ldt.c | 11 - arch/x86/kernel/smpboot.c | 7 + arch/x86/mm/dump_pagetables.c | 31 +++- init/main.c | 4 10 files changed, 316 insertions(+), 26 deletions(-)
Documentation/x86/x86_64/mm.txt +2 -0
@@ -12,6 +12,8 @@ ffffc90000000000 - ffffe8ffffffffff (=45 ffffe90000000000 - ffffe9ffffffffff (=40 bits) hole ffffea0000000000 - ffffeaffffffffff (=40 bits) virtual memory map (1TB) ... unused hole ... +ffffff0000000000 - ffffff7fffffffff (=39 bits) %esp fixup stacks +... unused hole ... ffffffff80000000 - ffffffffa0000000 (=512 MB) kernel text mapping, from phys 0 ffffffffa0000000 - ffffffffff5fffff (=1525 MB) module mapping space ffffffffff600000 - ffffffffffdfffff (=8 MB) vsyscalls
arch/x86/include/asm/pgtable_64_types.h +2 -0
@@ -61,6 +61,8 @@ typedef struct { pteval_t pte; } pte_t;#define MODULES_VADDR (__START_KERNEL_map + KERNEL_IMAGE_SIZE)#define MODULES_END _AC(0xffffffffff000000, UL)#define MODULES_LEN (MODULES_END - MODULES_VADDR) +#define ESPFIX_PGD_ENTRY _AC(-2, UL) +#define ESPFIX_BASE_ADDR (ESPFIX_PGD_ENTRY << PGDIR_SHIFT)#define EARLY_DYNAMIC_PAGE_TABLES 64
arch/x86/include/asm/setup.h +3 -0
@@ -63,6 +63,9 @@ extern void x86_ce4100_early_setup(void)static inline void x86_ce4100_early_setup (void ) { }#endif +extern void init_espfix_bsp (void ); +extern void init_espfix_ap (void ); +#ifndef _SETUP/*
arch/x86/kernel/Makefile +1 -0
@@ -29,6 +29,7 @@ obj-$(CONFIG_X86_64) += sys_x86_64.o x86 obj-y += syscall_$(BITS).o obj-$(CONFIG_X86_64) += vsyscall_64.o obj-$(CONFIG_X86_64) += vsyscall_emu_64.o +obj-$(CONFIG_X86_64) += espfix_64.o obj-$(CONFIG_SYSFS) += ksysfs.o obj-y += bootflag.o e820.o obj-y += pci-dma.o quirks.o topology.o kdebugfs.o
arch/x86/kernel/entry_64.S +69 -4
112 lines not on this page · raw message
arch/x86/kernel/espfix_64.c new file +208 -0
208 lines not on this page · raw message
arch/x86/kernel/ldt.c +0 -11
@@ -229,17 +229,6 @@ static int write_ldt(void __user *ptr, u } } -/* -* On x86-64 we do not support 16-bit segments due to -* IRET leaking the high bits of the kernel stack address. -*/ -#ifdef CONFIG_X86_64 -if (!ldt_info.seg_32bit) { - error = -EINVAL ; - goto out_unlock; - } -#endif -fill_ldt (&ldt, &ldt_info);if (oldmode) ldt.avl =0 ;
arch/x86/kernel/smpboot.c +7 -0
@@ -243,6 +243,13 @@ static void notrace start_secondary(voidcheck_tsc_sync_target ();/* +* Enable the espfix hack for this CPU +*/ +#ifdef CONFIG_X86_64 +init_espfix_ap (); +#endif + +/* * We need to hold vector_lock so there the set of online cpus * does not change while we are assigning vectors to cpus. Holding * this lock ensures we don't half assign or remove an irq from a cpu.
arch/x86/mm/dump_pagetables.c +20 -11
@@ -30,11 +30,13 @@ struct pg_state {unsigned long start_address;unsigned long current_address;const struct addr_marker *marker; +unsigned long lines; };struct addr_marker {unsigned long start_address;const char *name; +unsigned long max_lines; };/* indices for address_markers; keep sync'd w/ address_markers below */
@@ -45,6 +47,7 @@ enum address_markers_idx {LOW_KERNEL_NR ,VMALLOC_START_NR ,VMEMMAP_START_NR , +ESPFIX_START_NR ,HIGH_KERNEL_NR ,MODULES_VADDR_NR , MODULES_END_NR,
@@ -67,6 +70,7 @@ static struct addr_marker address_marker { PAGE_OFFSET, "Low Kernel Mapping" }, { VMALLOC_START, "vmalloc() Area" }, { VMEMMAP_START, "Vmemmap" }, + { ESPFIX_BASE_ADDR, "ESPfix Area", 16 }, { __START_KERNEL_map, "High Kernel Mapping" }, { MODULES_VADDR, "Modules" }, { MODULES_END, "End Modules" },
@@ -163,7 +167,7 @@ static void note_page(struct seq_file *m pgprot_t new_prot, int level) {pgprotval_t prot, cur; -static const char units[] ="KMGTPE" ; +static const char units[] ="BKMGTPE" ;/* * If we have a "break" in the series, we need to flush the state that
@@ -178,6 +182,7 @@ static void note_page(struct seq_file *m st->current_prot = new_prot; st->level = level; st->marker = address_markers; + st->lines =0 ;seq_printf (m,"---[ %s ]---\n" , st->marker->name); }else if (prot != cur || level != st->level || st->current_address >= st->marker[1 ].start_address) {
@@ -188,17 +193,21 @@ static void note_page(struct seq_file *m/* * Now print the actual finished series */ -seq_printf (m,"0x%0*lx-0x%0*lx " , - width, st->start_address, - width, st->current_address); - - delta = (st->current_address - st->start_address) >>10 ; -while (!(delta &1023 ) && unit[1 ]) { - delta >>=10 ; - unit++; +if (!st->marker->max_lines || + st->lines < st->marker->max_lines) { +seq_printf (m,"0x%0*lx-0x%0*lx " , + width, st->start_address, + width, st->current_address); + + delta = (st->current_address - st->start_address) >>10 ; +while (!(delta &1023 ) && unit[1 ]) { + delta >>=10 ; + unit++; + } +seq_printf (m,"%9lu%c " , delta, *unit); +printk_prot (m, st->current_prot, st->level); } -seq_printf (m,"%9lu%c " , delta, *unit); -printk_prot (m, st->current_prot, st->level); + st->lines++;/* * We print markers for special areas of address space,
init/main.c +4 -0
@@ -617,6 +617,10 @@ asmlinkage void __init start_kernel(voidif (efi_enabled (EFI_RUNTIME_SERVICES ))efi_enter_virtual_mode ();#endif +#ifdef CONFIG_X86_64 +/* Should be run before the first non-init thread is created */ +init_espfix_bsp (); +#endif thread_info_cache_init ();cred_init ();fork_init (totalram_pages);
Greg Kroah-Hartman
maintainerPATCH 25/39 x86, espfix: Move espfix definitions into a separate header file
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: "H. Peter Anvin" <[email protected]>
commit e1fe9ed8d2a4937510d0d60e20705035c2609aea upstream.
Sparse warns that the percpu variables aren't declared before they are defined. Rather than hacking around it, move espfix definitions into a proper header file.
--- arch/x86/include/asm/espfix.h | 16 ++++++++++++++++ arch/x86/include/asm/setup.h | 5 ++--- arch/x86/kernel/espfix_64.c | 1 + 3 files changed, 19 insertions(+), 3 deletions(-)
arch/x86/include/asm/espfix.h new file +16 -0
@@ -0,0 +1,16 @@ +#ifdef _ASM_X86_ESPFIX_H +#define _ASM_X86_ESPFIX_H + +#ifdef CONFIG_X86_64 + +#include <asm/percpu.h> + +DECLARE_PER_CPU_READ_MOSTLY(unsigned long, espfix_stack); +DECLARE_PER_CPU_READ_MOSTLY(unsigned long, espfix_waddr); + +extern void init_espfix_bsp (void ); +extern void init_espfix_ap (void ); + +#endif /* CONFIG_X86_64 */ + +#endif /* _ASM_X86_ESPFIX_H */
arch/x86/include/asm/setup.h +2 -3
@@ -63,11 +63,10 @@ extern void x86_ce4100_early_setup(void)static inline void x86_ce4100_early_setup (void ) { }#endif -extern void init_espfix_bsp (void ); -extern void init_espfix_ap (void ); -#ifndef _SETUP +#include <asm/espfix.h> +/* * This is set up by the setup-routine at boot-time */
arch/x86/kernel/espfix_64.c +1 -0
@@ -40,6 +40,7 @@#include <asm/pgtable.h> #include <asm/pgalloc.h> #include <asm/setup.h> +#include <asm/espfix.h> /* * Note: we only need 6*8 = 48 bytes for the espfix stack, but round
Greg Kroah-Hartman
maintainerPATCH 26/39 x86, espfix: Fix broken header guard
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: "H. Peter Anvin" <[email protected]>
commit 20b68535cd27183ebd3651ff313afb2b97dac941 upstream.
Header guard is #ifndef, not #ifdef...
--- arch/x86/include/asm/espfix.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/include/asm/espfix.h +1 -1
@@ -1,4 +1,4 @@ -#ifdef _ASM_X86_ESPFIX_H +#ifndef _ASM_X86_ESPFIX_H#define _ASM_X86_ESPFIX_H#ifdef CONFIG_X86_64
Greg Kroah-Hartman
maintainerPATCH 27/39 x86, espfix: Make espfix64 a Kconfig option, fix UML
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: "H. Peter Anvin" <[email protected]>
commit 197725de65477bc8509b41388157c1a2283542bb upstream.
Make espfix64 a hidden Kconfig option. This fixes the x86-64 UML build which had broken due to the non-existence of init_espfix_bsp() in UML: since UML uses its own Kconfig, this option does not appear in the UML build.
This also makes it possible to make support for 16-bit segments a configuration option, for the people who want to minimize the size of the kernel.
--- arch/x86/Kconfig | 4 ++++ arch/x86/kernel/Makefile | 2 +- arch/x86/kernel/smpboot.c | 2 +- init/main.c | 2 +- 4 files changed, 7 insertions(+), 3 deletions(-)
arch/x86/Kconfig +4 -0
@@ -971,6 +971,10 @@ config VM86 XFree86 to initialize some video cards via BIOS. Disabling this option saves about 6k. +config X86_ESPFIX64 + def_bool y + depends on X86_64 + config TOSHIBA tristate "Toshiba Laptop support" depends on X86_32
arch/x86/kernel/Makefile +1 -1
@@ -29,7 +29,7 @@ obj-$(CONFIG_X86_64) += sys_x86_64.o x86 obj-y += syscall_$(BITS).o obj-$(CONFIG_X86_64) += vsyscall_64.o obj-$(CONFIG_X86_64) += vsyscall_emu_64.o -obj-$(CONFIG_X86_64) += espfix_64.o +obj-$(CONFIG_X86_ESPFIX64) += espfix_64.o obj-$(CONFIG_SYSFS) += ksysfs.o obj-y += bootflag.o e820.o obj-y += pci-dma.o quirks.o topology.o kdebugfs.o
arch/x86/kernel/smpboot.c +1 -1
@@ -245,7 +245,7 @@ static void notrace start_secondary(void/* * Enable the espfix hack for this CPU */ -#ifdef CONFIG_X86_64 +#ifdef CONFIG_X86_ESPFIX64 init_espfix_ap ();#endif
init/main.c +1 -1
@@ -617,7 +617,7 @@ asmlinkage void __init start_kernel(voidif (efi_enabled (EFI_RUNTIME_SERVICES ))efi_enter_virtual_mode ();#endif -#ifdef CONFIG_X86_64 +#ifdef CONFIG_X86_ESPFIX64 /* Should be run before the first non-init thread is created */ init_espfix_bsp ();#endif
Greg Kroah-Hartman
maintainerPATCH 28/39 x86, espfix: Make it possible to disable 16-bit support
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: "H. Peter Anvin" <[email protected]>
commit 34273f41d57ee8d854dcd2a1d754cbb546cb548f upstream.
Embedded systems, which may be very memory-size-sensitive, are extremely unlikely to ever encounter any 16-bit software, so make it a CONFIG_EXPERT option to turn off support for any 16-bit software whatsoever.
--- arch/x86/Kconfig | 23 ++++++++++++++++++----- arch/x86/kernel/entry_32.S | 12 ++++++++++++ arch/x86/kernel/entry_64.S | 8 ++++++++ arch/x86/kernel/ldt.c | 5 +++++ 4 files changed, 43 insertions(+), 5 deletions(-)
arch/x86/Kconfig +18 -5
@@ -966,14 +966,27 @@ config VM86 default y depends on X86_32 ---help--- - This option is required by programs like DOSEMU to run 16-bit legacy - code on X86 processors. It also may be needed by software like - XFree86 to initialize some video cards via BIOS. Disabling this - option saves about 6k. + This option is required by programs like DOSEMU to run + 16-bit real mode legacy code on x86 processors. It also may + be needed by software like XFree86 to initialize some video + cards via BIOS. Disabling this option saves about 6K. + +config X86_16BIT + bool "Enable support for 16-bit segments" if EXPERT + default y + ---help--- + This option is required by programs like Wine to run 16-bit + protected mode legacy code on x86 processors. Disabling + this option saves about 300 bytes on i386, or around 6K text + plus 16K runtime memory on x86-64, + +config X86_ESPFIX32 + def_bool y + depends on X86_16BIT && X86_32 config X86_ESPFIX64 def_bool y - depends on X86_64 + depends on X86_16BIT && X86_64 config TOSHIBA tristate "Toshiba Laptop support"
arch/x86/kernel/entry_32.S +12 -0
@@ -529,6 +529,7 @@ syscall_exit: restore_all: TRACE_IRQS_IRET restore_all_notrace: +#ifdef CONFIG_X86_ESPFIX32 movl PT_EFLAGS(%esp), %eax # mix EFLAGS, SS and CS # Warning: PT_OLDSS(%esp) contains the wrong/random values if we # are returning to the kernel.
@@ -539,6 +540,7 @@ restore_all_notrace: cmpl $((SEGMENT_LDT << 8) | USER_RPL), %eax CFI_REMEMBER_STATE je ldt_ss # returning to user-space with LDT SS +#endif restore_nocheck: RESTORE_REGS 4 # skip orig_eax/error_code irq_return:
@@ -551,6 +553,7 @@ ENTRY(iret_exc) .previous _ASM_EXTABLE(irq_return,iret_exc) +#ifdef CONFIG_X86_ESPFIX32 CFI_RESTORE_STATE ldt_ss: #ifdef CONFIG_PARAVIRT
@@ -594,6 +597,7 @@ ldt_ss: lss (%esp), %esp /* switch to espfix segment */ CFI_ADJUST_CFA_OFFSET -8 jmp restore_nocheck +#endif CFI_ENDPROC ENDPROC(system_call)
@@ -706,6 +710,7 @@ END(syscall_badsys) * the high word of the segment base from the GDT and swiches to the * normal stack and adjusts ESP with the matching offset. */ +#ifdef CONFIG_X86_ESPFIX32 /* fixup the stack */ mov GDT_ESPFIX_SS + 4, %al /* bits 16..23 */ mov GDT_ESPFIX_SS + 7, %ah /* bits 24..31 */
@@ -715,8 +720,10 @@ END(syscall_badsys) pushl_cfi %eax lss (%esp), %esp /* switch to the normal stack segment */ CFI_ADJUST_CFA_OFFSET -8 +#endif .endm .macro UNWIND_ESPFIX_STACK +#ifdef CONFIG_X86_ESPFIX32 movl %ss, %eax /* see if on espfix stack */ cmpw $__ESPFIX_SS, %ax
@@ -727,6 +734,7 @@ END(syscall_badsys) /* switch to normal stack */ FIXUP_ESPFIX_STACK 27: +#endif .endm /*
@@ -1357,11 +1365,13 @@ END(debug) ENTRY(nmi) RING0_INT_FRAME ASM_CLAC +#ifdef CONFIG_X86_ESPFIX32 pushl_cfi %eax movl %ss, %eax cmpw $__ESPFIX_SS, %ax popl_cfi %eax je nmi_espfix_stack +#endif cmpl $ia32_sysenter_target,(%esp) je nmi_stack_fixup pushl_cfi %eax
@@ -1401,6 +1411,7 @@ nmi_debug_stack_check: FIX_STACK 24, nmi_stack_correct, 1 jmp nmi_stack_correct +#ifdef CONFIG_X86_ESPFIX32 nmi_espfix_stack: /* We have a RING0_INT_FRAME here. *
@@ -1422,6 +1433,7 @@ nmi_espfix_stack: lss 12+4(%esp), %esp # back to espfix stack CFI_ADJUST_CFA_OFFSET -24 jmp irq_return +#endif CFI_ENDPROC END(nmi)
arch/x86/kernel/entry_64.S +8 -0
@@ -1045,8 +1045,10 @@ irq_return: * Are we returning to a stack segment from the LDT? Note: in * 64-bit mode SS:RSP on the exception stack is always valid. */ +#ifdef CONFIG_X86_ESPFIX64 testb $4,(SS-RIP)(%rsp) jnz irq_return_ldt +#endif irq_return_iret: INTERRUPT_RETURN
@@ -1058,6 +1060,7 @@ ENTRY(native_iret) _ASM_EXTABLE(native_iret, bad_iret) #endif +#ifdef CONFIG_X86_ESPFIX64 irq_return_ldt: pushq_cfi %rax pushq_cfi %rdi
@@ -1081,6 +1084,7 @@ irq_return_ldt: movq %rax,%rsp popq_cfi %rax jmp irq_return_iret +#endif .section .fixup,"ax" bad_iret:
@@ -1152,6 +1156,7 @@ END(common_interrupt) * modify the stack to make it look like we just entered * the #GP handler from user space, similar to bad_iret. */ +#ifdef CONFIG_X86_ESPFIX64 ALIGN __do_double_fault: XCPT_FRAME 1 RDI+8
@@ -1177,6 +1182,9 @@ __do_double_fault: retq CFI_ENDPROC END(__do_double_fault) +#else +# define __do_double_fault do_double_fault +#endif /* * End of kprobes section
arch/x86/kernel/ldt.c +5 -0
@@ -229,6 +229,11 @@ static int write_ldt(void __user *ptr, u } } +if (!IS_ENABLED (CONFIG_X86_16BIT ) && !ldt_info.seg_32bit) { + error = -EINVAL ; + goto out_unlock; + } +fill_ldt (&ldt, &ldt_info);if (oldmode) ldt.avl =0 ;
Greg Kroah-Hartman
maintainerPATCH 29/39 x86_64/entry/xen: Do not invoke espfix64 on Xen
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andy Lutomirski <[email protected]>
commit 7209a75d2009dbf7745e2fd354abf25c3deb3ca3 upstream.
This moves the espfix64 logic into native_iret. To make this work, it gets rid of the native patch for INTERRUPT_RETURN:INTERRUPT_RETURN on native kernels is now 'jmp native_iret'.
This changes the 16-bit SS behavior on Xen from OOPSing to leaking some bits of the Xen hypervisor's RSP (I think).
[ hpa: this is a nonzero cost on native, but probably not enough to
measure. Xen needs to fix this in their own code, probably doing something equivalent to espfix64. ]
--- arch/x86/include/asm/irqflags.h | 2 +- arch/x86/kernel/entry_64.S | 28 ++++++++++------------------ arch/x86/kernel/paravirt_patch_64.c | 2 -- 3 files changed, 11 insertions(+), 21 deletions(-)
arch/x86/include/asm/irqflags.h +1 -1
@@ -129,7 +129,7 @@ static inline notrace unsigned long arch#define PARAVIRT_ADJUST_EXCEPTION_FRAME /* */ -#define INTERRUPT_RETURN iretq +#define INTERRUPT_RETURN jmp native_iret#define USERGS_SYSRET64 \ swapgs; \ sysretq;
arch/x86/kernel/entry_64.S +10 -18
@@ -1041,27 +1041,24 @@ restore_args: RESTORE_ARGS 1,8,1 irq_return: + INTERRUPT_RETURN + +ENTRY(native_iret) /* * Are we returning to a stack segment from the LDT? Note: in * 64-bit mode SS:RSP on the exception stack is always valid. */ #ifdef CONFIG_X86_ESPFIX64 testb $4,(SS-RIP)(%rsp) - jnz irq_return_ldt + jnz native_irq_return_ldt #endif -irq_return_iret: - INTERRUPT_RETURN - _ASM_EXTABLE(irq_return_iret, bad_iret) - -#ifdef CONFIG_PARAVIRT -ENTRY(native_iret) +native_irq_return_iret: iretq - _ASM_EXTABLE(native_iret, bad_iret) -#endif + _ASM_EXTABLE(native_irq_return_iret, bad_iret) #ifdef CONFIG_X86_ESPFIX64 -irq_return_ldt: +native_irq_return_ldt: pushq_cfi %rax pushq_cfi %rdi SWAPGS
@@ -1083,7 +1080,7 @@ irq_return_ldt: SWAPGS movq %rax,%rsp popq_cfi %rax - jmp irq_return_iret + jmp native_irq_return_iret #endif .section .fixup,"ax"
@@ -1167,13 +1164,8 @@ __do_double_fault: cmpl $__KERNEL_CS,CS(%rdi) jne do_double_fault movq RIP(%rdi),%rax - cmpq $irq_return_iret,%rax -#ifdef CONFIG_PARAVIRT - je 1f - cmpq $native_iret,%rax -#endif + cmpq $native_irq_return_iret,%rax jne do_double_fault /* This shouldn't happen... */ -1: movq PER_CPU_VAR(kernel_stack),%rax subq $(6*8-KERNEL_STACK_OFFSET),%rax /* Reset to original stack */ movq %rax,RSP(%rdi)
@@ -1674,7 +1666,7 @@ error_sti: */ error_kernelspace: incl %ebx - leaq irq_return_iret(%rip),%rcx + leaq native_irq_return_iret(%rip),%rcx cmpq %rcx,RIP+8(%rsp) je error_swapgs movl %ecx,%eax /* zero extend */
arch/x86/kernel/paravirt_patch_64.c +0 -2
@@ -6,7 +6,6 @@ DEF_NATIVE(pv_irq_ops, irq_disable, "cliDEF_NATIVE (pv_irq_ops, irq_enable,"sti" );DEF_NATIVE (pv_irq_ops, restore_fl,"pushq %rdi; popfq" );DEF_NATIVE (pv_irq_ops, save_fl,"pushfq; popq %rax" ); -DEF_NATIVE (pv_cpu_ops, iret,"iretq" );DEF_NATIVE (pv_mmu_ops, read_cr2,"movq %cr2, %rax" );DEF_NATIVE (pv_mmu_ops, read_cr3,"movq %cr3, %rax" );DEF_NATIVE (pv_mmu_ops, write_cr3,"movq %rdi, %cr3" );
@@ -50,7 +49,6 @@ unsigned native_patch(u8 type, u16 clobbPATCH_SITE (pv_irq_ops, save_fl);PATCH_SITE (pv_irq_ops, irq_enable);PATCH_SITE (pv_irq_ops, irq_disable); -PATCH_SITE (pv_cpu_ops, iret);PATCH_SITE (pv_cpu_ops, irq_enable_sysexit);PATCH_SITE (pv_cpu_ops, usergs_sysret32);PATCH_SITE (pv_cpu_ops, usergs_sysret64);
Greg Kroah-Hartman
maintainerPATCH 30/39 pinctrl: dra: dt-bindings: Fix pull enable/disable
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nishanth Menon <[email protected]>
commit 23d9cec07c589276561c13b180577c0b87930140 upstream.
The DRA74/72 control module pins have a weak pull up and pull down. This is configured by bit offset 17. if BIT(17) is 1, a pull up is selected, else a pull down is selected.
However, this pull resisstor is applied based on BIT(16) - PULLUDENABLE - if BIT(18) is *0*, then pull as defined in BIT(17) is applied, else no weak pulls are applied. We defined this in reverse.
Reference: Table 18-5 (Description of the pad configuration register bits) in Technical Reference Manual Revision (DRA74x revision Q:
SPRUHI2Q Revised June 2014 and DRA72x revision F: SPRUHP2F - Revised June 2014)
--- include/dt-bindings/pinctrl/dra.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
include/dt-bindings/pinctrl/dra.h +4 -3
@@ -30,7 +30,8 @@#define MUX_MODE14 0xe#define MUX_MODE15 0xf -#define PULL_ENA (1 << 16) +#define PULL_ENA (0 << 16) +#define PULL_DIS (1 << 16)#define PULL_UP (1 << 17)#define INPUT_EN (1 << 18)#define SLEWCONTROL (1 << 19)
@@ -38,10 +39,10 @@#define WAKEUP_EVENT (1 << 25)/* Active pin states */ -#define PIN_OUTPUT 0 +#define PIN_OUTPUT (0 | PULL_DIS)#define PIN_OUTPUT_PULLUP (PIN_OUTPUT | PULL_ENA | PULL_UP)#define PIN_OUTPUT_PULLDOWN (PIN_OUTPUT | PULL_ENA) -#define PIN_INPUT INPUT_EN +#define PIN_INPUT (INPUT_EN | PULL_DIS)#define PIN_INPUT_SLEW (INPUT_EN | SLEWCONTROL)#define PIN_INPUT_PULLUP (PULL_ENA | INPUT_EN | PULL_UP)#define PIN_INPUT_PULLDOWN (PULL_ENA | INPUT_EN)
Greg Kroah-Hartman
maintainerPATCH 31/39 ARM: dts: dra7-evm: Make VDDA_1V8_PHY supply always on
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Roger Quadros <[email protected]>
commit e120fb459693bbc1ac3eabdd65c3659d7cfbfd2a upstream.
After clarification from the hardware team it was found that this 1.8V PHY supply can't be switched OFF when SoC is Active.
Since the PHY IPs don't contain isolation logic built in the design to allow the power rail to be switched off, there is a very high risk of IP reliability and additional leakage paths which can result in additional power consumption.
The only scenario where this rail can be switched off is part of Power on reset sequencing, but it needs to be kept always-on during operation.
This patch is required for proper functionality of USB, SATA and PCIe on DRA7-evm.
--- arch/arm/boot/dts/dra7-evm.dts | 1 + 1 file changed, 1 insertion(+)
arch/arm/boot/dts/dra7-evm.dts +1 -0
@@ -182,6 +182,7 @@ regulator-name = "ldo3"; regulator-min-microvolt = <1800000>; regulator-max-microvolt = <1800000>; + regulator-always-on; regulator-boot-on; };
Greg Kroah-Hartman
maintainerPATCH 32/39 staging: vt6655: Fix Warning on boot handle_irq_event_percpu.
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Malcolm Priestley <[email protected]>
commit 6cff1f6ad4c615319c1a146b2aa0af1043c5e9f5 upstream.
WARNING: CPU: 0 PID: 929 at /home/apw/COD/linux/kernel/irq/handle.c:147 handle_irq_event_percpu+0x1d1/0x1e0() irq 17 handler device_intr+0x0/0xa80 [vt6655_stage] enabled interrupts
Using spin_lock_irqsave appears to fix this.
--- drivers/staging/vt6655/device_main.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/staging/vt6655/device_main.c +5 -2
@@ -2430,6 +2430,7 @@ static irqreturn_t device_intr(int irqint handled =0 ;unsigned char byData =0 ;int ii =0 ; +unsigned long flags;// unsigned char byRSSI; MACvReadISR (pDevice->PortOffset, &pDevice->dwIsr);
@@ -2455,7 +2456,8 @@ static irqreturn_t device_intr(int irq handled =1 ;MACvIntDisable (pDevice->PortOffset); -spin_lock_irq (&pDevice->lock); + +spin_lock_irqsave (&pDevice->lock, flags);//Make sure current page is 0 VNSvInPortB (pDevice->PortOffset +MAC_REG_PAGE1SEL , &byOrgPageSel);
@@ -2696,7 +2698,8 @@ static irqreturn_t device_intr(int irqMACvSelectPage1 (pDevice->PortOffset); } -spin_unlock_irq (&pDevice->lock); +spin_unlock_irqrestore (&pDevice->lock, flags); +MACvIntEnable (pDevice->PortOffset,IMR_MASK_VALUE );return IRQ_RETVAL (handled);
Greg Kroah-Hartman
maintainerPATCH 33/39 Revert "mac80211: move "bufferable MMPDU" check to fix AP mode scan"
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johannes Berg <[email protected]>
commit 08b9939997df30e42a228e1ecb97f99e9c8ea84e upstream.
This reverts commit 277d916fc2e959c3f106904116bb4f7b1148d47a as it was at least breaking iwlwifi by setting the IEEE80211_TX_CTL_NO_PS_BUFFER flag in all kinds of interface modes, not only for AP mode where it is appropriate.
To avoid reintroducing the original problem, explicitly check for probe request frames in the multicast buffering code.
--- net/mac80211/tx.c | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-)
net/mac80211/tx.c +13 -14
@@ -414,6 +414,9 @@ ieee80211_tx_h_multicast_ps_buf(struct iif (ieee80211_has_order (hdr->frame_control))return TX_CONTINUE ; +if (ieee80211_is_probe_req (hdr->frame_control)) +return TX_CONTINUE ; +if (tx->local->hw.flags &IEEE80211_HW_QUEUE_CONTROL ) info->hw_queue = tx->sdata->vif.cab_queue;
@@ -464,6 +467,7 @@ ieee80211_tx_h_unicast_ps_buf(struct iee {struct sta_info *sta = tx->sta;struct ieee80211_tx_info *info =IEEE80211_SKB_CB (tx->skb); +struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)tx->skb->data;struct ieee80211_local *local = tx->local;if (unlikely (!sta))
@@ -474,6 +478,15 @@ ieee80211_tx_h_unicast_ps_buf(struct iee !(info->flags & IEEE80211_TX_CTL_NO_PS_BUFFER))) {int ac =skb_get_queue_mapping (tx->skb); +/* only deauth, disassoc and action are bufferable MMPDUs */ +if (ieee80211_is_mgmt (hdr->frame_control) && + !ieee80211_is_deauth (hdr->frame_control) && + !ieee80211_is_disassoc (hdr->frame_control) && + !ieee80211_is_action (hdr->frame_control)) { + info->flags |=IEEE80211_TX_CTL_NO_PS_BUFFER ; +return TX_CONTINUE ; + } +ps_dbg (sta->sdata,"STA %pM aid %d: PS buffer for AC %d\n" , sta->sta.addr, sta->sta.aid, ac);if (tx->local->total_ps_buffered >=TOTAL_MAX_TX_BUFFER )
@@ -532,22 +545,8 @@ ieee80211_tx_h_unicast_ps_buf(struct iee static ieee80211_tx_result debug_noinlineieee80211_tx_h_ps_buf (struct ieee80211_tx_data *tx) { -struct ieee80211_tx_info *info =IEEE80211_SKB_CB (tx->skb); -struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)tx->skb->data; -if (unlikely (tx->flags &IEEE80211_TX_PS_BUFFERED ))return TX_CONTINUE ; - -/* only deauth, disassoc and action are bufferable MMPDUs */ -if (ieee80211_is_mgmt (hdr->frame_control) && - !ieee80211_is_deauth (hdr->frame_control) && - !ieee80211_is_disassoc (hdr->frame_control) && - !ieee80211_is_action (hdr->frame_control)) { -if (tx->flags &IEEE80211_TX_UNICAST ) - info->flags |=IEEE80211_TX_CTL_NO_PS_BUFFER ; -return TX_CONTINUE ; - } -if (tx->flags &IEEE80211_TX_UNICAST )return ieee80211_tx_h_unicast_ps_buf (tx);else
Greg Kroah-Hartman
maintainerPATCH 34/39 cpufreq: move policy kobj to policy->cpu at resume
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Viresh Kumar <[email protected]>
commit 92c14bd9477a20a83144f08c0ca25b0308bf0730 upstream.
This is only relevant to implementations with multiple clusters, where clusters have separate clock lines but all CPUs within a cluster share it.
Consider a dual cluster platform with 2 cores per cluster. During suspend we start hot unplugging CPUs in order 1 to 3. When CPU2 is removed, policy->kobj would be moved to CPU3 and when CPU3 goes down we wouldn't free policy or its kobj as we want to retain permissions/values/etc.
Now on resume, we will get CPU2 before CPU3 and will call __cpufreq_add_dev(). We will recover the old policy and update policy->cpu from 3 to 2 from update_policy_cpu().
But the kobj is still tied to CPU3 and isn't moved to CPU2. We wouldn't create a link for CPU2, but would try that for CPU3 while bringing it online. Which will report errors as CPU3 already has kobj assigned to it.
This bug got introduced with commit 42f921a, which overlooked this scenario.
To fix this, lets move kobj to the new policy->cpu while bringing first CPU of a cluster back. Also do a WARN_ON() if kobject_move failed, as we would reach here only for the first CPU of a non-boot cluster. And we can't recover from this situation, if kobject_move() fails.
--- drivers/cpufreq/cpufreq.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/cpufreq/cpufreq.c +4 -2
@@ -1089,10 +1089,12 @@ static int __cpufreq_add_dev(struct devi* the creation of a brand new one. So we need to perform this update * by invoking update_policy_cpu(). */ -if (frozen && cpu != policy->cpu) +if (frozen && cpu != policy->cpu) {update_policy_cpu (policy, cpu); -else +WARN_ON (kobject_move (&policy->kobj, &dev->kobj)); + }else { policy->cpu = cpu; + } policy->governor =CPUFREQ_DEFAULT_GOVERNOR ;cpumask_copy (policy->cpus,cpumask_of (cpu));
Greg Kroah-Hartman
maintainerPATCH 35/39 x86/xen: no need to explicitly register an NMI callback
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Vrabel <[email protected]>
commit ea9f9274bf4337ba7cbab241c780487651642d63 upstream.
Remove xen_enable_nmi() to fix a 64-bit guest crash when registering the NMI callback on Xen 3.1 and earlier.
It's not needed since the NMI callback is set by a set_trap_table hypercall (in xen_load_idt() or xen_write_idt_entry()).
It's also broken since it only set the current VCPU's callback.
--- arch/x86/xen/setup.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-)
arch/x86/xen/setup.c +1 -8
@@ -574,13 +574,7 @@ void xen_enable_syscall(void) }#endif /* CONFIG_X86_64 */ } -void xen_enable_nmi (void ) -{ -#ifdef CONFIG_X86_64 -if (register_callback (CALLBACKTYPE_nmi, (char *)nmi)) -BUG (); -#endif -} +void __init xen_pvmmu_arch_setup (void ) {HYPERVISOR_vm_assist (VMASST_CMD_enable, VMASST_TYPE_4gb_segments);
@@ -595,7 +589,6 @@ void __init xen_pvmmu_arch_setup(void)xen_enable_sysenter ();xen_enable_syscall (); -xen_enable_nmi (); }/* This function is not called for HVM domains */
Greg Kroah-Hartman
maintainerPATCH 36/39 xtensa: add fixup for double exception raised in window overflow
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Max Filippov <[email protected]>
commit 17290231df16eeee5dfc198dbf5ee4b419996dcd upstream.
There are two FIXMEs in the double exception handler 'for the extremely unlikely case'. This case gets hit by gcc during kernel build once in a few hours, resulting in an unrecoverable exception condition.
Provide missing fixup routine to handle this case. Double exception literals now need 8 more bytes, add them to the linker script.
Also replace bbsi instructions with bbsi.l as we're branching depending on 8th and 7th LSB-based bits of exception address.
This may be tested by adding the explicit DTLB invalidation to window overflow handlers, like the following:
# --- a/arch/xtensa/kernel/vectors.S # +++ b/arch/xtensa/kernel/vectors.S # @@ -592,6 +592,14 @@ ENDPROC(_WindowUnderflow4) # ENTRY_ALIGN64(_WindowOverflow8) # # s32e a0, a9, -16 # + bbsi.l a9, 31, 1f # + rsr a0, ccount # + bbsi.l a0, 4, 1f # + pdtlb a0, a9 # + idtlb a0 # + movi a0, 9 # + idtlb a0 # +1: # l32e a0, a1, -12 # s32e a2, a9, -8 # s32e a1, a9, -12
--- arch/xtensa/kernel/vectors.S | 158 +++++++++++++++++++++++++++++++++------ arch/xtensa/kernel/vmlinux.lds.S | 4 2 files changed, 138 insertions(+), 24 deletions(-)
arch/xtensa/kernel/vectors.S +136 -22
@@ -376,38 +376,42 @@ _DoubleExceptionVector_WindowOverflow: beqz a2, 1f # if at start of vector, don't restore addi a0, a0, -128 - bbsi a0, 8, 1f # don't restore except for overflow 8 and 12 - bbsi a0, 7, 2f + bbsi.l a0, 8, 1f # don't restore except for overflow 8 and 12 + + /* + * This fixup handler is for the extremely unlikely case where the + * overflow handler's reference thru a0 gets a hardware TLB refill + * that bumps out the (distinct, aliasing) TLB entry that mapped its + * prior references thru a9/a13, and where our reference now thru + * a9/a13 gets a 2nd-level miss exception (not hardware TLB refill). + */ + movi a2, window_overflow_restore_a0_fixup + s32i a2, a3, EXC_TABLE_FIXUP + l32i a2, a3, EXC_TABLE_DOUBLE_SAVE + xsr a3, excsave1 + + bbsi.l a0, 7, 2f /* * Restore a0 as saved by _WindowOverflow8(). - * - * FIXME: we really need a fixup handler for this L32E, - * for the extremely unlikely case where the overflow handler's - * reference thru a0 gets a hardware TLB refill that bumps out - * the (distinct, aliasing) TLB entry that mapped its prior - * references thru a9, and where our reference now thru a9 - * gets a 2nd-level miss exception (not hardware TLB refill). */ - l32e a2, a9, -16 - wsr a2, depc # replace the saved a0 - j 1f + l32e a0, a9, -16 + wsr a0, depc # replace the saved a0 + j 3f 2: /* * Restore a0 as saved by _WindowOverflow12(). - * - * FIXME: we really need a fixup handler for this L32E, - * for the extremely unlikely case where the overflow handler's - * reference thru a0 gets a hardware TLB refill that bumps out - * the (distinct, aliasing) TLB entry that mapped its prior - * references thru a13, and where our reference now thru a13 - * gets a 2nd-level miss exception (not hardware TLB refill). */ - l32e a2, a13, -16 - wsr a2, depc # replace the saved a0 + l32e a0, a13, -16 + wsr a0, depc # replace the saved a0 +3: + xsr a3, excsave1 + movi a0, 0 + s32i a0, a3, EXC_TABLE_FIXUP + s32i a2, a3, EXC_TABLE_DOUBLE_SAVE 1: /* * Restore WindowBase while leaving all address registers restored.
@@ -449,6 +453,7 @@ _DoubleExceptionVector_WindowOverflow: s32i a0, a2, PT_DEPC +_DoubleExceptionVector_handle_exception: addx4 a0, a0, a3 l32i a0, a0, EXC_TABLE_FAST_USER xsr a3, excsave1
@@ -464,11 +469,120 @@ _DoubleExceptionVector_WindowOverflow: rotw -3 j 1b - .end literal_prefix ENDPROC(_DoubleExceptionVector) /* + * Fixup handler for TLB miss in double exception handler for window owerflow. + * We get here with windowbase set to the window that was being spilled and + * a0 trashed. a0 bit 7 determines if this is a call8 (bit clear) or call12 + * (bit set) window. + * + * We do the following here: + * - go to the original window retaining a0 value; + * - set up exception stack to return back to appropriate a0 restore code + * (we'll need to rotate window back and there's no place to save this + * information, use different return address for that); + * - handle the exception; + * - go to the window that was being spilled; + * - set up window_overflow_restore_a0_fixup as a fixup routine; + * - reload a0; + * - restore the original window; + * - reset the default fixup routine; + * - return to user. By the time we get to this fixup handler all information + * about the conditions of the original double exception that happened in + * the window overflow handler is lost, so we just return to userspace to + * retry overflow from start. + * + * a0: value of depc, original value in depc + * a2: trashed, original value in EXC_TABLE_DOUBLE_SAVE + * a3: exctable, original value in excsave1 + */ + +ENTRY(window_overflow_restore_a0_fixup) + + rsr a0, ps + extui a0, a0, PS_OWB_SHIFT, PS_OWB_WIDTH + rsr a2, windowbase + sub a0, a2, a0 + extui a0, a0, 0, 3 + l32i a2, a3, EXC_TABLE_DOUBLE_SAVE + xsr a3, excsave1 + + _beqi a0, 1, .Lhandle_1 + _beqi a0, 3, .Lhandle_3 + + .macro overflow_fixup_handle_exception_pane n + + rsr a0, depc + rotw -\n + + xsr a3, excsave1 + wsr a2, depc + l32i a2, a3, EXC_TABLE_KSTK + s32i a0, a2, PT_AREG0 + + movi a0, .Lrestore_\n + s32i a0, a2, PT_DEPC + rsr a0, exccause + j _DoubleExceptionVector_handle_exception + + .endm + + overflow_fixup_handle_exception_pane 2 +.Lhandle_1: + overflow_fixup_handle_exception_pane 1 +.Lhandle_3: + overflow_fixup_handle_exception_pane 3 + + .macro overflow_fixup_restore_a0_pane n + + rotw \n + /* Need to preserve a0 value here to be able to handle exception + * that may occur on a0 reload from stack. It may occur because + * TLB miss handler may not be atomic and pointer to page table + * may be lost before we get here. There are no free registers, + * so we need to use EXC_TABLE_DOUBLE_SAVE area. + */ + xsr a3, excsave1 + s32i a2, a3, EXC_TABLE_DOUBLE_SAVE + movi a2, window_overflow_restore_a0_fixup + s32i a2, a3, EXC_TABLE_FIXUP + l32i a2, a3, EXC_TABLE_DOUBLE_SAVE + xsr a3, excsave1 + bbsi.l a0, 7, 1f + l32e a0, a9, -16 + j 2f +1: + l32e a0, a13, -16 +2: + rotw -\n + + .endm + +.Lrestore_2: + overflow_fixup_restore_a0_pane 2 + +.Lset_default_fixup: + xsr a3, excsave1 + s32i a2, a3, EXC_TABLE_DOUBLE_SAVE + movi a2, 0 + s32i a2, a3, EXC_TABLE_FIXUP + l32i a2, a3, EXC_TABLE_DOUBLE_SAVE + xsr a3, excsave1 + rfe + +.Lrestore_1: + overflow_fixup_restore_a0_pane 1 + j .Lset_default_fixup +.Lrestore_3: + overflow_fixup_restore_a0_pane 3 + j .Lset_default_fixup + +ENDPROC(window_overflow_restore_a0_fixup) + + .end literal_prefix +/* * Debug interrupt vector * * There is not much space here, so simply jump to another handler.
arch/xtensa/kernel/vmlinux.lds.S +2 -2
@@ -269,13 +269,13 @@ SECTIONS .UserExceptionVector.literal) SECTION_VECTOR (_DoubleExceptionVector_literal, .DoubleExceptionVector.literal, - DOUBLEEXC_VECTOR_VADDR - 16, + DOUBLEEXC_VECTOR_VADDR - 40, SIZEOF(.UserExceptionVector.text), .UserExceptionVector.text) SECTION_VECTOR (_DoubleExceptionVector_text, .DoubleExceptionVector.text, DOUBLEEXC_VECTOR_VADDR, - 32, + 40, .DoubleExceptionVector.literal) . = (LOADADDR( .DoubleExceptionVector.text ) + SIZEOF( .DoubleExceptionVector.text ) + 3) & ~ 3;
Greg Kroah-Hartman
maintainerPATCH 37/39 net/l2tp: dont fall back on UDP [get|set]sockopt
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sasha Levin <[email protected]>
commit 3cf521f7dc87c031617fd47e4b7aa2593c2f3daf upstream.
The l2tp [get|set]sockopt() code has fallen back to the UDP functions for socket option levels != SOL_PPPOL2TP since day one, but that has never actually worked, since the l2tp socket isn't an inet socket.
As David Miller points out:
"If we wanted this to work, it'd have to look up the tunnel and then
use tunnel->sk, but I wonder how useful that would be"
Since this can never have worked so nobody could possibly have depended on that functionality, just remove the broken code and return -EINVAL.
--- net/l2tp/l2tp_ppp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
net/l2tp/l2tp_ppp.c +2 -2
@@ -1368,7 +1368,7 @@ static int pppol2tp_setsockopt(struct soint err;if (level !=SOL_PPPOL2TP ) -return udp_prot.setsockopt (sk, level, optname, optval, optlen); +return -EINVAL ;if (optlen <sizeof (int ))return -EINVAL ;
@@ -1494,7 +1494,7 @@ static int pppol2tp_getsockopt(struct sostruct pppol2tp_session *ps;if (level !=SOL_PPPOL2TP ) -return udp_prot.getsockopt (sk, level, optname, optval, optlen); +return -EINVAL ;if (get_user (len, optlen))return -EFAULT ;
Greg Kroah-Hartman
maintainerPATCH 38/39 lib/btree.c: fix leak of whole btree nodes
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Minfei Huang <[email protected]>
commit c75b53af2f0043aff500af0a6f878497bef41bca upstream.
I use btree from 3.14-rc2 in my own module. When the btree module is removed, a warning arises:
kmem_cache_destroy btree_node: Slab cache still has objects
CPU: 13 PID: 9150 Comm: rmmod Tainted: GF O 3.14.0-rc2 #1 Hardware name: Inspur NF5270M3/NF5270M3, BIOS CHEETAH_2.1.3 09/10/2013 Call Trace: dump_stack+0x49/0x5d kmem_cache_destroy+0xcf/0xe0 btree_module_exit+0x10/0x12 [btree] SyS_delete_module+0x198/0x1f0 system_call_fastpath+0x16/0x1b
The cause is that it doesn't release the last btree node, when height = 1 and fill = 1.
--- lib/btree.c | 1 + 1 file changed, 1 insertion(+)
lib/btree.c +1 -0
@@ -198,6 +198,7 @@ EXPORT_SYMBOL_GPL(btree_init);void btree_destroy (struct btree_head *head) { +mempool_free (head->node, head->mempool);mempool_destroy (head->mempool); head->mempool =NULL ; }
Greg Kroah-Hartman
maintainerPATCH 39/39 x86/espfix/xen: Fix allocation of pages for paravirt page tables
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Boris Ostrovsky <[email protected]>
commit 8762e5092828c4dc0f49da5a47a644c670df77f3 upstream.
init_espfix_ap() is currently off by one level when informing hypervisor that allocated pages will be used for ministacks' page tables.
The most immediate effect of this on a PV guest is that if 'stack_page = __get_free_page()' returns a non-zeroed-out page the hypervisor will refuse to use it for a page table (which it shouldn't be anyway). This will result in warnings by both Xen and Linux.
More importantly, a subsequent write to that page (again, by a PV guest) is likely to result in fatal page fault.
--- arch/x86/kernel/espfix_64.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
arch/x86/kernel/espfix_64.c +2 -3
@@ -175,7 +175,7 @@ void init_espfix_ap(void)if (!pud_present (pud)) { pmd_p = (pmd_t *)__get_free_page (PGALLOC_GFP ); pud =__pud (__pa (pmd_p) | (PGTABLE_PROT & ptemask)); -paravirt_alloc_pud (&init_mm,__pa (pmd_p) >>PAGE_SHIFT ); +paravirt_alloc_pmd (&init_mm,__pa (pmd_p) >>PAGE_SHIFT );for (n =0 ; n <ESPFIX_PUD_CLONES ; n++)set_pud (&pud_p[n], pud); }
@@ -185,7 +185,7 @@ void init_espfix_ap(void)if (!pmd_present (pmd)) { pte_p = (pte_t *)__get_free_page (PGALLOC_GFP ); pmd =__pmd (__pa (pte_p) | (PGTABLE_PROT & ptemask)); -paravirt_alloc_pmd (&init_mm,__pa (pte_p) >>PAGE_SHIFT ); +paravirt_alloc_pte (&init_mm,__pa (pte_p) >>PAGE_SHIFT );for (n =0 ; n <ESPFIX_PMD_CLONES ; n++)set_pmd (&pmd_p[n], pmd); }
@@ -193,7 +193,6 @@ void init_espfix_ap(void) pte_p =pte_offset_kernel (&pmd, addr); stack_page = (void *)__get_free_page (GFP_KERNEL ); pte =__pte (__pa (stack_page) | (__PAGE_KERNEL_RO & ptemask)); -paravirt_alloc_pte (&init_mm,__pa (stack_page) >>PAGE_SHIFT );for (n =0 ; n <ESPFIX_PTE_CLONES ; n++)set_pte (&pte_p[n*PTE_STRIDE ], pte);
Quoted 8 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 3.14.16 release. There are 39 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 Thu Aug 7 18:13:27 UTC 2014. Anything received after that time might be too late.
Quoted 8 lines
The whole patch series can be found in one patch at:
kernel.org/pub/linux/kernel/v3.0/stable-review/patch-3.14.16-rc1.gzand the diffstat can be found below.
thanks,
greg k-h
Compiled and booted on my test system. No dmesg regressions compared to previous 3.14.15
-- Shuah
Signature · 4 lines
Shuah Khan Senior Linux Kernel Developer - Open Source Group Samsung Research America(Silicon Valley) [email protected] | (970) 672-0658
Quoted 8 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 3.14.16 release. There are 39 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 Thu Aug 7 18:13:27 UTC 2014. Anything received after that time might be too late.
Build results:
total: 137 pass: 137 fail: 0
Qemu tests all passed.
Details are available at http://server.roeck-us.net:8010/builders.
Guenter