mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Mark Rutland <mark.rutland@arm.com>
To: Zhizhou Zhang <zhizhouzhang@asrmicro.com>
Cc: rostedt@goodmis.org, mingo@redhat.com,
	linux-kernel@vger.kernel.org, zhizhouzh@gmail.com
Subject: Re: [PATCH] ftrace: remove KASAN poison in ftrace_ops_test()
Date: Sun, 11 Nov 2018 17:32:12 +0000	[thread overview]
Message-ID: <20181111173211.q2gzf7h4htxbezch@salmiak> (raw)
In-Reply-To: <1541949017-3001-1-git-send-email-zhizhouzhang@asrmicro.com>

On Sun, Nov 11, 2018 at 11:10:17PM +0800, Zhizhou Zhang wrote:
> ftrace_ops_test() passed local varible parameter to hash_contains_ip(),
> which could result KASAN stack-out-of-bounds warning.
> 
> Signed-off-by: Zhizhou Zhang <zhizhouzhang@asrmicro.com>
> ---
>  kernel/trace/ftrace.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
> index f536f60..6e11f90 100644
> --- a/kernel/trace/ftrace.c
> +++ b/kernel/trace/ftrace.c
> @@ -1522,6 +1522,8 @@ ftrace_ops_test(struct ftrace_ops *ops, unsigned long ip, void *regs)
>  	rcu_assign_pointer(hash.filter_hash, ops->func_hash->filter_hash);
>  	rcu_assign_pointer(hash.notrace_hash, ops->func_hash->notrace_hash);
>  
> +	kasan_unpoison_task_stack(current);

This is extremely heavy-handed, and will mask legitimate stack-out-of-bounds
errors. 

Passing a stack-local variable by reference *should not* result in KASAN
warnings unless KASAN itself is broken. Can you please give an example report
when this occurs?

Which compiler are you using?

Thanks,
Mark.

> +
>  	if (hash_contains_ip(ip, &hash))
>  		ret = 1;
>  	else
> -- 
> 2.7.4
> 

  reply	other threads:[~2018-11-11 17:32 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-11 15:10 Zhizhou Zhang
2018-11-11 17:32 ` Mark Rutland [this message]
2018-11-12  8:09   ` Zhang Zhizhou(张治洲)
2018-11-13 17:47     ` Mark Rutland
2018-11-14 10:33       ` Zhang Zhizhou(张治洲)

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=20181111173211.q2gzf7h4htxbezch@salmiak \
    --to=mark.rutland@arm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=rostedt@goodmis.org \
    --cc=zhizhouzh@gmail.com \
    --cc=zhizhouzhang@asrmicro.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®