Re: [PATCH] x86, relocs: Ignore relocations in .notes section on walk_relocs

From: Kees Cook
Date: Fri Mar 22 2024 - 19:41:59 EST


On Fri, Mar 22, 2024 at 09:45:12AM +0100, Ingo Molnar wrote:
>
> * Kees Cook <keescook@xxxxxxxxxxxx> wrote:
>
> > On Sun, 17 Mar 2024 23:05:47 +0800, Guixiong Wei wrote:
> > > The commit aaa8736370db ("x86, relocs: Ignore relocations in
> > > .notes section") only ignore .note section on print_absolute_relocs,
> > > but it also need to add on walk_relocs to avoid relocations in .note
> > > section.
> > >
> > >
> >
> > Applied to for-next/hardening, thanks!
> >
> > [1/1] x86, relocs: Ignore relocations in .notes section on walk_relocs
> > https://git.kernel.org/kees/c/6ba438a29b5d
>
> Please don't - these are x86 patches, plus it contains an eyesore - see
> below ...

Dropped.

>
> Thanks,
>
> Ingo
>
> relocs.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
> Index: tip/arch/x86/tools/relocs.c
> ===================================================================
> --- tip.orig/arch/x86/tools/relocs.c
> +++ tip/arch/x86/tools/relocs.c
> @@ -752,9 +752,8 @@ static void walk_relocs(int (*process)(s
> * values there are meant for pre-boot consumption (e.g.
> * startup_xen).
> */
> - if (sec_applies->shdr.sh_type == SHT_NOTE) {
> + if (sec_applies->shdr.sh_type == SHT_NOTE)
> continue;
> - }

I think the patch was trying to follow the existing code style in the
file. See line 733, for example:

if (sec->shdr.sh_type != SHT_REL_TYPE) {
continue;
}

But yes, agreed, your change is good. :)

-Kees

--
Kees Cook