lkml.org 
[lkml]   [2021]   [Apr]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] kernel: initialize cpumask before parsing
On Thu,  1 Apr 2021 14:58:23 +0900
Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp> wrote:

> KMSAN complains that new_value at cpumask_parse_user() from
> write_irq_affinity() from irq_affinity_proc_write() is uninitialized.
>
> [ 148.133411][ T5509] =====================================================
> [ 148.135383][ T5509] BUG: KMSAN: uninit-value in find_next_bit+0x325/0x340
> [ 148.137819][ T5509]
> [ 148.138448][ T5509] Local variable ----new_value.i@irq_affinity_proc_write created at:
> [ 148.140768][ T5509] irq_affinity_proc_write+0xc3/0x3d0
> [ 148.142298][ T5509] irq_affinity_proc_write+0xc3/0x3d0
> [ 148.143823][ T5509] =====================================================
>
> Since bitmap_parse() from cpumask_parse_user() calls find_next_bit(),
> any alloc_cpumask_var() + cpumask_parse_user() sequence has possibility
> that find_next_bit() accesses uninitialized cpu mask variable. Fix this
> problem by replacing alloc_cpumask_var() with zalloc_cpumask_var().
>
> Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
> ---
> kernel/irq/proc.c | 4 ++--
> kernel/profile.c | 2 +-


> kernel/trace/trace.c | 2 +-

Acked-by: Steven Rostedt (VMware) <rostedt@goodmis.org>

-- Steve

\
 
 \ /
  Last update: 2021-04-01 21:10    [W:1.917 / U:0.020 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site