Return message size in hf_vcpu_run_return for HF_VCPU_RUN_MESSAGE.
Bug: 141469322
Change-Id: I25ba5051af57718c0bf18aad3a22f129c9c859e6
diff --git a/src/api.c b/src/api.c
index e7fb9cd..2034ae9 100644
--- a/src/api.c
+++ b/src/api.c
@@ -1005,6 +1005,12 @@
/* Messages for the primary VM are delivered directly. */
if (to->id == HF_PRIMARY_VM_ID) {
+ /*
+ * Only tell the primary VM the size if the message is for it,
+ * to avoid leaking data about messages for other VMs.
+ */
+ primary_ret.message.size = size;
+
to->mailbox.state = MAILBOX_STATE_READ;
*next = api_switch_to_primary(current, primary_ret,
VCPU_STATE_READY);