All of lore.kernel.org
 help / color / mirror / Atom feed
From: aryabinin@virtuozzo.com (Andrey Ryabinin)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] arm64: disable kasan when accessing frame->fp in unwind_frame
Date: Mon, 8 Feb 2016 11:51:01 +0300	[thread overview]
Message-ID: <56B856F5.5080606@virtuozzo.com> (raw)
In-Reply-To: <1454713487-5239-1-git-send-email-yang.shi@linaro.org>



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.

> +	kasan_enable_current();
>  	frame->pc = *(unsigned long *)(fp + 8);

Why you left frame->pc out of scope? This line could trigger kasan as well.

>  
>  #ifdef CONFIG_FUNCTION_GRAPH_TRACER
> 

WARNING: multiple messages have this Message-ID (diff)
From: Andrey Ryabinin <aryabinin@virtuozzo.com>
To: Yang Shi <yang.shi@linaro.org>, <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 11:51:01 +0300	[thread overview]
Message-ID: <56B856F5.5080606@virtuozzo.com> (raw)
In-Reply-To: <1454713487-5239-1-git-send-email-yang.shi@linaro.org>



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.

> +	kasan_enable_current();
>  	frame->pc = *(unsigned long *)(fp + 8);

Why you left frame->pc out of scope? This line could trigger kasan as well.

>  
>  #ifdef CONFIG_FUNCTION_GRAPH_TRACER
> 

  reply	other threads:[~2016-02-08  8:51 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 [this message]
2016-02-08  8:51   ` Andrey Ryabinin
2016-02-08 17:12   ` Shi, Yang
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=56B856F5.5080606@virtuozzo.com \
    --to=aryabinin@virtuozzo.com \
    --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.