On 1/27/22 10:21 AM, Borislav Petkov wrote:
On Fri, Dec 10, 2021 at 09:43:28AM -0600, Brijesh Singh wrote:
Version 2 of GHCB specification provides SNP_GUEST_REQUEST and
SNP_EXT_GUEST_REQUEST NAE that can be used by the SNP guest to communicate
with the PSP.
While at it, add a snp_issue_guest_request() helper that can be used by
Not "that can" but "that will".
Noted.
+/* Guest message request error code */
+#define SNP_GUEST_REQ_INVALID_LEN BIT_ULL(32)
SZ_4G is more descriptive, perhaps...
I am okay with using SZ_4G but per the spec they don't spell that its 4G
size. It says bit 32 will should be set on error.
+
+ ret = sev_es_ghcb_hv_call(ghcb, true, NULL, exit_code, input->req_gpa, input->resp_gpa);
^^^^^
That's ctxt which is accessed without a NULL check in
verify_exception_info().
Why aren't you allocating a ctxt on stack like the other callers do?
Typically the sev_es_ghcb_hv_handler() is called from #VC handler, which
provides the context structure. But in this and PSC case, the caller is
not a #VC handler, so we don't have a context structure. But as you
pointed, we could allocate context structure on the stack and pass it
down so that verify_exception_info() does not cause a panic with NULL
deference (when HV violates the spec and inject exception while handling
this NAE).
thanks