From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.2 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_2 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id F3C46C4360C for ; Thu, 1 Apr 2021 18:45:13 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D66976100A for ; Thu, 1 Apr 2021 18:45:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238890AbhDASpD (ORCPT ); Thu, 1 Apr 2021 14:45:03 -0400 Received: from mail.kernel.org ([198.145.29.99]:51642 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237298AbhDASW7 (ORCPT ); Thu, 1 Apr 2021 14:22:59 -0400 Received: from gandalf.local.home (cpe-66-24-58-225.stny.res.rr.com [66.24.58.225]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 57DCD6124B; Thu, 1 Apr 2021 13:34:45 +0000 (UTC) Date: Thu, 1 Apr 2021 09:34:43 -0400 From: Steven Rostedt To: Tetsuo Handa Cc: Thomas Gleixner , Ingo Molnar , linux-kernel@vger.kernel.org Subject: Re: [PATCH] kernel: initialize cpumask before parsing Message-ID: <20210401093443.019b57d2@gandalf.local.home> In-Reply-To: <20210401055823.3929-1-penguin-kernel@I-love.SAKURA.ne.jp> References: <20210401055823.3929-1-penguin-kernel@I-love.SAKURA.ne.jp> X-Mailer: Claws Mail 3.17.8 (GTK+ 2.24.33; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 1 Apr 2021 14:58:23 +0900 Tetsuo Handa 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 > --- > kernel/irq/proc.c | 4 ++-- > kernel/profile.c | 2 +- > kernel/trace/trace.c | 2 +- Acked-by: Steven Rostedt (VMware) -- Steve