public inbox for stable@vger.kernel.org
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Pawan Gupta <pawan.kumar.gupta@linux.intel.com>
Cc: Natanael Copa <ncopa@alpinelinux.org>,
	Guenter Roeck <linux@roeck-us.net>,
	Harshit Mogalapalli <harshit.m.mogalapalli@oracle.com>,
	stable@vger.kernel.org, patches@lists.linux.dev,
	linux-kernel@vger.kernel.org, torvalds@linux-foundation.org,
	akpm@linux-foundation.org, shuah@kernel.org,
	patches@kernelci.org, lkft-triage@lists.linaro.org,
	pavel@denx.de, jonathanh@nvidia.com, f.fainelli@gmail.com,
	sudipm.mukherjee@gmail.com, srw@sladewatkins.net, rwarsow@gmx.de,
	conor@kernel.org, hargar@microsoft.com, broonie@kernel.org,
	Darren Kenny <darren.kenny@oracle.com>
Subject: Re: [PATCH 6.6 000/113] 6.6.91-rc2 review
Date: Mon, 19 May 2025 17:27:30 +0200	[thread overview]
Message-ID: <2025051931-hardy-had-44a3@gregkh> (raw)
In-Reply-To: <20250515152557.a4q2cqab4uvhnpia@desk>

On Thu, May 15, 2025 at 08:25:57AM -0700, Pawan Gupta wrote:
> On Thu, May 15, 2025 at 07:35:26AM +0200, Greg Kroah-Hartman wrote:
> > On Wed, May 14, 2025 at 01:49:06PM -0700, Guenter Roeck wrote:
> > > On 5/14/25 13:33, Harshit Mogalapalli wrote:
> > > > Hi Greg,
> > > > 
> > > > On 15/05/25 01:35, Greg Kroah-Hartman wrote:
> > > > > On Thu, May 15, 2025 at 12:29:40AM +0530, Harshit Mogalapalli wrote:
> > > > > > Hi Greg,
> > > > > > On 14/05/25 18:34, Greg Kroah-Hartman wrote:
> > > > > > > This is the start of the stable review cycle for the 6.6.91 release.
> > > > > > > There are 113 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 Fri, 16 May 2025 12:55:38 +0000.
> > > > > > > Anything received after that time might be too late.
> > > > > > 
> > > > > > ld: vmlinux.o: in function `patch_retpoline':
> > > > > > alternative.c:(.text+0x3b6f1): undefined reference to `module_alloc'
> > > > > > make[2]: *** [scripts/Makefile.vmlinux:37: vmlinux] Error 1
> > > > > > 
> > > > > > We see this build error in 6.6.91-rc2 tag.
> > > > > 
> > > > > What is odd about your .config?  Have a link to it?  I can't duplicate
> > > > > it here on my builds.
> > > > > 
> > > > 
> > > > So this is a config where CONFIG_MODULES is unset(!=y) -- with that we could reproduce it on defconfig + disabling CONFIG_MODULES as well.
> > > > 
> > > 
> > > Key is the combination of CONFIG_MODULES=n with CONFIG_MITIGATION_ITS=y.
> > 
> > Ah, this is due to the change in its_alloc() for 6.6.y and 6.1.y by the
> > call to module_alloc() instead of execmem_alloc() in the backport of
> > 872df34d7c51 ("x86/its: Use dynamic thunks for indirect branches").
> 
> Sorry for the trouble. I wish I had a test to catch problems like this. The
> standard config targets defconfig, allyesconfig, allnoconfig, etc. do not
> expose such issues. The only thing that comes close is randconfig.
> 
> CONFIG_MODULES=n is not a common setting, I wonder how people find such
> issues? (trying to figure out how to prevent such issues in future).
> 
> > Pawan, any hints on what should be done here instead?
> 
> Since dynamic thunks are not possible without CONFIG_MODULES, one option is
> to adjust the already in 6.6.91-rc2 patch 9f35e331144a (x86/its: Fix build
> errors when CONFIG_MODULES=n) to also bring the ITS thunk allocation under
> CONFIG_MODULES.
> 
> I am not seeing any issue with below build and boot test:
> 
>   #!/bin/bash -ex
> 
>   ./scripts/config --disable CONFIG_MODULES
>   ./scripts/config --disable CONFIG_MITIGATION_ITS
>   # https://github.com/arighi/virtme-ng
>   vng -b
>   vng -- lscpu
> 
>   # main test
>   ./scripts/config --disable CONFIG_MODULES
>   ./scripts/config --enable CONFIG_MITIGATION_ITS
>   vng -b
>   vng -- lscpu
> 
>   ./scripts/config --enable CONFIG_MODULES
>   ./scripts/config --disable CONFIG_MITIGATION_ITS
>   vng -b
>   vng -- lscpu
> 
>   ./scripts/config --enable CONFIG_MODULES
>   ./scripts/config --enable CONFIG_MITIGATION_ITS
>   vng -b
>   vng -- lscpu
> 
>   echo "PASS"
> 
> Similar change is required for 6.1 and 5.15 as well. 6.12 is fine because
> it uses execmem_alloc().
> 
> --- 8< ---
> From: Pawan Gupta <pawan.kumar.gupta@linux.intel.com>
> Subject: [PATCH 6.6] x86/its: Fix build errors when CONFIG_MODULES=n
> 
> From: Eric Biggers <ebiggers@google.com>
> 
> commit 9f35e33144ae5377d6a8de86dd3bd4d995c6ac65 upstream.
> 
> Fix several build errors when CONFIG_MODULES=n, including the following:
> 
> ../arch/x86/kernel/alternative.c:195:25: error: incomplete definition of type 'struct module'
>   195 |         for (int i = 0; i < mod->its_num_pages; i++) {
> 
>   [ pawan: backport: Bring ITS dynamic thunk code under CONFIG_MODULES ]
> 
> Fixes: 872df34d7c51 ("x86/its: Use dynamic thunks for indirect branches")
> Cc: stable@vger.kernel.org
> Signed-off-by: Eric Biggers <ebiggers@google.com>
> Acked-by: Dave Hansen <dave.hansen@intel.com>
> Tested-by: Steven Rostedt (Google) <rostedt@goodmis.org>
> Reviewed-by: Alexandre Chartre <alexandre.chartre@oracle.com>
> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> ---
>  arch/x86/kernel/alternative.c | 12 +++++++++++-
>  1 file changed, 11 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/x86/kernel/alternative.c b/arch/x86/kernel/alternative.c
> index 6085919d3b3e..c6d9a3882ec8 100644
> --- a/arch/x86/kernel/alternative.c
> +++ b/arch/x86/kernel/alternative.c
> @@ -129,6 +129,7 @@ const unsigned char * const x86_nops[ASM_NOP_MAX+1] =
>  
>  #ifdef CONFIG_MITIGATION_ITS
>  
> +#ifdef CONFIG_MODULES
>  static struct module *its_mod;
>  static void *its_page;
>  static unsigned int its_offset;
> @@ -244,7 +245,16 @@ static void *its_allocate_thunk(int reg)
>  	return thunk;
>  }
>  
> -#endif
> +#else /* CONFIG_MODULES */
> +
> +static void *its_allocate_thunk(int reg)
> +{
> +	return NULL;
> +}
> +
> +#endif /* CONFIG_MODULES */
> +
> +#endif /* CONFIG_MITIGATION_ITS */
>  
>  /*
>   * Fill the buffer with a single effective instruction of size @len.
> -- 
> 2.34.1
> 

This looks to still be causing problems, see these two reports of build
problems with the latest 6.1 and 6.6 releases with this commit in it:
	https://lore.kernel.org/r/20250519164717.18738b4e@ncopa-desktop
	https://lore.kernel.org/r/2f1ae598-0339-4e17-8156-03e8525a213d@roeck-us.net

thanks,

greg k-h

  parent reply	other threads:[~2025-05-19 15:27 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-14 13:04 [PATCH 6.6 000/113] 6.6.91-rc2 review Greg Kroah-Hartman
2025-05-14 15:34 ` Jon Hunter
2025-05-14 18:34 ` Pavel Machek
2025-05-14 18:59 ` Harshit Mogalapalli
2025-05-14 20:05   ` Greg Kroah-Hartman
2025-05-14 20:33     ` Harshit Mogalapalli
2025-05-14 20:49       ` Guenter Roeck
2025-05-15  5:35         ` Greg Kroah-Hartman
2025-05-15 15:25           ` Pawan Gupta
2025-05-15 15:29             ` Pawan Gupta
2025-05-16  8:03               ` Greg Kroah-Hartman
2025-05-16 20:42                 ` [PATCH 6.1] x86/its: Fix build errors when CONFIG_MODULES=n Pawan Gupta
2025-05-17  6:53                   ` Greg Kroah-Hartman
2025-05-17 13:07                   ` Sasha Levin
2025-05-19 15:27             ` Greg Kroah-Hartman [this message]
2025-05-19 19:50               ` [PATCH 6.6 000/113] 6.6.91-rc2 review Pawan Gupta
2025-05-19 20:43                 ` [PATCH 6.6] x86/its: Fix build error for its_static_thunk() Pawan Gupta
2025-05-20  7:52                   ` Sasha Levin
2025-05-20  8:48                   ` Greg Kroah-Hartman
2025-05-14 20:47     ` [PATCH 6.6 000/113] 6.6.91-rc2 review Guenter Roeck
2025-05-15  5:36       ` Greg Kroah-Hartman
2025-05-15  8:03 ` Mark Brown
2025-05-15  8:10 ` Florian Fainelli
2025-05-15 12:01 ` Naresh Kamboju
2025-05-19 13:49 ` Guenter Roeck

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=2025051931-hardy-had-44a3@gregkh \
    --to=gregkh@linuxfoundation.org \
    --cc=akpm@linux-foundation.org \
    --cc=broonie@kernel.org \
    --cc=conor@kernel.org \
    --cc=darren.kenny@oracle.com \
    --cc=f.fainelli@gmail.com \
    --cc=hargar@microsoft.com \
    --cc=harshit.m.mogalapalli@oracle.com \
    --cc=jonathanh@nvidia.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=lkft-triage@lists.linaro.org \
    --cc=ncopa@alpinelinux.org \
    --cc=patches@kernelci.org \
    --cc=patches@lists.linux.dev \
    --cc=pavel@denx.de \
    --cc=pawan.kumar.gupta@linux.intel.com \
    --cc=rwarsow@gmx.de \
    --cc=shuah@kernel.org \
    --cc=srw@sladewatkins.net \
    --cc=stable@vger.kernel.org \
    --cc=sudipm.mukherjee@gmail.com \
    --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