Skip to content

RFC x86, alternatives: Insn padding and more robust JMPs

Borislav Petkov lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 RFC Latest4 patches 1 replyIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/4x86, copy_user: Remove FIX_ALIGNMENT definearch/x86/lib/copy_user_64.S+0 -50 replies
2/4x86, alternatives: Cleanup DPRINTK macroarch/x86/kernel/alternative.c+25 -161 reply
3/4alternatives: Add instruction paddingarch/x86/include/asm/alternative.h arch/x86/include/asm/cpufeature.h arch/x86/kernel/alternative.c+23 -190 replies
4/4alternatives: Make JMPs more robustarch/x86/include/asm/alternative-asm.h arch/x86/include/asm/cpufeature.h arch/x86/kernel/alternative.c +2 more+146 -600 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [RFC PATCH 0/4] x86, alternatives: Insn padding and more robust JMPs

From: Borislav Petkov <[email protected]>

Hi all,

this is something which hpa and I talked about recently: the ability for the alternatives code to add padding to the original instruction in case the replacement is longer and also to be able to simply write "jmp" and not care about which JMP exactly the compiler generates and whether the relative offsets are correct.

So this is a stab at it, it seems to boot in kvm here but it needs more staring to make sure we're actually generating the proper code at all times.

Thus the RFC tag, comments/suggestions are welcome.

Thanks.

Borislav Petkov (4):
x86, copy_user: Remove FIX_ALIGNMENT define
x86, alternatives: Cleanup DPRINTK macro
alternatives: Add instruction padding
alternatives: Make JMPs more robust

 arch/x86/include/asm/alternative-asm.h |  38 ++++++++++
 arch/x86/include/asm/alternative.h     |  34 +++++----
 arch/x86/include/asm/cpufeature.h      |  12 +--
 arch/x86/kernel/alternative.c          | 130 +++++++++++++++++++++++++++------
 arch/x86/lib/copy_page_64.S            |  34 ++++-----
 arch/x86/lib/copy_user_64.S            |  44 ++---------
 6 files changed, 193 insertions(+), 99 deletions(-)
Signature · 1 line
2.2.0.33.gc18b867