lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Tue, 25 Aug 2015 09:50:11 -0700
From:	Kees Cook <keescook@...omium.org>
To:	Stephen Boyd <sboyd@...eaurora.org>
Cc:	Douglas Anderson <dianders@...omium.org>,
	Nicolas Pitre <nico@...aro.org>,
	Jon Medhurst <tixy@...aro.org>, wangnan0 <wangnan0@...wei.com>,
	Russell King - ARM Linux <linux@....linux.org.uk>,
	LKML <linux-kernel@...r.kernel.org>,
	Aapo Vienamo <avienamo@...dia.com>,
	Rabin Vincent <rabin@....in>,
	"linux-arm-kernel@...ts.infradead.org" 
	<linux-arm-kernel@...ts.infradead.org>
Subject: Re: [PATCH] ARM: probes: Don't stop the machine if we're in the debugger

On Mon, Aug 24, 2015 at 5:19 PM, Stephen Boyd <sboyd@...eaurora.org> wrote:
> 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@...dia.com>
>> Suggested-by: Kees Cook <keescook@...omium.org>

I actually suggested using in_atomic_preempt_off() which is I think a
better catch-all. Could you use that instead, please?

-Kees

>> Signed-off-by: Douglas Anderson <dianders@...omium.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
>



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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ