From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796249903; b=bNep4yzndiJHi66Ssx5gpX5E8tz2Ma0KC4PR6CzvxGTQV9bcYIfAxSfhdVCXq78jUZii N5RoT73EZYleFZvW1tbZjRFhEfJ738NyKulXV8kbD77+6arJ0WbTG852d+Wo+/K4KA5NB UPHZE2urJtwcU/qKrTzE6YQECiel8Sh8wcIEnrg0Wq6EWdzA1dXPMcxm/9/FSjk27Lu3I tvfdxiOgD30kvwNtCK9ocG4RRCmayeemuS/jfOdNfyFy/eb0N3lI8b8iY/69423On+adc sdxcFn6k3iTbYYx3WSCps5Vzv0oisTXJU6jC493ClGvpzg704Fj6n7sHulzCYB2IDZw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796249903; h=Received:DKIM-Signature:Date:From:To:Cc:Subject:Message-ID: References:MIME-Version:Content-Type:Content-Disposition:In-Reply-To; bh=plHii67ycQfwqbFrp3IJ7ODMvx8kmPF4ow/d4bGba/M=; b=iB9nhVaHM01LwgHTPl80B70mUSS4+s0e6NiUOPa9ORZd6Uv/2HwSca1efsXgGtYkrOsz r21blNtvD7VuCvWT+2ko48vukINdtSgA9l7jYnzqiQEWw8cMIyMgLvC+KJ8BfgGSpK85t hqSx3fTvtsCJ4V5ICmBqQ7RIlz0rHs95gkm60bIAqfqvBwpT3b60jt9MStc0ede+0KF0a Os3h+2zLRF5s+K+3PZpZyBr7nmLuG0x3dKIAZArBbZOuzc3vlDQvbpBbDNOUXUCwtugMa p489l0OH4dTfbR7I3cMJa/u77BOahN2JRub+y9Tq7SWcHFKx2pbBw3ffcwcuMU05FTg== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b="jySXU/19"; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 77A80606A32D; Wed, 2 Dec 2026 22:18:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=jySXU/19 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5FDB61F00893; Wed, 2 Dec 2026 22:18:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796249902; bh=plHii67ycQfwqbFrp3IJ7ODMvx8kmPF4ow/d4bGba/M=; h=Date:From:To:Cc:Subject:References:In-Reply-To; b=jySXU/19OgXZZNAKnrXZtmhC72y5IB7QyQwRBUngS1Hke1gFSM0ybQA9CueSpTsRq g8HMUWsWMXgPYZ5zb9PWf+eRt0gxXPHTvpFnkMdixW94NzjC2iRunIkXZHFyZqcgaG sjklrp4XIhRuuwPHBh4LDTO7G6m91J8FPWfefaZgqzoR6M+0ygcvV9Ur3OWTm0ZqBO fvJjXfKf7rWyuKyfyIIPfVaXnWXRIjp0r+acYAgEZu2m76Q4YcXf4zOq+1AHa4YCyS /5DyGYuMPkwCuseLlN/Po4iPLvGDw9kztmjJUHIF8LzWUSQbO/bawnr2pE2m8IWXBz eqfWyiLw21/Eg== Date: Wed, 2 Dec 2026 15:18:17 -0700 From: Nathan Chancellor To: Steven Rostedt Cc: Nick Desaulniers , Arnd Bergmann , Arnd Bergmann , Kees Cook , Bill Wendling , Justin Stitt , Andy Shevchenko , Randy Dunlap , Alexei Starovoitov , linux-kernel@vger.kernel.org, llvm@lists.linux.dev Subject: Re: [PATCH] seq_buf: avoid clang section mismatch from seq_buf_terminate optimization Message-ID: <20261202221817.GC2468262@ax162> References: <20261201090627.699022-1-arnd@kernel.org> <20261201101314.233335f6@gandalf.local.home> <23f85d0b-5d9e-4728-a969-5c083a1b33f2@app.fastmail.com> <20261201171753.575cd2ee@gandalf.local.home> X-Mailing-List: llvm@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20261201171753.575cd2ee@gandalf.local.home> On Tue, Dec 01, 2026 at 05:17:53PM -0500, Steven Rostedt wrote: > My question is, if this wasn't an inline to begin with and was just a > static function in that file, would it still warn? Yes, I believe so, at least with the example that you provide. > What exactly did the kernel do wrong? I would not say the kernel did anything wrong here but I would not say the compiler did either. I think this is merely a case where the kernel has assigned some additional meaning to these sections (".init.* is only available once then discarded") that the compiler is unaware of (so it cannot alter its behavior because this transformation is normally safe) and the kernel's post processing does/can not do CFG analysis to see that bootup_event_seq is only referred to in an init function. > If we had: > > static void seq_buf_set_overflow(struct seq_buf *s) I assume this should be seq_buf_terminate()? > { > if (s->len < s->size) > memset(s->buffer + s->len, 0, s->size - s->len); > > s->len = s->size + 1; > } > > static struct seq_buf bootup_event_seq __initdata = { > .buffer = bootup_event_buf, > .size = sizeof(bootup_event_buf), > }; > > static __init int event_trace_enable(void) > { > [..] > seq_buf_terminate(&bootup_event_seq); > [..] > } > > Is that a legitimate section mismatch? No, definitely not. > I'm OK if we take this patch to convert to always_inline, but I do not see > it as a kernel fix but simply a workaround to the section matching issue, > as it appears to be as side effect of optimizations and nothing more. Sure, I don't see this any different from inlining certain functions for noinstr and such. Sometimes you need to be explicit for the compiler to behave as expected and it is not really anyone's fault. -- Cheers, Nathan