linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ARM: probes: Don't stop the machine if we're in the debugger
@ 2015-08-24 23:58 Douglas Anderson
  2015-08-25  0:19 ` Stephen Boyd
  0 siblings, 1 reply; 5+ messages in thread
From: Douglas Anderson @ 2015-08-24 23:58 UTC (permalink / raw)
  To: linux-arm-kernel

If we're in kgdb then the machine is already stopped.  Trying to stop
it again will cause us to try to sleep, which is not allowed while in
kgdb.  To avoid this problem, only stop the machine when we're not in
kgdb.

Reported-by: Aapo Vienamo <avienamo@nvidia.com>
Suggested-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Douglas Anderson <dianders@chromium.org>
---
 arch/arm/kernel/patch.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/arch/arm/kernel/patch.c b/arch/arm/kernel/patch.c
index 69bda1a..abf30ec 100644
--- a/arch/arm/kernel/patch.c
+++ b/arch/arm/kernel/patch.c
@@ -1,5 +1,6 @@
 #include <linux/kernel.h>
 #include <linux/spinlock.h>
+#include <linux/kgdb.h>
 #include <linux/kprobes.h>
 #include <linux/mm.h>
 #include <linux/stop_machine.h>
@@ -124,6 +125,9 @@ void __kprobes patch_text(void *addr, unsigned int insn)
 		.insn = insn,
 	};
 
-	stop_machine(patch_text_stop_machine, &patch, NULL);
+	/* Stop machine before patching; but not if in the debugger */
+	if (unlikely(in_dbg_master()))
+		patch_text_stop_machine(&patch);
+	else
+		stop_machine(patch_text_stop_machine, &patch, NULL);
 }
-- 
2.5.0.457.gab17608

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2015-08-25 22:08 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-08-24 23:58 [PATCH] ARM: probes: Don't stop the machine if we're in the debugger Douglas Anderson
2015-08-25  0:19 ` Stephen Boyd
2015-08-25 16:50   ` Kees Cook
2015-08-25 19:40     ` Doug Anderson
2015-08-25 22:08   ` Doug Anderson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).