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 B2CC427E054 for ; Mon, 2 Feb 2026 08:29:46 +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=1770020989; cv=none; b=oA9dtznM0j22n75wQxQVEc21b3+tubRHtlsN2nEnQMeqFuYhFNuepl/leA5HirWL6SYNXakwwbOywD4F3jUDKMf7FASQq+cXhXZ+9vk7hmNWNnxxm59m37NXQKGkWzb8DMXV1QlzCvY3boOugFqe/Zi0G2swoRRW96luzKC8po0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770020989; c=relaxed/simple; bh=lR55srkfj2RDtCD3fX+PDppP98V7dM3NHodpbD+gjio=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=k3ENkksyinWrUI3wpdNpDJpib9UNnzPdZXW8W6RtI5UljoQp3KySrvFx+6lqSd43g+GvxIkIDLmBrvrmj4M84cggO+91fYGdIsI4dQ9PVsnEJuyjaiaMm/fJCY/hTMqkJMd3z2j+hH2NYBb7VJuclH1j5TcBdpzahz03c5oGLws= 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=eGHwOsR2; 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="eGHwOsR2" 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=X6jxUQ5MWmjy1uG+y28s0y/lKAgy1VH6GPbh2m+cy6w=; b=eGHwOsR2/pFCVC6hV3nXOGfkD8 qA/pVyYg2I6/jQP5pzJbWM/b2YZyFYz1nW338IAVSSDOCU9E97NAv2L3PgMjepKmZwWa1lr8EaS4d NIWVTKTIrWpL62K0r1kBNujmUauvoGEEErop0x7P5cPkfM+VQqir+94bVeZigZci6Ga3pX6A7ob4s qXSkrPg6FchJKNg8OZor90+qjPOZgzWGzgqdkK5LGrQO50JBt8kZ7SZsmGR3hSdSN3Won6kv6I1oi xbICXQ3Ct+uJFkbXvvK6YH0fcUAAicYk0QjjlIU2Kib1v4YEwReIPIx8OJMxJD7M5y2qoYyx5JzEA U0MfTdbA==; Received: from 77-249-17-252.cable.dynamic.v4.ziggo.nl ([77.249.17.252] helo=noisy.programming.kicks-ass.net) by casper.infradead.org with esmtpsa (Exim 4.98.2 #2 (Red Hat Linux)) id 1vmpJU-0000000GDO8-1VOP; Mon, 02 Feb 2026 08:29:40 +0000 Received: by noisy.programming.kicks-ass.net (Postfix, from userid 1000) id AD76D3021A4; Mon, 02 Feb 2026 09:29:39 +0100 (CET) Date: Mon, 2 Feb 2026 09:29:39 +0100 From: Peter Zijlstra To: Kees Cook 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: <20260202082939.GB1282955@noisy.programming.kicks-ass.net> References: <20260129110733.GA166857@noisy.programming.kicks-ass.net> <20260201114741.GA3016024@noisy.programming.kicks-ass.net> <202602011935.9E968135@keescook> 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: <202602011935.9E968135@keescook> On Sun, Feb 01, 2026 at 07:39:46PM -0800, Kees Cook wrote: > 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* *sigh* indeed. > But yes, now that we have the "transitional" kconfig symbols I can > trivially rename CONFIG_UBSAN_BOUNDS and remove its CONFIG_UBSAN > dependency. That would be great; I can sit on this patch a while, its mostly build robots and the like occasionally tripping this. It would be good to have the compiler folks agree that bounds checking is production code though :-) > > 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). I'm not sure which one (I didn't care to find out, its debug nonsense and nobody cares etc.. :-). One has: CONFIG_ARCH_HAS_UBSAN=y CONFIG_UBSAN=y CONFIG_UBSAN_TRAP=y CONFIG_CC_HAS_UBSAN_BOUNDS_STRICT=y # CONFIG_UBSAN_BOUNDS is not set # CONFIG_UBSAN_SHIFT is not set CONFIG_UBSAN_DIV_ZERO=y CONFIG_UBSAN_BOOL=y CONFIG_UBSAN_ENUM=y The other has: CONFIG_ARCH_HAS_UBSAN=y CONFIG_UBSAN=y # CONFIG_UBSAN_TRAP is not set CONFIG_CC_HAS_UBSAN_BOUNDS_STRICT=y # CONFIG_UBSAN_BOUNDS is not set CONFIG_UBSAN_SHIFT=y CONFIG_UBSAN_DIV_ZERO=y # CONFIG_UBSAN_UNREACHABLE is not set CONFIG_UBSAN_BOOL=y # CONFIG_UBSAN_ENUM is not set CONFIG_UBSAN_ALIGNMENT=y The common ones are DIV_ZERO and BOOL.