lkml.org 
[lkml]   [2018]   [Nov]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] ftrace: remove KASAN poison in ftrace_ops_test()
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
>

\
 
 \ /
  Last update: 2018-11-11 18:33    [W:0.048 / U:0.236 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site