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

Jiri Slaby
2022-07-13T07:54:41Z

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.

thanks,
--
js