mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Pawan Gupta <pawan.kumar.gupta@linux.intel.com>
To: Richard Narron <richard@aaazen.com>
Cc: Guenter Roeck <linux@roeck-us.net>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Linux stable <stable@vger.kernel.org>,
	Linux kernel <linux-kernel@vger.kernel.org>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	Dave Hansen <dave.hansen@linux.intel.com>
Subject: Re: [PATCH 5.15 00/59] 5.15.184-rc1 review
Date: Tue, 27 May 2025 17:55:20 -0700	[thread overview]
Message-ID: <20250528005520.dpip4qe45zvsn7vw@desk> (raw)
In-Reply-To: <67f03e41-245e-202-f0df-687cc4d9a915@aaazen.com>

On Tue, May 27, 2025 at 12:31:47PM -0700, Richard Narron wrote:
> On Fri, 23 May 2025, Guenter Roeck wrote:
> 
> > On 5/20/25 06:49, Greg Kroah-Hartman wrote:
> > > This is the start of the stable review cycle for the 5.15.184 release.
> > > There are 59 patches in this series, all will be posted as a response
> > > to this one.  If anyone has any issues with these being applied, please
> > > let me know.
> > >
> > > Responses should be made by Thu, 22 May 2025 12:57:37 +0000.
> > > Anything received after that time might be too late.
> > >
> >
> > Build reference: v5.15.184
> > Compiler version: x86_64-linux-gcc (GCC) 12.4.0
> > Assembler version: GNU assembler (GNU Binutils) 2.40
> >
> > Configuration file workarounds:
> >     "s/CONFIG_FRAME_WARN=.*/CONFIG_FRAME_WARN=0/"
> >
> > Building i386:defconfig ... passed
> > Building i386:allyesconfig ... failed
> > --------------
> > Error log:
> > x86_64-linux-ld: arch/x86/kernel/static_call.o: in function
> > `__static_call_transform':
> > static_call.c:(.ref.text+0x46): undefined reference to `cpu_wants_rethunk_at'
> > make[1]: [Makefile:1234: vmlinux] Error 1 (ignored)
> > --------------
> > Building i386:allmodconfig ... failed
> > --------------
> > Error log:
> > x86_64-linux-ld: arch/x86/kernel/static_call.o: in function
> > `__static_call_transform':
> > static_call.c:(.ref.text+0x46): undefined reference to `cpu_wants_rethunk_at'
> > make[1]: [Makefile:1234: vmlinux] Error 1 (ignored)
> > --------------
> >
> > In v5.15.y, cpu_wants_rethunk_at is only built if CONFIG_STACK_VALIDATION=y,
> > but that is not supported for i386 builds. The dummy function in
> > arch/x86/include/asm/alternative.h doesn't take that dependency into account.
> >
> 
> I found this bug too using the Slackware 15.0 32-bit kernel
> configuration.
> 
> Here is a simple work around patch, but there may be a better solution...
> 
> --- arch/x86/kernel/static_call.c.orig	2025-05-22 05:08:28.000000000 -0700
> +++ arch/x86/kernel/static_call.c	2025-05-27 10:25:27.630496538 -0700
> @@ -81,9 +81,12 @@
>  		break;
> 
>  	case RET:
> +
> +#ifdef CONFIG_64BIT
>  		if (cpu_wants_rethunk_at(insn))
>  			code = text_gen_insn(JMP32_INSN_OPCODE, insn, x86_return_thunk);
>  		else
> +#endif
>  			code = &retinsn;
>  		break;
> 

Another option is to define the empty function when CONFIG_STACK_VALIDATION=n as below:

--- 8< ---
From: Pawan Gupta <pawan.kumar.gupta@linux.intel.com>
Subject: [PATCH] x86/its: Fix undefined reference to cpu_wants_rethunk_at()

Below error was reported in 32-bit kernel build:

  static_call.c:(.ref.text+0x46): undefined reference to `cpu_wants_rethunk_at'
  make[1]: [Makefile:1234: vmlinux] Error

This is because the definition of cpu_wants_rethunk_at() depends on
CONFIG_STACK_VALIDATION which is only enabled in 64-bit mode.

Define the empty function when CONFIG_STACK_VALIDATION=n, rethunk mitigation
is anyways not supported without it.

Reported-by: Guenter Roeck <linux@roeck-us.net>
Link: https://lore.kernel.org/stable/0f597436-5da6-4319-b918-9f57bde5634a@roeck-us.net/
Signed-off-by: Pawan Gupta <pawan.kumar.gupta@linux.intel.com>
---
 arch/x86/include/asm/alternative.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/include/asm/alternative.h b/arch/x86/include/asm/alternative.h
index 1797f80c10de..a5f704dbb4a1 100644
--- a/arch/x86/include/asm/alternative.h
+++ b/arch/x86/include/asm/alternative.h
@@ -98,7 +98,7 @@ static inline u8 *its_static_thunk(int reg)
 }
 #endif
 
-#ifdef CONFIG_RETHUNK
+#if defined(CONFIG_RETHUNK) && defined(CONFIG_STACK_VALIDATION)
 extern bool cpu_wants_rethunk(void);
 extern bool cpu_wants_rethunk_at(void *addr);
 #else
-- 
2.34.1


  reply	other threads:[~2025-05-28  0:55 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-20 13:49 Greg Kroah-Hartman
2025-05-20 18:19 ` Florian Fainelli
2025-05-20 22:46 ` Shuah Khan
2025-05-21  1:53 ` Ron Economos
2025-05-21  3:16 ` Vijayendra Suman
2025-05-21  8:30 ` Jon Hunter
2025-05-21 12:39 ` Naresh Kamboju
2025-05-21 18:54 ` Mark Brown
2025-05-21 19:10 ` Alexandre Chartre
2025-05-21 21:25   ` Pawan Gupta
2025-05-22  5:09 ` Hardik Garg
2025-05-23  9:25 ` Guenter Roeck
2025-05-27 19:31   ` Richard Narron
2025-05-28  0:55     ` Pawan Gupta [this message]
2025-05-29  4:49       ` Richard Narron
2025-05-29 17:40         ` Pawan Gupta
2025-05-30  5:11           ` Greg Kroah-Hartman
2025-05-30  5:21             ` Pawan Gupta
2025-05-30  6:04             ` Pawan Gupta

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250528005520.dpip4qe45zvsn7vw@desk \
    --to=pawan.kumar.gupta@linux.intel.com \
    --cc=dave.hansen@linux.intel.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=richard@aaazen.com \
    --cc=stable@vger.kernel.org \
    --cc=torvalds@linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®