From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 D767424468C for ; Mon, 2 Feb 2026 03:39:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770003587; cv=none; b=D/YU2qKbe/eFTXBtZNPc9LrcLNqV9r2KhgoOZ7uzMeVbF+QVEif+qXMgTDHK9qpqvNvYjTqTjJIFjehyFseC7ab5PoPAJZ4meih6Wb1p4LmDBUGaDJ//ClRvfQ6nwi3m4kQ9mbbv9a12cNs14lLjoA7Zqz8W5JDekKnlgI5/xsM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770003587; c=relaxed/simple; bh=YappoTZa5gGm0CSreQxQ+UZ0n02sCpBEgW1gbaPoQ9o=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=GmPQsdc5qUHWaUzoAdaJCRTbG4VsTgtR7T6NBlzGYzRFh1jToBJdkUvISxKMYmiOydkbACxKrNF6upF6k8e9xWfVKM0zHYFIiClNPoTVC6Vqlgds1nu5n29P3NhxRJHOMVntof3XBaj5/mKIf8c21bBBolW9ZAIyrL7Iq3cYTQg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=GADg9fwG; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="GADg9fwG" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 14FFDC19421; Mon, 2 Feb 2026 03:39:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1770003587; bh=YappoTZa5gGm0CSreQxQ+UZ0n02sCpBEgW1gbaPoQ9o=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=GADg9fwGq0xOXpyCv2jajqETzSVZl/oS3NeuuRYEmz5HOXbQhdxCHe+/WNu533XPa x22efHyMBcfI5XV424Gcp3VFbWUUL/pMlEvB7WrMZiDextLo8NtMteBZFw7dSMoWZA tBmEKFXc7R1COqtd9V+N74e+UVJ+sb2dZwVOQHdgaVryNMQw+wskhzaXAGUJg0afTF 8l8i7jGtGPX1txxsEiOTB5nfB+d0WF1TI3yR2dY/eg5smyxpC3OD+b0NqMj22ZWsp9 ZweCT7HiKDDHJYpAYMwbSKOmJISFIyZ4gZkNbuzdmm2oJfDRZQQOXBA/zV9NnybHbk CtE8AKdavAkBA== Date: Sun, 1 Feb 2026 19:39:46 -0800 From: Kees Cook To: Peter Zijlstra Cc: Kees Cook , mingo@kernel.org, oleg@redhat.com, linux-kernel@vger.kernel.org, debian-kernel@lists.debian.org Subject: Re: [PATCH] seqlock: Allow UBSAN to fail optimizing Message-ID: <202602011935.9E968135@keescook> References: <20260129110733.GA166857@noisy.programming.kicks-ass.net> <20260201114741.GA3016024@noisy.programming.kicks-ass.net> 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: <20260201114741.GA3016024@noisy.programming.kicks-ass.net> On Sun, Feb 01, 2026 at 12:47:41PM +0100, Peter Zijlstra wrote: > On Sat, Jan 31, 2026 at 10:42:35AM -0800, Kees Cook wrote: > > On Sat, Jan 31, 2026 at 10:39:42AM +0100, Salvatore Bonaccorso wrote: > > > Kees, Peter approached the Debian kernel list above to drop > > > CONFIG_UBSAN again, which, so I think we need to revert your > > > 6cfadabfe015 ("Enable UBSAN_BOUNDS and UBSAN_SHIFT"): > > > https://salsa.debian.org/kernel-team/linux/-/commit/6cfadabfe015fa0d659fc8e3efd495cbcae3e44e > > > > > > I have make a MR for our packaging for the change in > > > https://salsa.debian.org/kernel-team/linux/-/merge_requests/1804 > > > > I am strongly opposed -- this undoes years of security flaw mitigation > > work and leaves Debian (and only Debian!) exposed to trivial array index > > overflows. The bounds sanitizer is the corner stone of memory safety > > for C, and is not some "experimental" feature. GCC has a long history > > of trouble with inlining, so this is not something unique to enabling > > this feature. > > > > I replied similarly to the PR. This would be a major mistake to disable. > > Why the heck is bounds checking part of UBSAN? The simple fix here is to > get it out from CONFIG_UBSAN, so that CONFIG_UBSAN is debug only crap. Out of bounds accesses are considered "undefined". *sigh* But yes, now that we have the "transitional" kconfig symbols I can trivially rename CONFIG_UBSAN_BOUNDS and remove its CONFIG_UBSAN dependency. > Notably, none of the UBSAN configs that tripped the optimization fail > even had bounds checking enabled. Which ones tripped it? KASAN (in software tagging mode) is usually the heavy-weight one that considerably bloats code generation. I haven't seen systemic problems with -fsanitize=bounds, and I thought the weird cases (which confused the value range tracking) with -fsanitize=shift got fixed back in GCC 12 (or maybe 13). -Kees -- Kees Cook