[lkml]   [2022]   [Mar]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [PATCH] x86/paravirt: Apply paravirt instructions in consistent order during boot/module load
On Mon, Mar 07, 2022 at 12:03:38PM -0600, Alex Thorlton wrote:
> Commit 4e6292114c74 ("x86/paravirt: Add new features for paravirt
> patching") changed the order in which altinstructions and paravirt
> instructions are patched at boot time. However, no analogous change was
> made in module_finalize, where we apply altinstructions and
> parainstructions during module load.
> As a result, any code that generates "stacked up" altinstructions and
> parainstructions (i.e. local_irq_save/restore) will produce different
> results when used in built-in kernel code vs. kernel modules. This also
> makes it possible to inadvertently replace altinstructions in the booted
> kernel with their parainstruction counterparts when using
> livepatch/kpatch.
> To fix this, re-order the processing in module_finalize, so that we do
> things in this order:
> 1. apply_paravirt
> 2. apply_retpolines
> 3. apply_alternatives
> 4. alternatives_smp_module_add
> This is the same ordering that is used at boot time in
> alternative_instructions.
> Fixes: 4e6292114c74 ("x86/paravirt: Add new features for paravirt patching")
> Signed-off-by: Alex Thorlton <>
> Reviewed-by: Boris Ostrovsky <>

Peter previously posted a fix, buried in his IBT series:

It should probably go ahead and be merged now...


 \ /
  Last update: 2022-03-07 19:46    [W:0.030 / U:2.796 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site