Skip to content

Commit 19469d2

Browse files
committed
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
2 parents fa509ff + ba08abc commit 19469d2

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

arch/x86/include/asm/smap.h

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,8 @@ static __always_inline unsigned long smap_save(void)
5858
unsigned long flags;
5959

6060
asm volatile ("# smap_save\n\t"
61-
ALTERNATIVE("jmp 1f", "", X86_FEATURE_SMAP)
62-
"pushf; pop %0; " __ASM_CLAC "\n\t"
63-
"1:"
61+
ALTERNATIVE("", "pushf; pop %0; " __ASM_CLAC "\n\t",
62+
X86_FEATURE_SMAP)
6463
: "=rm" (flags) : : "memory", "cc");
6564

6665
return flags;
@@ -69,9 +68,8 @@ static __always_inline unsigned long smap_save(void)
6968
static __always_inline void smap_restore(unsigned long flags)
7069
{
7170
asm volatile ("# smap_restore\n\t"
72-
ALTERNATIVE("jmp 1f", "", X86_FEATURE_SMAP)
73-
"push %0; popf\n\t"
74-
"1:"
71+
ALTERNATIVE("", "push %0; popf\n\t",
72+
X86_FEATURE_SMAP)
7573
: : "g" (flags) : "memory", "cc");
7674
}
7775

tools/objtool/check.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2442,6 +2442,9 @@ static int handle_insn_ops(struct instruction *insn, struct insn_state *state)
24422442
if (update_cfi_state(insn, &state->cfi, op))
24432443
return 1;
24442444

2445+
if (!insn->alt_group)
2446+
continue;
2447+
24452448
if (op->dest.type == OP_DEST_PUSHF) {
24462449
if (!state->uaccess_stack) {
24472450
state->uaccess_stack = 1;

0 commit comments

Comments
 (0)