Messages in this thread | | | Date | Tue, 6 Apr 2021 09:40:38 +0200 | From | Borislav Petkov <> | Subject | Re: [PATCH v3 13/25] x86/sgx: Add helpers to expose ECREATE and EINIT to KVM |
| |
On Tue, Apr 06, 2021 at 09:44:21AM +1200, Kai Huang wrote: > The intention was to catch KVM bug, since KVM is the only caller, and in current > implementation KVM won't call this function if @secs is not a valid userspace > pointer. But yes we can also return here, but in this case an exception number > must also be specified to *trapnr so that KVM can inject to guest. It's not that > straightforward to decide which exception should we inject, but I think #GP > should be OK. Please see below.
Why should you inject anything in that case?
AFAICT, you can handle the return value in __handle_encls_ecreate() and inject only when the return value is EFAULT. If it is another negative error value, you pass it back up to its caller, handle_encls_ecreate() which returns other error values like -ENOMEM too. Which means, its callchain can stomach negative values just fine.
-- Regards/Gruss, Boris.
https://people.kernel.org/tglx/notes-about-netiquette
| |