]> git.baikalelectronics.ru Git - kernel.git/commit
KVM: arm64: Prevent vcpu_has_ptrauth from generating OOL functions
authorMarc Zyngier <maz@kernel.org>
Wed, 22 Jul 2020 16:22:31 +0000 (17:22 +0100)
committerMarc Zyngier <maz@kernel.org>
Tue, 28 Jul 2020 08:03:57 +0000 (09:03 +0100)
commitbf8f5d1507c1661918b083e8f9d5e6a734492490
treecf28052876eca7fa9986481ab04692a3ab45dbcc
parentea021eec7d44e3ed35e2c41a918419049a7c2150
KVM: arm64: Prevent vcpu_has_ptrauth from generating OOL functions

So far, vcpu_has_ptrauth() is implemented in terms of system_supports_*_auth()
calls, which are declared "inline". In some specific conditions (clang
and SCS), the "inline" very much turns into an "out of line", which
leads to a fireworks when this predicate is evaluated on a non-VHE
system (right at the beginning of __hyp_handle_ptrauth).

Instead, make sure vcpu_has_ptrauth gets expanded inline by directly
using the cpus_have_final_cap() helpers, which are __always_inline,
generate much better code, and are the only thing that make sense when
running at EL2 on a nVHE system.

Fixes: dd214dba64c8 ("KVM: arm64: Handle PtrAuth traps early")
Reported-by: Nathan Chancellor <natechancellor@gmail.com>
Reported-by: Nick Desaulniers <ndesaulniers@google.com>
Signed-off-by: Marc Zyngier <maz@kernel.org>
Tested-by: Nathan Chancellor <natechancellor@gmail.com>
Reviewed-by: Nathan Chancellor <natechancellor@gmail.com>
Link: https://lore.kernel.org/r/20200722162231.3689767-1-maz@kernel.org
arch/arm64/include/asm/kvm_host.h