Re: [PATCH 5.18 34/61] objtool: Update Retpoline validation

Greg Kroah-Hartman
2022-07-13T08:22:17Z

On Wed, Jul 13, 2022 at 09:54:01AM +0200, Jiri Slaby wrote:
> On 13. 07. 22, 9:45, Jiri Slaby wrote:
> > On 12. 07. 22, 20:39, Greg Kroah-Hartman wrote:
> > > From: Peter Zijlstra <peterz@infradead.org>
> > >
> > > commit 9bb2ec608a209018080ca262f771e6a9ff203b6f upstream.
> > >
> > > Update retpoline validation with the new CONFIG_RETPOLINE requirement of
> > > not having bare naked RET instructions.
> >
> > Hi,
> >
> > this breaks compilation on i386:
> > > arch/x86/kernel/../../x86/xen/xen-head.S:35: Error: no such
> > instruction: `annotate_unret_safe'
> >
> > Config:
> > https://raw.githubusercontent.com/openSUSE/kernel-source/stable/config/i386/pae
> >
> >
> > And yeah, upstream¹⁾ is affected too.
> >
> > ¹⁾I am at commit b047602d579b4fb028128a525f056bbdc890e7f0.
>
> A naive fix is:
> --- a/arch/x86/kernel/head_32.S
> +++ b/arch/x86/kernel/head_32.S
> @@ -23,6 +23,7 @@
> #include <asm/cpufeatures.h>
> #include <asm/percpu.h>
> #include <asm/nops.h>
> +#include <asm/nospec-branch.h>
> #include <asm/bootparam.h>
> #include <asm/export.h>
> #include <asm/pgtable_32.h>
>
> The question (I don't know answer to) is whether x86_32 should actually do
> ANNOTATE_UNRET_SAFE.

I doubt it should be doing that, but I'll let others answer more
definitively.

Your commit seems sane, for some reason I thought Boris tested i386
builds, but maybe in the end something snuck in that broke it.

thanks,

greg k-h