]> git.baikalelectronics.ru Git - kernel.git/commit
objtool,x86: Fix uaccess PUSHF/POPF validation
authorPeter Zijlstra <peterz@infradead.org>
Mon, 8 Mar 2021 14:46:04 +0000 (15:46 +0100)
committerPeter Zijlstra <peterz@infradead.org>
Fri, 12 Mar 2021 08:15:49 +0000 (09:15 +0100)
commit58510c36c6117a2d97d37eb6baaf3cce7787e546
tree4c95d9c8d8a57e79b4942d841fb45b1c787f7c90
parent219c9076286fd92026e818ab1375558e5b20649f
objtool,x86: Fix uaccess PUSHF/POPF validation

Commit 07d9137ec280 ("x86/pv: Rework arch_local_irq_restore() to not
use popf") replaced "push %reg; popf" with something like: "test
$0x200, %reg; jz 1f; sti; 1:", which breaks the pushf/popf symmetry
that commit 37a9286be0b1 ("objtool: Add UACCESS validation") relies
on.

The result is:

  drivers/gpu/drm/amd/amdgpu/si.o: warning: objtool: si_common_hw_init()+0xf36: PUSHF stack exhausted

Meanwhile, commit 2e2026114224 ("objtool: Support stack layout changes
in alternatives") makes that we can actually use stack-ops in
alternatives, which means we can revert 2c9bceb9d910 ("x86,smap: Fix
smap_{save,restore}() alternatives").

That in turn means we can limit the PUSHF/POPF handling of
37a9286be0b1 to those instructions that are in alternatives.

Fixes: 07d9137ec280 ("x86/pv: Rework arch_local_irq_restore() to not use popf")
Reported-by: Borislav Petkov <bp@alien8.de>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Acked-by: Josh Poimboeuf <jpoimboe@redhat.com>
Link: https://lkml.kernel.org/r/YEY4rIbQYa5fnnEp@hirez.programming.kicks-ass.net
arch/x86/include/asm/smap.h
tools/objtool/check.c