Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1212590

Re: [PATCH] ARM: probes: Don't stop the machine if we're in the debugger

From Stephen Boyd <sboyd@codeaurora.org>
Newsgroups linux.kernel
Subject Re: [PATCH] ARM: probes: Don't stop the machine if we're in the debugger
Date 2015-08-25 02:20 +0200
Message-ID <q1a81-6XQ-3@gated-at.bofh.it> (permalink)
References <q19OF-6lZ-15@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On 08/24/2015 04:58 PM, Douglas Anderson wrote:
> 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>
> ---

Can you add the backtrace?

>   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);
>   }

Perhaps it would be better to add a different function for the kgdb call 
site? Then it's explicit what's going on without us having to figure out 
when in_dbg_master() is true.

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH] ARM: probes: Don't stop the machine if we're in the debugger Douglas Anderson <dianders@chromium.org> - 2015-08-25 02:00 +0200
  Re: [PATCH] ARM: probes: Don't stop the machine if we're in the debugger Stephen Boyd <sboyd@codeaurora.org> - 2015-08-25 02:20 +0200
    Re: [PATCH] ARM: probes: Don't stop the machine if we're in the debugger Kees Cook <keescook@chromium.org> - 2015-08-25 19:00 +0200
      Re: [PATCH] ARM: probes: Don't stop the machine if we're in the debugger Doug Anderson <dianders@chromium.org> - 2015-08-25 21:50 +0200
    Re: [PATCH] ARM: probes: Don't stop the machine if we're in the debugger Doug Anderson <dianders@chromium.org> - 2015-08-26 00:10 +0200

csiph-web