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 86574202997 for ; Wed, 14 May 2025 12:14:53 +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=1747224893; cv=none; b=kRs1yyW+zQV09b4UxunfZH3aZXnWlLSeJZXqn5nWIc0neBt7XdHW5xPm0elU1XABFvrxsjWzFb+z6SFAl+CPn10ITQJPI5dQJ21QQzAuc+A3Kk8rWD2QivN9yGPhaqLlMylqNp/L0Ob2X7pvyjQr9+9EzBcB+qbEPC3OzYaa/m8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1747224893; c=relaxed/simple; bh=lJR7QQrbC267UDV3ESOh/4SlCvwzQFN79q/JQvjFUbs=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=byZSAegedmLzsmDKRUc+2gZuOR6AKrXgs0lYbx7hoTuH93wLQDjF8RDaWew92cVdg+Q+32J4VKTYffHgpeZPjX7QSIL6g5evowrEl9eGNMpvmfZL7kiJOGgiZZO/5gImDQNFk8IMHQBEcn8AVqA09sLLEJ+eIcSEKYVLimR7ytw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=yeZTEWd4; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="yeZTEWd4" Received: by smtp.kernel.org (Postfix) with ESMTPSA id A4FFBC4CEE9; Wed, 14 May 2025 12:14:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1747224893; bh=lJR7QQrbC267UDV3ESOh/4SlCvwzQFN79q/JQvjFUbs=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=yeZTEWd4V2W5Yb587FEqdGUyuzM8NWecYPKJspVVDtGgAUB8sl+pmBmgcNprEWz3A rrR1K5nF8JiPO2dHKlcIptYc7lIIoLSqYoOE2QlDHAmG7pf7NHlNHF86ICRGtdDJoD zUM/6fF/pvTvICASGwTkDhduAVh5b22vHPyXLbKM= Date: Wed, 14 May 2025 14:13:05 +0200 From: Greg KH To: Peter Zijlstra Cc: Holger =?iso-8859-1?Q?Hoffst=E4tte?= , "stable@vger.kernel.org" , Pawan Gupta Subject: Re: 6.14.7-rc1: undefined reference to `__x86_indirect_its_thunk_array' when CONFIG_CPU_MITIGATIONS is off Message-ID: <2025051429-strategic-stony-f476@gregkh> References: <0fd6d544-c045-4cf5-e5ab-86345121b76a@applied-asynchrony.com> <20250514113952.GB16434@noisy.programming.kicks-ass.net> Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20250514113952.GB16434@noisy.programming.kicks-ass.net> On Wed, May 14, 2025 at 01:39:52PM +0200, Peter Zijlstra wrote: > On Wed, May 14, 2025 at 12:13:29PM +0200, Holger Hoffstätte wrote: > > cc: peterz > > > > On 2025-05-14 09:45, Holger Hoffstätte wrote: > > > While trying to build 6.14.7-rc1 with CONFIG_CPU_MITIGATIONS unset: > > > > > >   LD      .tmp_vmlinux1 > > > ld: arch/x86/net/bpf_jit_comp.o: in function `emit_indirect_jump': > > > /tmp/linux-6.14.7/arch/x86/net/bpf_jit_comp.c:660:(.text+0x97e): undefined reference to `__x86_indirect_its_thunk_array' > > > make[2]: *** [scripts/Makefile.vmlinux:77: vmlinux] Error 1 > > > make[1]: *** [/tmp/linux-6.14.7/Makefile:1234: vmlinux] Error 2 > > > make: *** [Makefile:251: __sub-make] Error 2 > > > > > > - applying 9f35e33144ae aka "x86/its: Fix build errors when CONFIG_MODULES=n" > > > did not help > > > > > > - mainline at 9f35e33144ae does not have this problem (same config) > > > > > > Are we missing a commit in stable? > > > > It seems commit e52c1dc7455d ("x86/its: FineIBT-paranoid vs ITS") [1] > > is missing in the stable queue. It replaces the direct array reference > > in bpf_jit_comp.c:emit_indirect_jump() with a mostly-empty function stub > > when !CONFIG_MITIGATION_ITS, which is why mainline built and -stable > > does not. > > > > Unfortunately it does not seem to apply on top of 6.14.7-rc1 at all. > > Any good suggestions? > > > > thanks > > Holger > > > > [1] https://web.git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=e52c1dc7455d32c8a55f9949d300e5e87d011fa6 > > Right, this is forever the problem with these embargoed things that > side-step the normal development cycle and need to be backported to hell > :/ > > Let me go update this stable.git thing. > > /me twiddles thumbs for a bit, this is one fat tree it is.. > > Argh, I needed stable-rc.git > > more thumb twiddling ... > > simply picking the few hunks from that fineibt commit should do the > trick I think. > > /me stomps on it some ... voila! Not the prettiest thing, but definilty > good enough I suppose. Builds now, must be perfect etc.. :-) > > --- > > diff --git a/arch/x86/include/asm/alternative.h b/arch/x86/include/asm/alternative.h > index 47948ebbb409..f2294784babc 100644 > --- a/arch/x86/include/asm/alternative.h > +++ b/arch/x86/include/asm/alternative.h > @@ -6,6 +6,7 @@ > #include > #include > #include > +#include > > #define ALT_FLAGS_SHIFT 16 > > @@ -128,10 +129,17 @@ static __always_inline int x86_call_depth_emit_accounting(u8 **pprog, > extern void its_init_mod(struct module *mod); > extern void its_fini_mod(struct module *mod); > extern void its_free_mod(struct module *mod); > +extern u8 *its_static_thunk(int reg); > #else /* CONFIG_MITIGATION_ITS */ > static inline void its_init_mod(struct module *mod) { } > static inline void its_fini_mod(struct module *mod) { } > static inline void its_free_mod(struct module *mod) { } > +static inline u8 *its_static_thunk(int reg) > +{ > + WARN_ONCE(1, "ITS not compiled in"); > + > + return NULL; > +} > #endif > > #if defined(CONFIG_MITIGATION_RETHUNK) && defined(CONFIG_OBJTOOL) > diff --git a/arch/x86/kernel/alternative.c b/arch/x86/kernel/alternative.c > index 7a10e3ed5d0b..48fd04e90114 100644 > --- a/arch/x86/kernel/alternative.c > +++ b/arch/x86/kernel/alternative.c > @@ -240,6 +272,13 @@ static void *its_allocate_thunk(int reg) > return its_init_thunk(thunk, reg); > } > > +u8 *its_static_thunk(int reg) > +{ > + u8 *thunk = __x86_indirect_its_thunk_array[reg]; > + > + return thunk; > +} > + > #endif > > /* > diff --git a/arch/x86/net/bpf_jit_comp.c b/arch/x86/net/bpf_jit_comp.c > index a5b65c09910b..a31e58c6d89e 100644 > --- a/arch/x86/net/bpf_jit_comp.c > +++ b/arch/x86/net/bpf_jit_comp.c > @@ -663,7 +663,7 @@ static void emit_indirect_jump(u8 **pprog, int reg, u8 *ip) > > if (cpu_feature_enabled(X86_FEATURE_INDIRECT_THUNK_ITS)) { > OPTIMIZER_HIDE_VAR(reg); > - emit_jump(&prog, &__x86_indirect_its_thunk_array[reg], ip); > + emit_jump(&prog, its_static_thunk(reg), ip); > } else if (cpu_feature_enabled(X86_FEATURE_RETPOLINE_LFENCE)) { > EMIT_LFENCE(); > EMIT2(0xFF, 0xE0 + reg); > Thanks, I've taken this version now. I'm at a conference now and can't do build testing, so I'll push out a -rc2 and see how that goes... greg k-h