Skip to content

Commit 5adf349

Browse files
Peter Zijlstrasuryasaimadhu
authored andcommitted
x86/module: Fix the paravirt vs alternative order
Ever since commit 4e62921 ("x86/paravirt: Add new features for paravirt patching") there is an ordering dependency between patching paravirt ops and patching alternatives, the module loader still violates this. Fixes: 4e62921 ("x86/paravirt: Add new features for paravirt patching") Signed-off-by: Peter Zijlstra (Intel) <[email protected]> Signed-off-by: Borislav Petkov <[email protected]> Reviewed-by: Miroslav Benes <[email protected]> Cc: <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent ffb217a commit 5adf349

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

arch/x86/kernel/module.c

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -273,6 +273,14 @@ int module_finalize(const Elf_Ehdr *hdr,
273273
retpolines = s;
274274
}
275275

276+
/*
277+
* See alternative_instructions() for the ordering rules between the
278+
* various patching types.
279+
*/
280+
if (para) {
281+
void *pseg = (void *)para->sh_addr;
282+
apply_paravirt(pseg, pseg + para->sh_size);
283+
}
276284
if (retpolines) {
277285
void *rseg = (void *)retpolines->sh_addr;
278286
apply_retpolines(rseg, rseg + retpolines->sh_size);
@@ -290,11 +298,6 @@ int module_finalize(const Elf_Ehdr *hdr,
290298
tseg, tseg + text->sh_size);
291299
}
292300

293-
if (para) {
294-
void *pseg = (void *)para->sh_addr;
295-
apply_paravirt(pseg, pseg + para->sh_size);
296-
}
297-
298301
/* make jump label nops */
299302
jump_label_apply_nops(me);
300303

0 commit comments

Comments
 (0)