From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pj1-f52.google.com (mail-pj1-f52.google.com [209.85.216.52]) (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 6D790230270 for ; Wed, 12 Nov 2025 02:14:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.52 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762913676; cv=none; b=NGjevUM2ehqACgk8lztr8/DrUyjORvg4hqTAflz0/d8LDeaa3u5x3/Pr/BgvIYC7WHL4WJbctUN6EzS8fVpv9lg3j4lcXQFTmOCQXLbAKidOQUCSr/+yeeEhEpWTwjiGX37gQpj72x6UVYkvg8U2Rsgll49fK4z5QCDUI1+0lIc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762913676; c=relaxed/simple; bh=xwFVvgtw9uBd2ORKsLl6UhYsiyXLrRfI/zUbkQg0RWk=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=M/Lp7zUJlLazX3LLYMW+JWfpGPd+a90tcdISKQ+l2vo7DHWeoWytXQalOFkERpw/i+xpH72oIfTjVe/YSNcxrHEJXpaG4caO+STC/gUB79B1eVTdexRE0hdn2C3Usqmz7Xi9QtfQHFCt0iBOclAwtlVwL2xc4B/n2I3avmH2gnk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=fuauiSLE; arc=none smtp.client-ip=209.85.216.52 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="fuauiSLE" Received: by mail-pj1-f52.google.com with SMTP id 98e67ed59e1d1-343774bd9b4so286502a91.2 for ; Tue, 11 Nov 2025 18:14:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1762913674; x=1763518474; darn=vger.kernel.org; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:from:to :cc:subject:date:message-id:reply-to; bh=lVQBcx6xFjlJyhg8EGvnzlqkKD9tleq1IsOwgdEnnOg=; b=fuauiSLEBn9GiFcz5fEHg//fVQUy7nVf9NOyhSGqdw78w0KZF7cXP23cqhWiWVs2IH 1M7qQ8Q8T0l758X2shuAsdXj7hHQ2xbwdsr7Rikwu0cEAPJQU+ku9XyT86rA/2U8JqAW 6sS/u+ePsgpCAZS5Z8lbkgAwyfxIaXOKE6egbPGrWjzZbOcZdnKTR+nC9fcc2UwNdVs4 m2jzFR9MPNnWRXsT9+ijW44d5VH7NfM9awbEWhyL6r/NFuJBFLvUnRcw7bMLOSxTwaEF rLDu9Ld+y6vZSR5p38zvNUqiNs3vSQlasopGQVnq/AVn7AFRXoFzszxPTXaGj5hipLuN VwGw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1762913674; x=1763518474; h=in-reply-to:content-transfer-encoding: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=lVQBcx6xFjlJyhg8EGvnzlqkKD9tleq1IsOwgdEnnOg=; b=Zi2AJK4JLjb9DL90r8NtTU+cCDM3/EPbCUXDXniWpqEubdZ9IN2xXUFQc5F0pV6i0R 5hNJytvXh2JRH3uZYmLonzbfvFIX7WOQykl/bZbcFkGDqmS8YBFOqlSU0Cbn2NHJ5oUf 7530fn1l26nMxLyuX0CM9tzMPN+WDeG2MsxUnXI3L8FLXZt2+w6opi8GIPoYN/6+yyo7 TL4qzlKYIKSRaIVoNjBx0S+kBjxSO+/Fyt7yYtrseOJ5FG/R0id4SCL3soLYzj5FUGxd 05d2ggIKBtQECgNOYRZVVBjr/D98VmCWpDfXeVBipUb5aUYnmm3Suzl/HNfafAVU63VP UhqA== X-Forwarded-Encrypted: i=1; AJvYcCVU2ZxOOeoLmmO99UAp+zNKjQb7AfrkVMJAuQYo3RBzSLsyeiZMG4RrM5BED4OLTk/Zf3gPfFPom08=@vger.kernel.org X-Gm-Message-State: AOJu0YwrWAsIIDVeU3immlC/TVrUvYc56jWf1VO0HAvJIY/h8i8ewv5K R2grS+Q1Ke/swjv6+YEOXERaaQsctjiMG6s+//2s8q/pzrPhST8ZunVb X-Gm-Gg: ASbGncuy01fUiD+pvf0eT2VFw3x026SmVRXQwzaWGiqV6KU+bd59QScg2FuwxrIQYBt 9l7omHU+Ek1eC96+jEH8xK54aUeKk5i7LGHCb2oDSaYvOKHs4Eq9YxYx12seaIAg+rFLjVSLOAL 6x/eq8GxuMswsAn5bOXXj9v+Sqv7xVG358COK7eNi7koM86qX/a0vcqMISjjldDI3Y+rwZd0RNW MHkkD+LhAOF0j+0Ydr9dtbAQ5VGvzsZ9H+q55G5BnJJn/x7mQlKe1wJOrcaNh3OiiNMU24icWjQ uq/riVu8OyGtX9Nsq2fMLJcuGXi5sMM8wgw/Dz8Y+lO68E3O4SU+2aS6HO9HWubgWgYd7GYrPj4 jpGCBacOvHfTocpL3AZg0NH/Gc2vHUVWZ9GlTGMKFMu2270P3yRtSGd8BqVv/0atDXkgv/IQLJh L+vCaDOopXhvA= X-Google-Smtp-Source: AGHT+IFqj6mSlRUdzokZ1Fx9dnl2ksqvuqBqsXipooXRvbblexf8W6duI6LZnIuMeBzrfzf2MAr1ZQ== X-Received: by 2002:a17:90b:1b0c:b0:340:a5b2:c30b with SMTP id 98e67ed59e1d1-343dddf6caemr2117777a91.9.1762913673519; Tue, 11 Nov 2025 18:14:33 -0800 (PST) Received: from localhost ([45.8.220.62]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-343e0714267sm559591a91.6.2025.11.11.18.14.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 Nov 2025 18:14:32 -0800 (PST) Date: Wed, 12 Nov 2025 10:14:29 +0800 From: Jinchao Wang To: Matthew Wilcox Cc: Andrew Morton , "Masami Hiramatsu (Google)" , Peter Zijlstra , Randy Dunlap , Marco Elver , Mike Rapoport , Alexander Potapenko , Adrian Hunter , Alexander Shishkin , Alice Ryhl , Andrey Konovalov , Andrey Ryabinin , Andrii Nakryiko , Ard Biesheuvel , Arnaldo Carvalho de Melo , Ben Segall , Bill Wendling , Borislav Petkov , Catalin Marinas , Dave Hansen , David Hildenbrand , David Kaplan , "David S. Miller" , Dietmar Eggemann , Dmitry Vyukov , "H. Peter Anvin" , Ian Rogers , Ingo Molnar , James Clark , Jinjie Ruan , Jiri Olsa , Jonathan Corbet , Juri Lelli , Justin Stitt , kasan-dev@googlegroups.com, Kees Cook , "Liam R. Howlett" , Liang Kan , Linus Walleij , linux-arm-kernel@lists.infradead.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-perf-users@vger.kernel.org, linux-trace-kernel@vger.kernel.org, llvm@lists.linux.dev, Lorenzo Stoakes , Mark Rutland , Masahiro Yamada , Mathieu Desnoyers , Mel Gorman , Michal Hocko , Miguel Ojeda , Nam Cao , Namhyung Kim , Nathan Chancellor , Naveen N Rao , Nick Desaulniers , Rong Xu , Sami Tolvanen , Steven Rostedt , Suren Baghdasaryan , Thomas Gleixner , Thomas =?iso-8859-1?Q?Wei=DFschuh?= , Valentin Schneider , Vincent Guittot , Vincenzo Frascino , Vlastimil Babka , Will Deacon , workflows@vger.kernel.org, x86@kernel.org Subject: Re: [PATCH v8 00/27] mm/ksw: Introduce KStackWatch debugging tool Message-ID: References: <20251110163634.3686676-1-wangjinchao600@gmail.com> Precedence: bulk X-Mailing-List: linux-doc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: On Mon, Nov 10, 2025 at 05:33:22PM +0000, Matthew Wilcox wrote: > On Tue, Nov 11, 2025 at 12:35:55AM +0800, Jinchao Wang wrote: > > Earlier this year, I debugged a stack corruption panic that revealed the > > limitations of existing debugging tools. The bug persisted for 739 days > > before being fixed (CVE-2025-22036), and my reproduction scenario > > differed from the CVE report—highlighting how unpredictably these bugs > > manifest. > > Well, this demonstrates the dangers of keeping this problem siloed > within your own exfat group. The fix made in 1bb7ff4204b6 is wrong! > It was fixed properly in 7375f22495e7 which lists its Fixes: as > Linux-2.6.12-rc2, but that's simply the beginning of git history. > It's actually been there since v2.4.6.4 where it's documented as simply: > > - some subtle fs/buffer.c race conditions (Andrew Morton, me) > > As far as I can tell the changes made in 1bb7ff4204b6 should be > reverted. Thank you for the correction and the detailed history. I wasn't aware this dated back to v2.4.6.4. I'm not part of the exfat group; I simply encountered a bug that 1bb7ff4204b6 happened to resolve in my scenario. The timeline actually illustrates the exact problem KStackWatch addresses: a bug introduced in 2001, partially addressed in 2025, then properly fixed months later. The 24-year gap suggests these silent stack corruptions are extremely difficult to locate. > > > Initially, I enabled KASAN, but the bug did not reproduce. Reviewing the > > code in __blk_flush_plug(), I found it difficult to trace all logic > > paths due to indirect function calls through function pointers. > > So why is the solution here not simply to fix KASAN instead of this > giant patch series? KASAN caught 7375f22495e7 because put_bh() accessed bh->b_count after wait_on_buffer() of another thread returned—the stack was invalid. In 1bb7ff4204b6 and my case, corruption occurred before the victim function of another thread returned. The stack remained valid to KASAN, so no warning triggered. This is timing-dependent, not a KASAN deficiency. Making KASAN treat parts of active stack frame as invalid would be complex and add significant overhead, likely worsening the reproduction prevention issue. KASAN's overhead already prevented reproduction in my environment. KStackWatch takes a different approach: it watches stack frame regardless of whether KASAN considers them valid or invalid, with much less overhead thereby preserving reproduction scenarios. The value proposition: Finding where corruption occurs is the bottleneck. Once located, subsystem experts can analyze the root cause. Without that location, even experts are stuck. If KStackWatch had existed earlier, this 24-year-old bug might have been found sooner when someone hit a similar corruption. The same applies to other stack corruption bugs. I'd appreciate your thoughts on whether this addresses your concerns. Best regards, Jinchao