summaryrefslogtreecommitdiffstats
path: root/tools/objtool
diff options
context:
space:
mode:
authorKai Huang <kai.huang@intel.com>2023-08-15 23:02:05 +1200
committerDave Hansen <dave.hansen@linux.intel.com>2023-09-12 16:30:27 -0700
commit7b804135d4d1f0a2b9dda69c6303d3f2dcbe9d37 (patch)
tree184abd7360e01bb10d2d023523b087fbd99ebf0b /tools/objtool
parentc33621b4c5ad5b6b8b245754013cc506f9ded2b8 (diff)
downloadlinux-7b804135d4d1f0a2b9dda69c6303d3f2dcbe9d37.tar.gz
linux-7b804135d4d1f0a2b9dda69c6303d3f2dcbe9d37.tar.bz2
linux-7b804135d4d1f0a2b9dda69c6303d3f2dcbe9d37.zip
x86/virt/tdx: Make TDX_MODULE_CALL handle SEAMCALL #UD and #GP
SEAMCALL instruction causes #UD if the CPU isn't in VMX operation. Currently the TDX_MODULE_CALL assembly doesn't handle #UD, thus making SEAMCALL when VMX is disabled would cause Oops. Unfortunately, there are legal cases that SEAMCALL can be made when VMX is disabled. For instance, VMX can be disabled due to emergency reboot while there are still TDX guests running. Extend the TDX_MODULE_CALL assembly to return an error code for #UD to handle this case gracefully, e.g., KVM can then quietly eat all SEAMCALL errors caused by emergency reboot. SEAMCALL instruction also causes #GP when TDX isn't enabled by the BIOS. Use _ASM_EXTABLE_FAULT() to catch both exceptions with the trap number recorded, and define two new error codes by XORing the trap number to the TDX_SW_ERROR. This opportunistically handles #GP too while using the same simple assembly code. A bonus is when kernel mistakenly calls SEAMCALL when CPU isn't in VMX operation, or when TDX isn't enabled by the BIOS, or when the BIOS is buggy, the kernel can get a nicer error code rather than a less understandable Oops. This is basically based on Peter's code. Suggested-by: Peter Zijlstra <peterz@infradead.org> Signed-off-by: Kai Huang <kai.huang@intel.com> Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com> Reviewed-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com> Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org> Link: https://lore.kernel.org/all/de975832a367f476aab2d0eb0d9de66019a16b54.1692096753.git.kai.huang%40intel.com
Diffstat (limited to 'tools/objtool')
0 files changed, 0 insertions, 0 deletions