From: Borislav Petkov <bp@alien8.de>
To: X86 ML <x86@kernel.org>
Cc: LKML <linux-kernel@vger.kernel.org>
Subject: [PATCH v1 00/12] x86, alternatives: Instruction padding and more robust JMPs
Date: Tue, 3 Feb 2015 19:16:18 +0100 [thread overview]
Message-ID: <1422987390-17878-1-git-send-email-bp@alien8.de> (raw)
From: Borislav Petkov <bp@suse.de>
[ Changelog is in version-increasing number so that one can follow the
evolution of the patch set in a more natural way (i.e., latest version
comes at the end. ]
v0:
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.
v1:
This is the first version which passes testing on AMD/Intel, 32/64-bit
boxes I have here. For more info what it does, you can boot with
"debug-alternative" to see some verbose information about what gets
changed into what.
Patches 1 and 2 are cleanups.
Patch 3 is adding the padding at build time and patch 4 simplifies using
JMPs in alternatives without having to do crazy math with labels, as a
user of the alternatives facilities.
Patch 5 optimizes the single-byte NOPs we're adding at build time to
longer NOPs which should go easier through the frontend.
Patches 6-12 then convert most of the alternative callsites to the
generic macros and kill the homegrown fun.
As always, constructive comments/suggestions are welcome.
Borislav Petkov (12):
x86, copy_user: Remove FIX_ALIGNMENT define
x86, alternatives: Cleanup DPRINTK macro
x86, alternatives: Add instruction padding
x86, alternatives: Make JMPs more robust
x86, alternatives: Use optimized NOPs for padding
x86, copy_page_64.S: Use generic ALTERNATIVE macro
x86, copy_user_64.S: Convert to ALTERNATIVE_2
x86, SMAP: Use ALTERNATIVE macro
x86, alternative: Convert X86_INVD_BUG to generic macro
x86, alternatives: Convert clear_page_64.S
x86, alternative: Use alternative_2 in rdtsc_barrier
x86, alternative: Cleanup prefetch primitives
arch/x86/include/asm/alternative-asm.h | 40 ++++++++
arch/x86/include/asm/alternative.h | 58 +++++++-----
arch/x86/include/asm/apic.h | 2 +-
arch/x86/include/asm/barrier.h | 6 +-
arch/x86/include/asm/cpufeature.h | 23 ++---
arch/x86/include/asm/processor.h | 16 ++--
arch/x86/include/asm/smap.h | 30 ++----
arch/x86/kernel/alternative.c | 164 ++++++++++++++++++++++++++++-----
arch/x86/kernel/cpu/amd.c | 5 +
arch/x86/kernel/entry_32.S | 12 +--
arch/x86/lib/clear_page_64.S | 66 ++++++-------
arch/x86/lib/copy_page_64.S | 37 +++-----
arch/x86/lib/copy_user_64.S | 46 ++-------
arch/x86/um/asm/barrier.h | 4 +-
14 files changed, 305 insertions(+), 204 deletions(-)
--
2.2.0.33.gc18b867
next reply other threads:[~2015-02-03 18:17 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-02-03 18:16 Borislav Petkov [this message]
2015-02-03 18:16 ` [PATCH v1 01/12] x86, copy_user: Remove FIX_ALIGNMENT define Borislav Petkov
2015-02-03 18:16 ` [PATCH v1 02/12] x86, alternatives: Cleanup DPRINTK macro Borislav Petkov
2015-02-03 19:01 ` Joe Perches
2015-02-03 18:16 ` [PATCH v1 03/12] x86, alternatives: Add instruction padding Borislav Petkov
2015-02-03 18:16 ` [PATCH v1 04/12] x86, alternatives: Make JMPs more robust Borislav Petkov
2015-02-03 18:16 ` [PATCH v1 05/12] x86, alternatives: Use optimized NOPs for padding Borislav Petkov
2015-02-03 19:36 ` Andy Lutomirski
2015-02-03 19:54 ` Borislav Petkov
2015-02-03 18:16 ` [PATCH v1 06/12] x86, copy_page_64.S: Use generic ALTERNATIVE macro Borislav Petkov
2015-02-03 18:16 ` [PATCH v1 07/12] x86, copy_user_64.S: Convert to ALTERNATIVE_2 Borislav Petkov
2015-02-03 18:16 ` [PATCH v1 08/12] x86, SMAP: Use ALTERNATIVE macro Borislav Petkov
2015-02-03 18:16 ` [PATCH v1 09/12] x86, alternative: Convert X86_INVD_BUG to generic macro Borislav Petkov
2015-02-03 18:16 ` [PATCH v1 10/12] x86, alternatives: Convert clear_page_64.S Borislav Petkov
2015-02-03 18:16 ` [PATCH v1 11/12] x86, alternative: Use alternative_2 in rdtsc_barrier Borislav Petkov
2015-02-03 19:55 ` Andy Lutomirski
2015-02-03 20:08 ` Borislav Petkov
2015-02-03 18:16 ` [PATCH v1 12/12] x86, alternative: Cleanup prefetch primitives Borislav Petkov
2015-02-18 21:20 ` [PATCH v1 00/12] x86, alternatives: Instruction padding and more robust JMPs Ingo Molnar
2015-02-18 21:23 ` Borislav Petkov
2015-02-24 11:04 ` Borislav Petkov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1422987390-17878-1-git-send-email-bp@alien8.de \
--to=bp@alien8.de \
--cc=linux-kernel@vger.kernel.org \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox