[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210401093443.019b57d2@gandalf.local.home>
Date: Thu, 1 Apr 2021 09:34:43 -0400
From: Steven Rostedt <rostedt@...dmis.org>
To: Tetsuo Handa <penguin-kernel@...ove.SAKURA.ne.jp>
Cc: Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] kernel: initialize cpumask before parsing
On Thu, 1 Apr 2021 14:58:23 +0900
Tetsuo Handa <penguin-kernel@...ove.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@..._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@...ove.SAKURA.ne.jp>
> ---
> kernel/irq/proc.c | 4 ++--
> kernel/profile.c | 2 +-
> kernel/trace/trace.c | 2 +-
Acked-by: Steven Rostedt (VMware) <rostedt@...dmis.org>
-- Steve
Powered by blists - more mailing lists