Re: [PATCH 6.6 000/113] 6.6.91-rc2 review

From: Greg Kroah-Hartman
Date: Fri May 16 2025 - 04:06:00 EST


On Thu, May 15, 2025 at 08:29:00AM -0700, Pawan Gupta wrote:
> On Thu, May 15, 2025 at 08:26:04AM -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@xxxxxxxxxxxxxxx>
> > Subject: [PATCH 6.6] x86/its: Fix build errors when CONFIG_MODULES=n
> >
> > From: Eric Biggers <ebiggers@xxxxxxxxxx>
> >
> > 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@xxxxxxxxxxxxxxx
> > Signed-off-by: Eric Biggers <ebiggers@xxxxxxxxxx>
> > Acked-by: Dave Hansen <dave.hansen@xxxxxxxxx>
> > Tested-by: Steven Rostedt (Google) <rostedt@xxxxxxxxxxx>
> > Reviewed-by: Alexandre Chartre <alexandre.chartre@xxxxxxxxxx>
> > Signed-off-by: Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx>
> > Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
>
> Agh!
>
> Signed-off-by: Pawan Gupta <pawan.kumar.gupta@xxxxxxxxxxxxxxx>

Thanks for this.

It applied to 6.6.y, but not 6.1.y or 5.15.y, so can you provide some
updated versions for them too?

thanks,

greg k-h