[roll] Roll fuchsia [kernel][x86][hypervisor] Restore host registers when vmlaunch fails.
We currently do not correctly restore the host registers when
a `vmlaunch` or `vmresume` command fails, but instead leave callee-saved
registers as their guest-register values.
This CL changes the structure of the `vmx_enter` code, allowing us to
use the same restore path for both the success and failure cases:
* Instead of `vmx_enter` calling `vmx_exit`, we rename the existing
`vmx_enter` to `vmx_enter_asm`, and make a new function `vmx_enter`
call into both `vmx_enter_asm` and perform the existing `vmx_exit`
functionality.
* In `vmx_enter_asm`, instead of storing host callee-saved registers
and return address in the vmx_state struct, we just save them on the
stack like a normal function.
This makes the `vmx_enter_asm` function look more like a normal
function, and avoids some juggling of RIP in the entry/exit of the
function.
* Similarly, we save rflags directly on the host's stack, avoiding
having to push/pop them in and out of the vmx_state struct.
* The function's exit code is produced earlier and saved directly in
RAX, allowing both the success and failure paths to share the host
state restore path.
* Finally, we combine the existing `vmx_enter`/`vmx_exit_entry`
functions into just the one, to avoid having to jump from vmx_enter
into the middle of vmx_exit_entry in the failure case.
We still need a symbol in the middle of vmx_enter to write as the
exit point in the VMCS, but from the debugger's perspective
`vmx_enter_asm` becomes a single function.
Additionally, we add a test exercising the failure path in kernel unit
tests.
Original-Bug: 75942
Original-Reviewed-on: https://fuchsia-review.googlesource.com/c/fuchsia/+/526553
Original-Revision: feaf39c272a662b46385dedc50810d41d24a0775
GitOrigin-RevId: 29bfe34c0e74f5e45d74d14a35561da756536e71
Change-Id: If106ef0cf00e863603000579e7419cedec1dcb7e
This repository contains Fuchsia's Global Integration manifest files.
All changes should be made to the internal version of this repository. Our infrastructure automatically updates this version when the internal one changes.
Currently all changes must be made by a Google employee. Non-Google employees wishing to make a change can ask for assistance via the IRC channel #fuchsia on Freenode.
First install Jiri.
Next run:
$ jiri init $ jiri import minimal https://fuchsia.googlesource.com/integration $ jiri update
Third party projects should have their own subdirectory in ./third_party.