From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-qt1-f170.google.com (mail-qt1-f170.google.com [209.85.160.170]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 98BB021ADC7 for ; Wed, 8 Apr 2026 15:10:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.170 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775661024; cv=none; b=JpzqfdJjWEKDIBcLe77TJDvCPS7f6EmwkRPB7vL1UtjHumeI1/DG9eXDRccxb8vtnO9DmW6NxT5jqsGKcO1L1eGGKwtwjKoOKLKBYeQ2j6D3VL2h8YYkOb9pXJj3Bg8p3DNITRjOtdKiTrRzxtMEMJVsCM/DcNxyokn8lVWicps= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775661024; c=relaxed/simple; bh=ERjDbvW+sWCXmZpp13rJqqWJoTBeVxyVbZvjjpViTd8=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=twN2b8OTSkL9s2ICpjiyTc5+DPLsZJ+puRY0b+74BkmHlUs6283QOutp8w9X6QyXvOsPHTXP602Hh5WYo6sBPdbloOQ4DwcYXHaeQ1FP9CuzB0L2PQADM/NUWMgBsJ+OVuT4eVN8LTRWBrzk9agF+qbZJWbQeCnOgaiitRPXWYA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=cmpxchg.org; spf=pass smtp.mailfrom=cmpxchg.org; dkim=pass (2048-bit key) header.d=cmpxchg.org header.i=@cmpxchg.org header.b=U2ewj1p/; arc=none smtp.client-ip=209.85.160.170 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=cmpxchg.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=cmpxchg.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=cmpxchg.org header.i=@cmpxchg.org header.b="U2ewj1p/" Received: by mail-qt1-f170.google.com with SMTP id d75a77b69052e-50b392f1846so88653861cf.3 for ; Wed, 08 Apr 2026 08:10:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cmpxchg.org; s=google; t=1775661021; x=1776265821; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=ERjDbvW+sWCXmZpp13rJqqWJoTBeVxyVbZvjjpViTd8=; b=U2ewj1p//Y3XnhBTdKhc2HQCdeG0QPzfrjpraPTho4Zh3mjp4LqvOhDf9by7VrdsNY AW5AhXAzdDsiZDhx5EbCe2aWoLqaQH9RPW337cmwgsnRtU8O7NA3ds2XMjHXguOr33dN PuDFZXgt60r4U9/nZHNtz/+hxvCE6+jZpMJg6OWXmdEX1S2qzMYHQfBOpKKeypuIjF7m aZgFrAd2Ma5WKHtbmdw9/ZEgHPwCQga5v84PYM/L7sqxCIjmCIWbcBYn6N19OntuNU1e yLrZwVW20Ftf96wP6fRj9V6eojik7mZuRCSDC3Nds74TIc2DsuwDPQBcABT2XH9rSRbA gr8Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1775661021; x=1776265821; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-gg:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ERjDbvW+sWCXmZpp13rJqqWJoTBeVxyVbZvjjpViTd8=; b=eP5NHc6i4MC1yaBJKoIPhC/MD87erZrcJJ/9mn5ERZ6/XoEfYLOIGhX5aPaHKjptuP XjFo4Yn5hvrOq/MF7RXr6OaOnHNIMg6YtrVaHnu0Ln+k+Q4AY2Fm9QCEzJKQOg2n0aI5 ZfKotvnCE95rphx145crXcJTlqOkvg0xLIPKIoZFErVslhtTKRa0PjVdytX7sLFoFsTk 2RInAOH4/+hhq+33zzA88zy4j2VXLdIVd83IRbcHvSNhWyHgH1d/sBZhOArwnCcPL8dV mmXzpPWoJsrrYrfv8j8XCokbqY5OpJZVc577pWVbISsILA/3VZDYOQpYqgRa6n7luWQm cdXA== X-Forwarded-Encrypted: i=1; AJvYcCX1IDeh+i4w5xc0q9LncjDI9ta8KWUa94rwSYwUshpcf56ttX3/QgK/UDB7qb8w1dQ7PhItT8LRhg1hUto=@vger.kernel.org X-Gm-Message-State: AOJu0Yz/L5rxL7RYkAXSHGW/dkc2DsfKAuBcDh3V3igRnT6lUm1UjIZD q5jakVKuwnYEJeG1ddlwOTKgdC1Y6B4SKOELqreoAf9d5ceqZ+6DZrdXFeOb/0G/W3Y= X-Gm-Gg: AeBDiesJ5giS+qn5TFHPjnyWqwsjeElDviU61+jxnvCW4mSl5THWogGTlOMSsPlPK5d vTn4uzZgvPuhxAw0QIf6W3oKxLtzU05FRzTJZeKLexIGqv7lQRHZRke5JspfbJta3hbMCTLVVOk 2YKgHM8MxfkXZpH6dYqm+m8ui4U2mYwk30aIWrU6at5xcEKhPcZuXOB9WXKmonSsU70Mb/RCUue yDe7SETHR8K9Vj4PQZdz6SAdV36mJMMUpuBZbx0bI3E6cfwTBIzUIKXQCZ/r2Zuk9kOWy9WsB65 A18IOvW/vpS+to+27q1mezFfQum1ClD1jCV7ADynI4oiRcRFQBSxe/aSiSkXzAgZOfJPa4IJBev dYZfY7xZqbACx+bHRMLV9ML558PHUjwm0FbqSHaoCcrig8EzzZ6qhMefffslwitwewd/5vVmPmp IELEGysUoU8uA1X64ZJYfM8AiKNYz4HIdK X-Received: by 2002:a05:622a:2608:b0:50d:a2f5:24a7 with SMTP id d75a77b69052e-50da2f52639mr100268361cf.45.1775661020615; Wed, 08 Apr 2026 08:10:20 -0700 (PDT) Received: from localhost ([2603:7000:c00:3a00:365a:60ff:fe62:ff29]) by smtp.gmail.com with ESMTPSA id d75a77b69052e-50d4b93dd10sm163186171cf.7.2026.04.08.08.10.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Apr 2026 08:10:19 -0700 (PDT) Date: Wed, 8 Apr 2026 11:10:15 -0400 From: Johannes Weiner To: Mashiro Chen Cc: surenb@google.com, peterz@infradead.org, mingo@redhat.com, juri.lelli@redhat.com, vincent.guittot@linaro.org, dietmar.eggemann@arm.com, rostedt@goodmis.org, bsegall@google.com, mgorman@suse.de, vschneid@redhat.com, akpm@linux-foundation.org, linux-kernel@vger.kernel.org, syzbot+4b1bd55fba6260160779@syzkaller.appspotmail.com Subject: Re: [PATCH] sched/psi: initialize *flags in psi_memstall_enter when PSI is disabled Message-ID: References: <20260405055044.554243-1-mashiro.chen@mailbox.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20260405055044.554243-1-mashiro.chen@mailbox.org> On Sun, Apr 05, 2026 at 01:50:44PM +0800, Mashiro Chen wrote: > When PSI is disabled, psi_memstall_enter() returns early without > writing to *flags, leaving the caller's local variable uninitialized. > psi_memstall_leave() also returns early when PSI is disabled and does > not read *flags, so the uninitialized value is never used functionally. > > However, KMSAN tracks the shadow and origin metadata per physical > address. When a kernel stack page is subsequently reused, a new object > at the same address inherits the stale KMSAN shadow from the old > uninitialized pflags, causing spurious uninit-value reports in > unrelated code paths such as __flush_smp_call_function_queue(). > > Initialize *flags to 0 in the psi_disabled early-return path to > prevent the stale shadow from escaping the callers' stack frames. How is this not a kmsan bug? I don't think putting an unexpected init into unrelated code with no comment is an appropriate fix for what seems like a false positive in this tool.