Merge tag 'objtool-urgent-2021-03-14' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull objtool fix from Thomas Gleixner:
 "A single objtool fix to handle the PUSHF/POPF validation correctly for
  the paravirt changes which modified arch_local_irq_restore not to use
  popf"

* tag 'objtool-urgent-2021-03-14' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  objtool,x86: Fix uaccess PUSHF/POPF validation
This commit is contained in:
Linus Torvalds
2021-03-14 13:15:55 -07:00
2 changed files with 7 additions and 6 deletions

View File

@@ -58,9 +58,8 @@ static __always_inline unsigned long smap_save(void)
unsigned long flags; unsigned long flags;
asm volatile ("# smap_save\n\t" asm volatile ("# smap_save\n\t"
ALTERNATIVE("jmp 1f", "", X86_FEATURE_SMAP) ALTERNATIVE("", "pushf; pop %0; " __ASM_CLAC "\n\t",
"pushf; pop %0; " __ASM_CLAC "\n\t" X86_FEATURE_SMAP)
"1:"
: "=rm" (flags) : : "memory", "cc"); : "=rm" (flags) : : "memory", "cc");
return flags; return flags;
@@ -69,9 +68,8 @@ static __always_inline unsigned long smap_save(void)
static __always_inline void smap_restore(unsigned long flags) static __always_inline void smap_restore(unsigned long flags)
{ {
asm volatile ("# smap_restore\n\t" asm volatile ("# smap_restore\n\t"
ALTERNATIVE("jmp 1f", "", X86_FEATURE_SMAP) ALTERNATIVE("", "push %0; popf\n\t",
"push %0; popf\n\t" X86_FEATURE_SMAP)
"1:"
: : "g" (flags) : "memory", "cc"); : : "g" (flags) : "memory", "cc");
} }

View File

@@ -2442,6 +2442,9 @@ static int handle_insn_ops(struct instruction *insn, struct insn_state *state)
if (update_cfi_state(insn, &state->cfi, op)) if (update_cfi_state(insn, &state->cfi, op))
return 1; return 1;
if (!insn->alt_group)
continue;
if (op->dest.type == OP_DEST_PUSHF) { if (op->dest.type == OP_DEST_PUSHF) {
if (!state->uaccess_stack) { if (!state->uaccess_stack) {
state->uaccess_stack = 1; state->uaccess_stack = 1;