x86/alternatives: Use optimized NOPs for padding
authorBorislav Petkov <bp@suse.de>
Sat, 10 Jan 2015 19:34:07 +0000 (20:34 +0100)
committerBen Hutchings <ben@decadent.org.uk>
Sun, 7 Jan 2018 01:46:50 +0000 (01:46 +0000)
commit2bf370c889e55dca0f673dd1ee688b242f2eb881
treefbde7936eb67fdda7b2d1eaa70b02c801e62e6cc
parent0b01b7c297106bcbd52bb4e65109f41a21ac9bef
x86/alternatives: Use optimized NOPs for padding

commit 4fd4b6e5537cec5b56db0b22546dd439ebb26830 upstream.

Alternatives allow now for an empty old instruction. In this case we go
and pad the space with NOPs at assembly time. However, there are the
optimal, longer NOPs which should be used. Do that at patching time by
adding alt_instr.padlen-sized NOPs at the old instruction address.

Cc: Andy Lutomirski <luto@amacapital.net>
Signed-off-by: Borislav Petkov <bp@suse.de>
Signed-off-by: Hugh Dickins <hughd@google.com>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
arch/x86/kernel/alternative.c