From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B627B3A1DB for ; Mon, 16 Mar 2026 11:52:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=90.155.50.34 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773661927; cv=none; b=RDi8c3tFC6XwPSfKAcsQVA5Kt3WmGqLJcqDoySOB9oYIdRS9wTGz0al5qVqo+PysLn4KCJ2wOv6/ulXKu/3MdUl6G6j25Tl/io7e8oxjVD1EFVY+/FW9dl7y2pCiY0HfLalKwT765t2DjvjhQy7Q2xDK12oO/ZfWDyJ2/FPc3qA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773661927; c=relaxed/simple; bh=Bj682YI22ozCvkXEzjOh0XcRAvoMmb7x3bJEbXLAO9I=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=kifYSax/BCm1gMni9BlG12eKWuDQsTh6fQen2J0AVtUwihp0OROe3kSWo6XYll2AAfGhPwzMAU50b55hyurGScHjnUB3Qx4FPV0RgoRrKrR8zbuSFLvgRlmALtyw7LMDMcakJVbPHFalEi22f6XuDexkz4mEepPX3JCXnZD+H30= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=infradead.org; spf=none smtp.mailfrom=infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=Ak+MRGAR; arc=none smtp.client-ip=90.155.50.34 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=infradead.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=infradead.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="Ak+MRGAR" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=8pu5qj8y5u/cnJXbGxld9qH2FQdKZcHIGp5s2VlRU28=; b=Ak+MRGAR4tuFyQT7rP6PvqhTOC t5kCQZvfiGUx3lB42w0SlzEc3XxJpqPofiW3tiAD7c02wz5s+P3XqQ41oGQkTPLjAiaMhkq0tVsEO kPCGOGQblTXJ5NaCzSQKL5r3nv5JPoInslCaYcpeken2/LYx3/3/7PEUzLptMCZCiIXbWjLEJ8CyQ dnVcwW5sKeYK99DkeRltK4lS8D/qGFyy7+wPh07cP2Kk2pH3jtBZ86SK31shlospTT4RF2IkEVfLO yrohhEK29ZN3zd2lcMhR6oLenYC/MxGzXDZFb1krz/KVGicwghnp2aXGogjdulrsPXZrebO/kL8RL vsXFVRvg==; Received: from 2001-1c00-8d85-5700-266e-96ff-fe07-7dcc.cable.dynamic.v6.ziggo.nl ([2001:1c00:8d85:5700:266e:96ff:fe07:7dcc] helo=noisy.programming.kicks-ass.net) by casper.infradead.org with esmtpsa (Exim 4.98.2 #2 (Red Hat Linux)) id 1w26UI-00000000vEZ-08em; Mon, 16 Mar 2026 11:51:58 +0000 Received: by noisy.programming.kicks-ass.net (Postfix, from userid 1000) id 1C3FC301BD5; Mon, 16 Mar 2026 12:51:56 +0100 (CET) Date: Mon, 16 Mar 2026 12:51:55 +0100 From: Peter Zijlstra To: Andrei Vagin Cc: "Matthew Wilcox (Oracle)" , Ingo Molnar , Will Deacon , Boqun Feng , Waiman Long , linux-kernel@vger.kernel.org, syzbot+3d2ff92c67127d337463@syzkaller.appspotmail.com Subject: Re: [PATCH] locking/rwsem: Fix logic error in rwsem_del_waiter() Message-ID: <20260316115155.GA3738010@noisy.programming.kicks-ass.net> References: <20260314182607.3343346-1-avagin@google.com> 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: <20260314182607.3343346-1-avagin@google.com> On Sat, Mar 14, 2026 at 06:26:07PM +0000, Andrei Vagin wrote: > Commit 1ea4b473504b ("locking/rwsem: Remove the list_head from struct > rw_semaphore") introduced a logic error in rwsem_del_waiter(). > > The root cause of this issue is an inconsistency in the return values of > __rwsem_del_waiter() and rwsem_del_waiter(). Specifically, > __rwsem_del_waiter() returns true when the wait list becomes empty, > whereas rwsem_del_waiter() is supposed to return true if the wait list > is NOT empty. > > This caused a null pointer dereference in rwsem_mark_wake() because it > was being called when sem->first_waiter was NULL. > > Cc: Matthew Wilcox (Oracle) > Reported-by: syzbot+3d2ff92c67127d337463@syzkaller.appspotmail.com > Tested-by: syzbot+3d2ff92c67127d337463@syzkaller.appspotmail.com > Fixes: 1ea4b473504b ("locking/rwsem: Remove the list_head from struct rw_semaphore") > Signed-off-by: Andrei Vagin Bah, indeed. Thanks!