All of lore.kernel.org
 help / color / mirror / Atom feed
From: yang.shi@linaro.org (Shi, Yang)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] arm64: disable kasan when accessing frame->fp in unwind_frame
Date: Mon, 8 Feb 2016 09:12:21 -0800	[thread overview]
Message-ID: <56B8CC75.1000508@linaro.org> (raw)
In-Reply-To: <56B856F5.5080606@virtuozzo.com>

On 2/8/2016 12:51 AM, Andrey Ryabinin wrote:
>
>
> On 02/06/2016 02:04 AM, Yang Shi wrote:
>>
>>   #include <asm/irq.h>
>>   #include <asm/stacktrace.h>
>> @@ -64,7 +65,9 @@ int notrace unwind_frame(struct task_struct *tsk, struct stackframe *frame)
>>   		return -EINVAL;
>>
>>   	frame->sp = fp + 0x10;
>> +	kasan_disable_current();
>>   	frame->fp = *(unsigned long *)(fp);
>
> It would be better to use READ_ONCE_NOCHECK() here.
> See f7d27c35ddff7 ("x86/mm, kasan: Silence KASAN warnings in get_wchan()") which solves the same problem for x86.

Thanks for the suggestion, I'm going to try it soon.

>
>> +	kasan_enable_current();
>>   	frame->pc = *(unsigned long *)(fp + 8);
>
> Why you left frame->pc out of scope? This line could trigger kasan as well.

Actually, it was not reported as frequently as the first one. In my 
first a couple of boot test, it was not triggered before I came up with 
the patch. The first one is triggered every time.

It will be fixed in v2 too.

Thanks,
Yang

>
>>
>>   #ifdef CONFIG_FUNCTION_GRAPH_TRACER
>>

WARNING: multiple messages have this Message-ID (diff)
From: "Shi, Yang" <yang.shi@linaro.org>
To: Andrey Ryabinin <aryabinin@virtuozzo.com>,
	Will.Deacon@arm.com, Catalin.Marinas@arm.com
Cc: linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linaro-kernel@lists.linaro.org
Subject: Re: [PATCH] arm64: disable kasan when accessing frame->fp in unwind_frame
Date: Mon, 8 Feb 2016 09:12:21 -0800	[thread overview]
Message-ID: <56B8CC75.1000508@linaro.org> (raw)
In-Reply-To: <56B856F5.5080606@virtuozzo.com>

On 2/8/2016 12:51 AM, Andrey Ryabinin wrote:
>
>
> On 02/06/2016 02:04 AM, Yang Shi wrote:
>>
>>   #include <asm/irq.h>
>>   #include <asm/stacktrace.h>
>> @@ -64,7 +65,9 @@ int notrace unwind_frame(struct task_struct *tsk, struct stackframe *frame)
>>   		return -EINVAL;
>>
>>   	frame->sp = fp + 0x10;
>> +	kasan_disable_current();
>>   	frame->fp = *(unsigned long *)(fp);
>
> It would be better to use READ_ONCE_NOCHECK() here.
> See f7d27c35ddff7 ("x86/mm, kasan: Silence KASAN warnings in get_wchan()") which solves the same problem for x86.

Thanks for the suggestion, I'm going to try it soon.

>
>> +	kasan_enable_current();
>>   	frame->pc = *(unsigned long *)(fp + 8);
>
> Why you left frame->pc out of scope? This line could trigger kasan as well.

Actually, it was not reported as frequently as the first one. In my 
first a couple of boot test, it was not triggered before I came up with 
the patch. The first one is triggered every time.

It will be fixed in v2 too.

Thanks,
Yang

>
>>
>>   #ifdef CONFIG_FUNCTION_GRAPH_TRACER
>>

  reply	other threads:[~2016-02-08 17:12 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-05 23:04 [PATCH] arm64: disable kasan when accessing frame->fp in unwind_frame Yang Shi
2016-02-05 23:04 ` Yang Shi
2016-02-08  8:51 ` Andrey Ryabinin
2016-02-08  8:51   ` Andrey Ryabinin
2016-02-08 17:12   ` Shi, Yang [this message]
2016-02-08 17:12     ` Shi, Yang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=56B8CC75.1000508@linaro.org \
    --to=yang.shi@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.