[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200219150744.604459293@infradead.org>
Date: Wed, 19 Feb 2020 15:47:28 +0100
From: Peter Zijlstra <peterz@...radead.org>
To: linux-kernel@...r.kernel.org, linux-arch@...r.kernel.org,
rostedt@...dmis.org
Cc: peterz@...radead.org, mingo@...nel.org, joel@...lfernandes.org,
gregkh@...uxfoundation.org, gustavo@...eddedor.com,
tglx@...utronix.de, paulmck@...nel.org, josh@...htriplett.org,
mathieu.desnoyers@...icios.com, jiangshanlai@...il.com,
luto@...nel.org, tony.luck@...el.com, frederic@...nel.org,
dan.carpenter@...cle.com, mhiramat@...nel.org
Subject: [PATCH v3 04/22] x86/doublefault: Make memmove() notrace/NOKPROBE
Hitting the tracer or a kprobes from #DF is 'interesting', lets avoid
that.
Signed-off-by: Peter Zijlstra (Intel) <peterz@...radead.org>
---
arch/x86/kernel/traps.c | 3 ++-
arch/x86/lib/memcpy_32.c | 7 ++++++-
arch/x86/lib/memmove_64.S | 5 +++++
3 files changed, 13 insertions(+), 2 deletions(-)
--- a/arch/x86/kernel/traps.c
+++ b/arch/x86/kernel/traps.c
@@ -271,7 +271,8 @@ dotraplinkage void do_double_fault(struc
* The net result is that our #GP handler will think that we
* entered from usermode with the bad user context.
*
- * No need for nmi_enter() here because we don't use RCU.
+ * No need for nmi_enter() here because we don't call out to anything
+ * except memmove() and that is notrace/NOKPROBE.
*/
if (((long)regs->sp >> P4D_SHIFT) == ESPFIX_PGD_ENTRY &&
regs->cs == __KERNEL_CS &&
--- a/arch/x86/lib/memcpy_32.c
+++ b/arch/x86/lib/memcpy_32.c
@@ -21,7 +21,7 @@ __visible void *memset(void *s, int c, s
}
EXPORT_SYMBOL(memset);
-__visible void *memmove(void *dest, const void *src, size_t n)
+__visible notrace void *memmove(void *dest, const void *src, size_t n)
{
int d0,d1,d2,d3,d4,d5;
char *ret = dest;
@@ -207,3 +207,8 @@ __visible void *memmove(void *dest, cons
}
EXPORT_SYMBOL(memmove);
+/*
+ * The double fault handler uses memmove(), do not mess with it or risk a
+ * tripple fault.
+ */
+NOKPROBE_SYMBOL(memmove);
--- a/arch/x86/lib/memmove_64.S
+++ b/arch/x86/lib/memmove_64.S
@@ -212,3 +212,8 @@ SYM_FUNC_END(__memmove)
SYM_FUNC_END_ALIAS(memmove)
EXPORT_SYMBOL(__memmove)
EXPORT_SYMBOL(memmove)
+/*
+ * The double fault handler uses memmove(), do not mess with it or risk a
+ * tripple fault.
+ */
+_ASM_NOKPROBE(__memmove)
Powered by blists - more mailing lists