I'm announcing the release of the 4.16.2 kernel.
All users of the 4.16 kernel series must upgrade.
The updated 4.16.y git tree can be found at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git linux-4.16.y
and can be browsed at the normal kernel.org git web browser:
http://git.kernel.org/?p=linux/kernel/git/stable/linux-stable.git;a=summary
thanks,
greg k-h
------------
Makefile | 2 +-
drivers/net/ethernet/marvell/sky2.c | 2 +-
drivers/net/ethernet/netronome/nfp/nfpcore/nfp_nsp.c | 9 +++++----
drivers/net/ppp/pptp.c | 1 -
drivers/sbus/char/Kconfig | 3 ++-
net/8021q/vlan_dev.c | 6 +++++-
net/core/dev.c | 2 +-
net/dsa/dsa_priv.h | 8 +++++++-
net/ipv4/arp.c | 2 +-
net/ipv4/ip_tunnel.c | 11 ++++++-----
net/ipv6/ip6_gre.c | 8 +++++---
net/ipv6/ip6_output.c | 7 +++++--
net/ipv6/ip6_tunnel.c | 11 +++++++----
net/ipv6/ip6_vti.c | 7 +++++--
net/ipv6/sit.c | 8 +++++---
net/sched/act_bpf.c | 12 ++++++++----
net/sched/cls_u32.c | 1 +
net/sctp/ipv6.c | 4 +++-
net/sctp/socket.c | 13 ++++++++-----
19 files changed, 76 insertions(+), 41 deletions(-)
Andrew Lunn (1):
net: dsa: Discard frames from unused ports
Cong Wang (1):
net_sched: fix a missing idr_remove() in u32_delete_key()
Davide Caratti (1):
net/sched: fix NULL dereference in the error path of tcf_bpf_init()
Dirk van der Merwe (1):
nfp: use full 40 bits of the NSP buffer address
Eric Dumazet (9):
pptp: remove a buggy dst release in pptp_connect()
sctp: do not leak kernel memory to user space
sctp: sctp_sockaddr_af must check minimal addr length for AF_INET6
net: fool proof dev_valid_name()
ip_tunnel: better validate user provided tunnel names
ipv6: sit: better validate user provided tunnel names
ip6_gre: better validate user provided tunnel names
ip6_tunnel: better validate user provided tunnel names
vti6: better validate user provided tunnel names
Greg Kroah-Hartman (1):
Linux 4.16.2
Guenter Roeck (1):
sparc64: Oracle DAX driver depends on SPARC64
Hangbin Liu (1):
vlan: also check phy_driver ts_info for vlan's real device
Jeff Barnhill (1):
net/ipv6: Increment OUTxxx counters after netfilter hook
Kai-Heng Feng (1):
sky2: Increase D3 delay to sky2 stops working after suspend
Miguel Fadon Perlines (1):
arp: fix arp_filter on l3slave devices
This is the start of the stable review cycle for the 4.16.2 release.
There are 18 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 Apr 12 21:27:41 UTC 2018.
Anything received after that time might be too late.
The whole patch series can be found in one patch at:
https://www.kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.16.2-rc1…
or in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-4.16.y
and the diffstat can be found below.
thanks,
greg k-h
-------------
Pseudo-Shortlog of commits:
Greg Kroah-Hartman <gregkh(a)linuxfoundation.org>
Linux 4.16.2-rc1
Dirk van der Merwe <dirk.vandermerwe(a)netronome.com>
nfp: use full 40 bits of the NSP buffer address
Cong Wang <xiyou.wangcong(a)gmail.com>
net_sched: fix a missing idr_remove() in u32_delete_key()
Eric Dumazet <edumazet(a)google.com>
vti6: better validate user provided tunnel names
Eric Dumazet <edumazet(a)google.com>
ip6_tunnel: better validate user provided tunnel names
Eric Dumazet <edumazet(a)google.com>
ip6_gre: better validate user provided tunnel names
Eric Dumazet <edumazet(a)google.com>
ipv6: sit: better validate user provided tunnel names
Eric Dumazet <edumazet(a)google.com>
ip_tunnel: better validate user provided tunnel names
Eric Dumazet <edumazet(a)google.com>
net: fool proof dev_valid_name()
Hangbin Liu <liuhangbin(a)gmail.com>
vlan: also check phy_driver ts_info for vlan's real device
Kai-Heng Feng <kai.heng.feng(a)canonical.com>
sky2: Increase D3 delay to sky2 stops working after suspend
Eric Dumazet <edumazet(a)google.com>
sctp: sctp_sockaddr_af must check minimal addr length for AF_INET6
Eric Dumazet <edumazet(a)google.com>
sctp: do not leak kernel memory to user space
Eric Dumazet <edumazet(a)google.com>
pptp: remove a buggy dst release in pptp_connect()
Davide Caratti <dcaratti(a)redhat.com>
net/sched: fix NULL dereference in the error path of tcf_bpf_init()
Jeff Barnhill <0xeffeff(a)gmail.com>
net/ipv6: Increment OUTxxx counters after netfilter hook
Andrew Lunn <andrew(a)lunn.ch>
net: dsa: Discard frames from unused ports
Miguel Fadon Perlines <mfadon(a)teldat.com>
arp: fix arp_filter on l3slave devices
Guenter Roeck <linux(a)roeck-us.net>
sparc64: Oracle DAX driver depends on SPARC64
-------------
Diffstat:
Makefile | 4 ++--
drivers/net/ethernet/marvell/sky2.c | 2 +-
drivers/net/ethernet/netronome/nfp/nfpcore/nfp_nsp.c | 9 +++++----
drivers/net/ppp/pptp.c | 1 -
drivers/sbus/char/Kconfig | 3 ++-
net/8021q/vlan_dev.c | 6 +++++-
net/core/dev.c | 2 +-
net/dsa/dsa_priv.h | 8 +++++++-
net/ipv4/arp.c | 2 +-
net/ipv4/ip_tunnel.c | 11 ++++++-----
net/ipv6/ip6_gre.c | 8 +++++---
net/ipv6/ip6_output.c | 7 +++++--
net/ipv6/ip6_tunnel.c | 11 +++++++----
net/ipv6/ip6_vti.c | 7 +++++--
net/ipv6/sit.c | 8 +++++---
net/sched/act_bpf.c | 12 ++++++++----
net/sched/cls_u32.c | 1 +
net/sctp/ipv6.c | 4 +++-
net/sctp/socket.c | 13 ++++++++-----
19 files changed, 77 insertions(+), 42 deletions(-)
From: Andy Lutomirski <luto(a)kernel.org>
commit: 9d05041679904b12c12421cbcf9cb5f4860a8d7b upstream
32-bit kernels handle nested NMIs in C. Enable the exact same
handling on 64-bit kernels as well. This isn't currently
necessary, but it will become necessary once the asm code starts
allowing limited nesting.
Signed-off-by: Andy Lutomirski <luto(a)kernel.org>
Reviewed-by: Steven Rostedt <rostedt(a)goodmis.org>
Cc: Borislav Petkov <bp(a)suse.de>
Cc: Linus Torvalds <torvalds(a)linux-foundation.org>
Cc: Peter Zijlstra <peterz(a)infradead.org>
Cc: Thomas Gleixner <tglx(a)linutronix.de>
Cc: stable(a)vger.kernel.org
Signed-off-by: Ingo Molnar <mingo(a)kernel.org>
Backported-by: Chenggang <chenggang.qin(a)linux.alibaba.com>
---
7u/arch/x86/kernel/nmi.c | 122 ++++++++++++++++++++---------------------------
1 file changed, 51 insertions(+), 71 deletions(-)
diff --git a/7u/arch/x86/kernel/nmi.c b/7u/arch/x86/kernel/nmi.c
index 6030805..a735412 100644
--- a/7u/arch/x86/kernel/nmi.c
+++ b/7u/arch/x86/kernel/nmi.c
@@ -359,15 +359,15 @@ static __kprobes void default_do_nmi(struct pt_regs *regs)
}
/*
- * NMIs can hit breakpoints which will cause it to lose its
- * NMI context with the CPU when the breakpoint does an iret.
- */
-#ifdef CONFIG_X86_32
-/*
- * For i386, NMIs use the same stack as the kernel, and we can
- * add a workaround to the iret problem in C (preventing nested
- * NMIs if an NMI takes a trap). Simply have 3 states the NMI
- * can be in:
+ * NMIs can hit breakpoints which will cause it to lose its NMI context
+ * with the CPU when the breakpoint or page fault does an IRET.
+ *
+ * As a result, NMIs can nest if NMIs get unmasked due an IRET during
+ * NMI processing. On x86_64, the asm glue protects us from nested NMIs
+ * if the outer NMI came from kernel mode, but we can still nest if the
+ * outer NMI came from user mode.
+ *
+ * To handle these nested NMIs, we have three states:
*
* 1) not running
* 2) executing
@@ -381,15 +381,14 @@ static __kprobes void default_do_nmi(struct pt_regs *regs)
* (Note, the latch is binary, thus multiple NMIs triggering,
* when one is running, are ignored. Only one NMI is restarted.)
*
- * If an NMI hits a breakpoint that executes an iret, another
- * NMI can preempt it. We do not want to allow this new NMI
- * to run, but we want to execute it when the first one finishes.
- * We set the state to "latched", and the exit of the first NMI will
- * perform a dec_return, if the result is zero (NOT_RUNNING), then
- * it will simply exit the NMI handler. If not, the dec_return
- * would have set the state to NMI_EXECUTING (what we want it to
- * be when we are running). In this case, we simply jump back
- * to rerun the NMI handler again, and restart the 'latched' NMI.
+ * If an NMI executes an iret, another NMI can preempt it. We do not
+ * want to allow this new NMI to run, but we want to execute it when the
+ * first one finishes. We set the state to "latched", and the exit of
+ * the first NMI will perform a dec_return, if the result is zero
+ * (NOT_RUNNING), then it will simply exit the NMI handler. If not, the
+ * dec_return would have set the state to NMI_EXECUTING (what we want it
+ * to be when we are running). In this case, we simply jump back to
+ * rerun the NMI handler again, and restart the 'latched' NMI.
*
* No trap (breakpoint or page fault) should be hit before nmi_restart,
* thus there is no race between the first check of state for NOT_RUNNING
@@ -412,49 +411,36 @@ enum nmi_states {
static DEFINE_PER_CPU(enum nmi_states, nmi_state);
static DEFINE_PER_CPU(unsigned long, nmi_cr2);
-#define nmi_nesting_preprocess(regs) \
- do { \
- if (this_cpu_read(nmi_state) != NMI_NOT_RUNNING) { \
- this_cpu_write(nmi_state, NMI_LATCHED); \
- return; \
- } \
- this_cpu_write(nmi_state, NMI_EXECUTING); \
- this_cpu_write(nmi_cr2, read_cr2()); \
- } while (0); \
- nmi_restart:
-
-#define nmi_nesting_postprocess() \
- do { \
- if (unlikely(this_cpu_read(nmi_cr2) != read_cr2())) \
- write_cr2(this_cpu_read(nmi_cr2)); \
- if (this_cpu_dec_return(nmi_state)) \
- goto nmi_restart; \
- } while (0)
-#else /* x86_64 */
+#ifdef CONFIG_X86_64
/*
- * In x86_64 things are a bit more difficult. This has the same problem
- * where an NMI hitting a breakpoint that calls iret will remove the
- * NMI context, allowing a nested NMI to enter. What makes this more
- * difficult is that both NMIs and breakpoints have their own stack.
- * When a new NMI or breakpoint is executed, the stack is set to a fixed
- * point. If an NMI is nested, it will have its stack set at that same
- * fixed address that the first NMI had, and will start corrupting the
- * stack. This is handled in entry_64.S, but the same problem exists with
- * the breakpoint stack.
+ * In x86_64, we need to handle breakpoint -> NMI -> breakpoint. Without
+ * some care, the inner breakpoint will clobber the outer breakpoint's
+ * stack.
*
- * If a breakpoint is being processed, and the debug stack is being used,
- * if an NMI comes in and also hits a breakpoint, the stack pointer
- * will be set to the same fixed address as the breakpoint that was
- * interrupted, causing that stack to be corrupted. To handle this case,
- * check if the stack that was interrupted is the debug stack, and if
- * so, change the IDT so that new breakpoints will use the current stack
- * and not switch to the fixed address. On return of the NMI, switch back
- * to the original IDT.
+ * If a breakpoint is being processed, and the debug stack is being
+ * used, if an NMI comes in and also hits a breakpoint, the stack
+ * pointer will be set to the same fixed address as the breakpoint that
+ * was interrupted, causing that stack to be corrupted. To handle this
+ * case, check if the stack that was interrupted is the debug stack, and
+ * if so, change the IDT so that new breakpoints will use the current
+ * stack and not switch to the fixed address. On return of the NMI,
+ * switch back to the original IDT.
*/
static DEFINE_PER_CPU(int, update_debug_stack);
+#endif
-static inline void nmi_nesting_preprocess(struct pt_regs *regs)
+dotraplinkage notrace void
+do_nmi(struct pt_regs *regs, long error_code)
{
+ if (this_cpu_read(nmi_state) != NMI_NOT_RUNNING) {
+ this_cpu_write(nmi_state, NMI_LATCHED);
+ return;
+ }
+ this_cpu_write(nmi_state, NMI_EXECUTING);
+ this_cpu_write(nmi_cr2, read_cr2());
+nmi_restart:
+
+#ifdef CONFIG_X86_64
/*
* If we interrupted a breakpoint, it is possible that
* the nmi handler will have breakpoints too. We need to
@@ -465,22 +451,8 @@ static inline void nmi_nesting_preprocess(struct pt_regs *regs)
debug_stack_set_zero();
this_cpu_write(update_debug_stack, 1);
}
-}
-
-static inline void nmi_nesting_postprocess(void)
-{
- if (unlikely(this_cpu_read(update_debug_stack))) {
- debug_stack_reset();
- this_cpu_write(update_debug_stack, 0);
- }
-}
#endif
-dotraplinkage notrace __kprobes void
-do_nmi(struct pt_regs *regs, long error_code)
-{
- nmi_nesting_preprocess(regs);
-
nmi_enter();
inc_irq_stat(__nmi_count);
@@ -489,9 +461,17 @@ do_nmi(struct pt_regs *regs, long error_code)
default_do_nmi(regs);
nmi_exit();
+#ifdef CONFIG_X86_64
+ if (unlikely(this_cpu_read(update_debug_stack))) {
+ debug_stack_reset();
+ this_cpu_write(update_debug_stack, 0);
+ }
+#endif
- /* On i386, may loop back to preprocess */
- nmi_nesting_postprocess();
+ if (unlikely(this_cpu_read(nmi_cr2) != read_cr2()))
+ write_cr2(this_cpu_read(nmi_cr2));
+ if (this_cpu_dec_return(nmi_state))
+ goto nmi_restart;
}
void stop_nmi(void)
--
1.8.3.1
Tree/Branch: v4.15.17
Git describe: v4.15.17
Commit: b22a1fa1b3 Linux 4.15.17
Build Time: 0 min 27 sec
Passed: 0 / 11 ( 0.00 %)
Failed: 11 / 11 (100.00 %)
Errors: 8
Warnings: 0
Section Mismatches: 0
Failed defconfigs:
arm64-allnoconfig
arm64-allmodconfig
arm-multi_v5_defconfig
arm-multi_v7_defconfig
x86_64-defconfig
arm-allmodconfig
arm-allnoconfig
arm-multi_v4t_defconfig
x86_64-allmodconfig
arm64-defconfig
Errors:
arm64-allnoconfig
../scripts/mod/file2alias.c:97:68: error: 'OFF_tb_service_id_match_flags' undeclared (first use in this function)
../scripts/mod/file2alias.c:103:45: error: 'OFF_tb_service_id_protocol_key' undeclared (first use in this function)
../scripts/mod/file2alias.c:97:68: error: 'OFF_tb_service_id_protocol_id' undeclared (first use in this function)
../scripts/mod/file2alias.c:97:68: error: 'OFF_tb_service_id_protocol_version' undeclared (first use in this function)
../scripts/mod/file2alias.c:97:68: error: 'OFF_tb_service_id_protocol_revision' undeclared (first use in this function)
../scripts/mod/file2alias.c:111:3: error: 'SIZE_tb_service_id' undeclared here (not in a function)
arm64-allmodconfig
../scripts/mod/file2alias.c:97:68: error: 'OFF_tb_service_id_match_flags' undeclared (first use in this function)
../scripts/mod/file2alias.c:103:45: error: 'OFF_tb_service_id_protocol_key' undeclared (first use in this function)
../scripts/mod/file2alias.c:97:68: error: 'OFF_tb_service_id_protocol_id' undeclared (first use in this function)
../scripts/mod/file2alias.c:97:68: error: 'OFF_tb_service_id_protocol_version' undeclared (first use in this function)
../scripts/mod/file2alias.c:97:68: error: 'OFF_tb_service_id_protocol_revision' undeclared (first use in this function)
../scripts/mod/file2alias.c:111:3: error: 'SIZE_tb_service_id' undeclared here (not in a function)
arm-multi_v5_defconfig
../arch/arm/include/asm/string.h:45:3: error: expected identifier or '(' before '{' token
arm-multi_v7_defconfig
../arch/arm/include/asm/string.h:45:3: error: expected identifier or '(' before '{' token
x86_64-defconfig
../scripts/mod/file2alias.c:97:68: error: 'OFF_tb_service_id_match_flags' undeclared (first use in this function)
../scripts/mod/file2alias.c:103:45: error: 'OFF_tb_service_id_protocol_key' undeclared (first use in this function)
../scripts/mod/file2alias.c:97:68: error: 'OFF_tb_service_id_protocol_id' undeclared (first use in this function)
../scripts/mod/file2alias.c:97:68: error: 'OFF_tb_service_id_protocol_version' undeclared (first use in this function)
../scripts/mod/file2alias.c:97:68: error: 'OFF_tb_service_id_protocol_revision' undeclared (first use in this function)
../scripts/mod/file2alias.c:111:3: error: 'SIZE_tb_service_id' undeclared here (not in a function)
arm-allmodconfig
../arch/arm/include/asm/string.h:45:3: error: expected identifier or '(' before '{' token
arm-allnoconfig
orc.h:21:27: fatal error: asm/orc_types.h: No such file or directory
orc.h:21:27: fatal error: asm/orc_types.h: No such file or directory
arm-multi_v4t_defconfig
../arch/arm/include/asm/string.h:45:3: error: expected identifier or '(' before '{' token
x86_64-allmodconfig
../scripts/mod/file2alias.c:97:68: error: 'OFF_tb_service_id_match_flags' undeclared (first use in this function)
../scripts/mod/file2alias.c:103:45: error: 'OFF_tb_service_id_protocol_key' undeclared (first use in this function)
../scripts/mod/file2alias.c:97:68: error: 'OFF_tb_service_id_protocol_id' undeclared (first use in this function)
../scripts/mod/file2alias.c:97:68: error: 'OFF_tb_service_id_protocol_version' undeclared (first use in this function)
../scripts/mod/file2alias.c:97:68: error: 'OFF_tb_service_id_protocol_revision' undeclared (first use in this function)
../scripts/mod/file2alias.c:111:3: error: 'SIZE_tb_service_id' undeclared here (not in a function)
arm64-defconfig
orc.h:21:27: fatal error: asm/orc_types.h: No such file or directory
orc.h:21:27: fatal error: asm/orc_types.h: No such file or directory
orc.h:21:27: fatal error: asm/orc_types.h: No such file or directory
-------------------------------------------------------------------------------
defconfigs with issues (other than build errors):
-------------------------------------------------------------------------------
Errors summary: 8
5 orc.h:21:27: fatal error: asm/orc_types.h: No such file or directory
4 ../scripts/mod/file2alias.c:97:68: error: 'OFF_tb_service_id_protocol_version' undeclared (first use in this function)
4 ../scripts/mod/file2alias.c:97:68: error: 'OFF_tb_service_id_protocol_revision' undeclared (first use in this function)
4 ../scripts/mod/file2alias.c:97:68: error: 'OFF_tb_service_id_protocol_id' undeclared (first use in this function)
4 ../scripts/mod/file2alias.c:97:68: error: 'OFF_tb_service_id_match_flags' undeclared (first use in this function)
4 ../scripts/mod/file2alias.c:111:3: error: 'SIZE_tb_service_id' undeclared here (not in a function)
4 ../scripts/mod/file2alias.c:103:45: error: 'OFF_tb_service_id_protocol_key' undeclared (first use in this function)
4 ../arch/arm/include/asm/string.h:45:3: error: expected identifier or '(' before '{' token
===============================================================================
Detailed per-defconfig build reports below:
-------------------------------------------------------------------------------
arm64-allnoconfig : FAIL, 6 errors, 0 warnings, 0 section mismatches
Errors:
../scripts/mod/file2alias.c:97:68: error: 'OFF_tb_service_id_match_flags' undeclared (first use in this function)
../scripts/mod/file2alias.c:103:45: error: 'OFF_tb_service_id_protocol_key' undeclared (first use in this function)
../scripts/mod/file2alias.c:97:68: error: 'OFF_tb_service_id_protocol_id' undeclared (first use in this function)
../scripts/mod/file2alias.c:97:68: error: 'OFF_tb_service_id_protocol_version' undeclared (first use in this function)
../scripts/mod/file2alias.c:97:68: error: 'OFF_tb_service_id_protocol_revision' undeclared (first use in this function)
../scripts/mod/file2alias.c:111:3: error: 'SIZE_tb_service_id' undeclared here (not in a function)
-------------------------------------------------------------------------------
arm64-allmodconfig : FAIL, 6 errors, 0 warnings, 0 section mismatches
Errors:
../scripts/mod/file2alias.c:97:68: error: 'OFF_tb_service_id_match_flags' undeclared (first use in this function)
../scripts/mod/file2alias.c:103:45: error: 'OFF_tb_service_id_protocol_key' undeclared (first use in this function)
../scripts/mod/file2alias.c:97:68: error: 'OFF_tb_service_id_protocol_id' undeclared (first use in this function)
../scripts/mod/file2alias.c:97:68: error: 'OFF_tb_service_id_protocol_version' undeclared (first use in this function)
../scripts/mod/file2alias.c:97:68: error: 'OFF_tb_service_id_protocol_revision' undeclared (first use in this function)
../scripts/mod/file2alias.c:111:3: error: 'SIZE_tb_service_id' undeclared here (not in a function)
-------------------------------------------------------------------------------
arm-multi_v5_defconfig : FAIL, 1 errors, 0 warnings, 0 section mismatches
Errors:
../arch/arm/include/asm/string.h:45:3: error: expected identifier or '(' before '{' token
-------------------------------------------------------------------------------
arm-multi_v7_defconfig : FAIL, 1 errors, 0 warnings, 0 section mismatches
Errors:
../arch/arm/include/asm/string.h:45:3: error: expected identifier or '(' before '{' token
-------------------------------------------------------------------------------
x86_64-defconfig : FAIL, 6 errors, 0 warnings, 0 section mismatches
Errors:
../scripts/mod/file2alias.c:97:68: error: 'OFF_tb_service_id_match_flags' undeclared (first use in this function)
../scripts/mod/file2alias.c:103:45: error: 'OFF_tb_service_id_protocol_key' undeclared (first use in this function)
../scripts/mod/file2alias.c:97:68: error: 'OFF_tb_service_id_protocol_id' undeclared (first use in this function)
../scripts/mod/file2alias.c:97:68: error: 'OFF_tb_service_id_protocol_version' undeclared (first use in this function)
../scripts/mod/file2alias.c:97:68: error: 'OFF_tb_service_id_protocol_revision' undeclared (first use in this function)
../scripts/mod/file2alias.c:111:3: error: 'SIZE_tb_service_id' undeclared here (not in a function)
-------------------------------------------------------------------------------
arm-allmodconfig : FAIL, 1 errors, 0 warnings, 0 section mismatches
Errors:
../arch/arm/include/asm/string.h:45:3: error: expected identifier or '(' before '{' token
-------------------------------------------------------------------------------
arm-allnoconfig : FAIL, 2 errors, 0 warnings, 0 section mismatches
Errors:
orc.h:21:27: fatal error: asm/orc_types.h: No such file or directory
orc.h:21:27: fatal error: asm/orc_types.h: No such file or directory
-------------------------------------------------------------------------------
arm-multi_v4t_defconfig : FAIL, 1 errors, 0 warnings, 0 section mismatches
Errors:
../arch/arm/include/asm/string.h:45:3: error: expected identifier or '(' before '{' token
-------------------------------------------------------------------------------
x86_64-allmodconfig : FAIL, 6 errors, 0 warnings, 0 section mismatches
Errors:
../scripts/mod/file2alias.c:97:68: error: 'OFF_tb_service_id_match_flags' undeclared (first use in this function)
../scripts/mod/file2alias.c:103:45: error: 'OFF_tb_service_id_protocol_key' undeclared (first use in this function)
../scripts/mod/file2alias.c:97:68: error: 'OFF_tb_service_id_protocol_id' undeclared (first use in this function)
../scripts/mod/file2alias.c:97:68: error: 'OFF_tb_service_id_protocol_version' undeclared (first use in this function)
../scripts/mod/file2alias.c:97:68: error: 'OFF_tb_service_id_protocol_revision' undeclared (first use in this function)
../scripts/mod/file2alias.c:111:3: error: 'SIZE_tb_service_id' undeclared here (not in a function)
-------------------------------------------------------------------------------
arm64-defconfig : FAIL, 3 errors, 0 warnings, 0 section mismatches
Errors:
orc.h:21:27: fatal error: asm/orc_types.h: No such file or directory
orc.h:21:27: fatal error: asm/orc_types.h: No such file or directory
orc.h:21:27: fatal error: asm/orc_types.h: No such file or directory
-------------------------------------------------------------------------------
Passed with no errors, warnings or mismatches:
x86_64-allnoconfig
Tree/Branch: v4.14.34
Git describe: v4.14.34
Commit: ffebeb0d7c Linux 4.14.34
Build Time: 0 min 29 sec
Passed: 0 / 11 ( 0.00 %)
Failed: 11 / 11 (100.00 %)
Errors: 2
Warnings: 4
Section Mismatches: 0
Failed defconfigs:
arm-multi_v5_defconfig
arm-multi_v7_defconfig
arm-allmodconfig
arm-multi_v4t_defconfig
arm-allnoconfig
arm64-defconfig
Errors:
arm-multi_v5_defconfig
../arch/arm/include/asm/string.h:45:3: error: expected identifier or '(' before '{' token
arm-multi_v7_defconfig
../arch/arm/include/asm/string.h:45:3: error: expected identifier or '(' before '{' token
arm-allmodconfig
../arch/arm/include/asm/string.h:45:3: error: expected identifier or '(' before '{' token
arm-multi_v4t_defconfig
../arch/arm/include/asm/string.h:45:3: error: expected identifier or '(' before '{' token
arm-allnoconfig
orc.h:21:27: fatal error: asm/orc_types.h: No such file or directory
orc.h:21:27: fatal error: asm/orc_types.h: No such file or directory
orc.h:21:27: fatal error: asm/orc_types.h: No such file or directory
../arch/arm/include/asm/string.h:45:3: error: expected identifier or '(' before '{' token
arm64-defconfig
orc.h:21:27: fatal error: asm/orc_types.h: No such file or directory
orc.h:21:27: fatal error: asm/orc_types.h: No such file or directory
orc.h:21:27: fatal error: asm/orc_types.h: No such file or directory
-------------------------------------------------------------------------------
defconfigs with issues (other than build errors):
4 warnings 0 mismatches : arm-allnoconfig
-------------------------------------------------------------------------------
Errors summary: 2
6 orc.h:21:27: fatal error: asm/orc_types.h: No such file or directory
5 ../arch/arm/include/asm/string.h:45:3: error: expected identifier or '(' before '{' token
Warnings Summary: 4
1 ../arch/arm/include/asm/barrier.h:9:5: warning: "__LINUX_ARM_ARCH__" is not defined [-Wundef]
1 ../arch/arm/include/asm/barrier.h:20:35: warning: "__LINUX_ARM_ARCH__" is not defined [-Wundef]
1 ../arch/arm/include/asm/barrier.h:16:5: warning: "__LINUX_ARM_ARCH__" is not defined [-Wundef]
1 ../arch/arm/include/asm/barrier.h:10:3: warning: "__LINUX_ARM_ARCH__" is not defined [-Wundef]
===============================================================================
Detailed per-defconfig build reports below:
-------------------------------------------------------------------------------
arm-multi_v5_defconfig : FAIL, 1 errors, 0 warnings, 0 section mismatches
Errors:
../arch/arm/include/asm/string.h:45:3: error: expected identifier or '(' before '{' token
-------------------------------------------------------------------------------
arm-multi_v7_defconfig : FAIL, 1 errors, 0 warnings, 0 section mismatches
Errors:
../arch/arm/include/asm/string.h:45:3: error: expected identifier or '(' before '{' token
-------------------------------------------------------------------------------
arm-allmodconfig : FAIL, 1 errors, 0 warnings, 0 section mismatches
Errors:
../arch/arm/include/asm/string.h:45:3: error: expected identifier or '(' before '{' token
-------------------------------------------------------------------------------
arm-multi_v4t_defconfig : FAIL, 1 errors, 0 warnings, 0 section mismatches
Errors:
../arch/arm/include/asm/string.h:45:3: error: expected identifier or '(' before '{' token
-------------------------------------------------------------------------------
arm-allnoconfig : FAIL, 4 errors, 4 warnings, 0 section mismatches
Errors:
orc.h:21:27: fatal error: asm/orc_types.h: No such file or directory
orc.h:21:27: fatal error: asm/orc_types.h: No such file or directory
orc.h:21:27: fatal error: asm/orc_types.h: No such file or directory
../arch/arm/include/asm/string.h:45:3: error: expected identifier or '(' before '{' token
Warnings:
../arch/arm/include/asm/barrier.h:9:5: warning: "__LINUX_ARM_ARCH__" is not defined [-Wundef]
../arch/arm/include/asm/barrier.h:10:3: warning: "__LINUX_ARM_ARCH__" is not defined [-Wundef]
../arch/arm/include/asm/barrier.h:16:5: warning: "__LINUX_ARM_ARCH__" is not defined [-Wundef]
../arch/arm/include/asm/barrier.h:20:35: warning: "__LINUX_ARM_ARCH__" is not defined [-Wundef]
-------------------------------------------------------------------------------
arm64-defconfig : FAIL, 3 errors, 0 warnings, 0 section mismatches
Errors:
orc.h:21:27: fatal error: asm/orc_types.h: No such file or directory
orc.h:21:27: fatal error: asm/orc_types.h: No such file or directory
orc.h:21:27: fatal error: asm/orc_types.h: No such file or directory
-------------------------------------------------------------------------------
Passed with no errors, warnings or mismatches:
x86_64-allnoconfig
arm64-allnoconfig
arm64-allmodconfig
x86_64-allmodconfig
x86_64-defconfig
The normal request completion can be done before or during handling
BLK_EH_RESET_TIMER, and this race may cause the request to never
be completed since driver's .timeout() may always return
BLK_EH_RESET_TIMER.
This issue can't be fixed completely by driver, since the normal
completion can be done between returning .timeout() and handing
BLK_EH_RESET_TIMER.
This patch fixes this race by introducing rq state of MQ_RQ_COMPLETE_IN_RESET,
and reading/writing rq's state by holding queue lock, which can be
per-request actually, but just not necessary to introduce one lock for
so unusual event.
Cc: Bart Van Assche <bart.vanassche(a)wdc.com>
Cc: Tejun Heo <tj(a)kernel.org>
Cc: Christoph Hellwig <hch(a)lst.de>
Cc: Ming Lei <ming.lei(a)redhat.com>
Cc: Sagi Grimberg <sagi(a)grimberg.me>
Cc: Israel Rukshin <israelr(a)mellanox.com>,
Cc: Max Gurtovoy <maxg(a)mellanox.com>
Cc: stable(a)vger.kernel.org
Signed-off-by: Ming Lei <ming.lei(a)redhat.com>
---
V2:
- rename the new flag as MQ_RQ_COMPLETE_IN_TIMEOUT
- fix lock uses in blk_mq_rq_timed_out
- document re-order between blk_add_timer() and
blk_mq_rq_update_aborted_gstate(req, 0)
block/blk-mq.c | 49 ++++++++++++++++++++++++++++++++++++++++++++-----
block/blk-mq.h | 1 +
2 files changed, 45 insertions(+), 5 deletions(-)
diff --git a/block/blk-mq.c b/block/blk-mq.c
index 0dc9e341c2a7..db1c84b2bb5e 100644
--- a/block/blk-mq.c
+++ b/block/blk-mq.c
@@ -630,10 +630,27 @@ void blk_mq_complete_request(struct request *rq)
* However, that would complicate paths which want to synchronize
* against us. Let stay in sync with the issue path so that
* hctx_lock() covers both issue and completion paths.
+ *
+ * Cover complete vs BLK_EH_RESET_TIMER race in slow path with
+ * helding queue lock.
*/
hctx_lock(hctx, &srcu_idx);
if (blk_mq_rq_aborted_gstate(rq) != rq->gstate)
__blk_mq_complete_request(rq);
+ else {
+ unsigned long flags;
+ bool need_complete = false;
+
+ spin_lock_irqsave(q->queue_lock, flags);
+ if (!blk_mq_rq_aborted_gstate(rq))
+ need_complete = true;
+ else
+ blk_mq_rq_update_state(rq, MQ_RQ_COMPLETE_IN_TIMEOUT);
+ spin_unlock_irqrestore(q->queue_lock, flags);
+
+ if (need_complete)
+ __blk_mq_complete_request(rq);
+ }
hctx_unlock(hctx, srcu_idx);
}
EXPORT_SYMBOL(blk_mq_complete_request);
@@ -814,6 +831,7 @@ static void blk_mq_rq_timed_out(struct request *req, bool reserved)
{
const struct blk_mq_ops *ops = req->q->mq_ops;
enum blk_eh_timer_return ret = BLK_EH_RESET_TIMER;
+ unsigned long flags;
req->rq_flags |= RQF_MQ_TIMEOUT_EXPIRED;
@@ -826,12 +844,33 @@ static void blk_mq_rq_timed_out(struct request *req, bool reserved)
break;
case BLK_EH_RESET_TIMER:
/*
- * As nothing prevents from completion happening while
- * ->aborted_gstate is set, this may lead to ignored
- * completions and further spurious timeouts.
+ * The normal completion may happen during handling the
+ * timeout, or even after returning from .timeout(), so
+ * once the request has been completed, we can't reset
+ * timer any more since this request may be handled as
+ * BLK_EH_RESET_TIMER in next timeout handling too, and
+ * it has to be completed in this situation.
+ *
+ * Holding the queue lock to cover read/write rq's
+ * aborted_gstate and normal state, so the race can be
+ * avoided completely.
+ *
+ * blk_add_timer() may be re-ordered with resetting
+ * aborted_gstate, and the only side-effec is that if this
+ * request is recycled after aborted_gstate is cleared, it
+ * may be timed out a bit late, that is what we can survive
+ * given timeout event is so unusual.
*/
- blk_mq_rq_update_aborted_gstate(req, 0);
- blk_add_timer(req);
+ spin_lock_irqsave(req->q->queue_lock, flags);
+ if (blk_mq_rq_state(req) != MQ_RQ_COMPLETE_IN_TIMEOUT) {
+ blk_add_timer(req);
+ blk_mq_rq_update_aborted_gstate(req, 0);
+ spin_unlock_irqrestore(req->q->queue_lock, flags);
+ } else {
+ blk_mq_rq_update_state(req, MQ_RQ_IN_FLIGHT);
+ spin_unlock_irqrestore(req->q->queue_lock, flags);
+ __blk_mq_complete_request(req);
+ }
break;
case BLK_EH_NOT_HANDLED:
break;
diff --git a/block/blk-mq.h b/block/blk-mq.h
index 88c558f71819..0426d048743d 100644
--- a/block/blk-mq.h
+++ b/block/blk-mq.h
@@ -35,6 +35,7 @@ enum mq_rq_state {
MQ_RQ_IDLE = 0,
MQ_RQ_IN_FLIGHT = 1,
MQ_RQ_COMPLETE = 2,
+ MQ_RQ_COMPLETE_IN_TIMEOUT = 3,
MQ_RQ_STATE_BITS = 2,
MQ_RQ_STATE_MASK = (1 << MQ_RQ_STATE_BITS) - 1,
--
2.9.5
On 14/03/18 09:48, Jan Beulich wrote:
>>>> On 26.02.18 at 15:08, <jgross(a)suse.com> wrote:
>> @@ -35,6 +40,9 @@ void xen_arch_post_suspend(int cancelled)
>>
>> static void xen_vcpu_notify_restore(void *data)
>> {
>> + if (xen_pv_domain() && boot_cpu_has(X86_FEATURE_SPEC_CTRL))
>> + wrmsrl(MSR_IA32_SPEC_CTRL, this_cpu_read(spec_ctrl));
>> +
>> /* Boot processor notified via generic timekeeping_resume() */
>> if (smp_processor_id() == 0)
>> return;
>> @@ -44,7 +52,15 @@ static void xen_vcpu_notify_restore(void *data)
>>
>> static void xen_vcpu_notify_suspend(void *data)
>> {
>> + u64 tmp;
>> +
>> tick_suspend_local();
>> +
>> + if (xen_pv_domain() && boot_cpu_has(X86_FEATURE_SPEC_CTRL)) {
>> + rdmsrl(MSR_IA32_SPEC_CTRL, tmp);
>> + this_cpu_write(spec_ctrl, tmp);
>> + wrmsrl(MSR_IA32_SPEC_CTRL, 0);
>> + }
>> }
>
> While investigating ways how to do something similar on our old,
> non-pvops kernels I've started wondering if this solution is actually
> correct in all cases. Of course discussing this is complicated by the
> fact that the change there might be a conflict with hasn't landed
> in Linus'es tree yet (see e.g.
> https://patchwork.kernel.org/patch/10153843/ for an upstream
> submission; I haven't been able to find any discussion on that
> patch or why it isn't upstream yet), but we have it in our various
> branches. The potential problem I'm seeing is with the clearing
> and re-setting of SPEC_CTRL around CPUs going idle. While the
> active CPU could have preemption disabled (if that isn't the case
> already), the passive CPUs are - afaict - neither under full control
> of drivers/xen/manage.c:do_suspend() nor excluded yet from
> any further scheduling activity. Hence with code like this (taken
> from one of our branches)
>
> static void mwait_idle(void)
> {
> if (!current_set_polling_and_test()) {
> trace_cpu_idle_rcuidle(1, smp_processor_id());
> if (this_cpu_has(X86_BUG_CLFLUSH_MONITOR)) {
> smp_mb(); /* quirk */
> clflush((void *)¤t_thread_info()->flags);
> smp_mb(); /* quirk */
> }
>
> x86_disable_ibrs();
>
> __monitor((void *)¤t_thread_info()->flags, 0, 0);
> if (!need_resched())
> __sti_mwait(0, 0);
> else
> local_irq_enable();
>
> x86_enable_ibrs();
> ...
>
> the MSR might get set to non-zero again after having been
> cleared by the code your patch adds. I therefore think that the
> only race free solution would be to do the clearing from
> stop-machine context. But maybe I'm overlooking something.
Currently and with the above mentioned patch there is no problem: Xen pv
guests always use default_idle(), so mwait_idle() eventually playing
with MSR_IA32_SPEC_CTRL won't affect us.
In order to ensure that won't change in future default_idle() should
never modify MSR_IA32_SPEC_CTRL. In case something like that would be
required we should rather add another idle function doing that.
Juergen