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

From: Jiri Slaby
Date: Wed Jul 13 2022 - 03:54:41 EST

On 13. 07. 22, 9:45, Jiri Slaby wrote:
On 12. 07. 22, 20:39, Greg Kroah-Hartman wrote:
From: Peter Zijlstra <peterz@xxxxxxxxxxxxx>

commit 9bb2ec608a209018080ca262f771e6a9ff203b6f upstream.

Update retpoline validation with the new CONFIG_RETPOLINE requirement of
not having bare naked RET instructions.


this breaks compilation on i386:
> arch/x86/kernel/../../x86/xen/xen-head.S:35: Error: no such instruction: `annotate_unret_safe'


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.