Mailing List Archive

[PATCH 4/6] x86/alternative: Replace a continue with a goto
A subsequent patch is going to insert a loop, which interferes with the
continue in the devirtualisation logic.

Replace it with a goto, and a paragraph explaining why we intentionally avoid
setting a->priv = 1.

No functional change.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
CC: Jan Beulich <JBeulich@suse.com>
CC: Roger Pau Monné <roger.pau@citrix.com>
---
xen/arch/x86/alternative.c | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/xen/arch/x86/alternative.c b/xen/arch/x86/alternative.c
index 2ca4dfd569bc..c86ea235e865 100644
--- a/xen/arch/x86/alternative.c
+++ b/xen/arch/x86/alternative.c
@@ -308,7 +308,15 @@ static void init_or_livepatch _apply_alternatives(struct alt_instr *start,
buf[4] = 0xff;
}
else
- continue;
+ {
+ /*
+ * The function pointer we're wanting to devirtualise
+ * is still NULL, and we're not sealing yet. Leave
+ * the alternative fully un-processed, in order to
+ * process it the next time around.
+ */
+ goto skip_this_alternative;
+ }
}
else if ( force && system_state < SYS_STATE_active )
ASSERT_UNREACHABLE();
@@ -323,6 +331,7 @@ static void init_or_livepatch _apply_alternatives(struct alt_instr *start,

add_nops(buf + a->repl_len, total_len - a->repl_len);
text_poke(orig, buf, total_len);
+ skip_this_alternative:;
}

/*
--
2.30.2
Re: [PATCH 4/6] x86/alternative: Replace a continue with a goto [ In reply to ]
On 22.04.2024 20:14, Andrew Cooper wrote:
> A subsequent patch is going to insert a loop, which interferes with the
> continue in the devirtualisation logic.
>
> Replace it with a goto, and a paragraph explaining why we intentionally avoid
> setting a->priv = 1.
>
> No functional change.
>
> Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>

Acked-by: Jan Beulich <jbeulich@suse.com>