Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
forked fromtorvalds/linux

Commit612e8e9

Browse files
suryasaimadhuKAGA-KOKO
authored andcommitted
x86/alternatives: Fix optimize_nops() checking
The alternatives code checks only the first byte whether it is a NOP, butwith NOPs in front of the payload and having actual instructions after itbreaks the "optimized' test.Make sure to scan all bytes before deciding to optimize the NOPs in there.Reported-by: David Woodhouse <dwmw2@infradead.org>Signed-off-by: Borislav Petkov <bp@suse.de>Signed-off-by: Thomas Gleixner <tglx@linutronix.de>Cc: Tom Lendacky <thomas.lendacky@amd.com>Cc: Andi Kleen <ak@linux.intel.com>Cc: Tim Chen <tim.c.chen@linux.intel.com>Cc: Peter Zijlstra <peterz@infradead.org>Cc: Jiri Kosina <jikos@kernel.org>Cc: Dave Hansen <dave.hansen@intel.com>Cc: Andi Kleen <andi@firstfloor.org>Cc: Andrew Lutomirski <luto@kernel.org>Cc: Linus Torvalds <torvalds@linux-foundation.org>Cc: Greg Kroah-Hartman <gregkh@linux-foundation.org>Cc: Paul Turner <pjt@google.com>Link:https://lkml.kernel.org/r/20180110112815.mgciyf5acwacphkq@pd.tnic
1 parent9ecccfa commit612e8e9

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

‎arch/x86/kernel/alternative.c‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -344,9 +344,12 @@ recompute_jump(struct alt_instr *a, u8 *orig_insn, u8 *repl_insn, u8 *insnbuf)
344344
staticvoid__init_or_modulenoinlineoptimize_nops(structalt_instr*a,u8*instr)
345345
{
346346
unsigned longflags;
347+
inti;
347348

348-
if (instr[0]!=0x90)
349-
return;
349+
for (i=0;i<a->padlen;i++) {
350+
if (instr[i]!=0x90)
351+
return;
352+
}
350353

351354
local_irq_save(flags);
352355
add_nops(instr+ (a->instrlen-a->padlen),a->padlen);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp