From: Siddharth Chandrasekaran <sidcha@amazon.de>
To: Paolo Bonzini <pbonzini@redhat.com>,
Marcelo Tosatti <mtosatti@redhat.com>
Cc: Siddharth Chandrasekaran <sidcha.dev@gmail.com>,
Liran Alon <liran@amazon.com>,
Ioannis Aslanidis <iaslan@amazon.de>, <kvm@vger.kernel.org>,
<qemu-devel@nongnu.org>,
Siddharth Chandrasekaran <sidcha@amazon.de>
Subject: [PATCH] hyperv: Fix struct hv_message_header ordering
Date: Thu, 29 Jul 2021 15:52:10 +0200 [thread overview]
Message-ID: <20210729135210.16970-1-sidcha@amazon.de> (raw)
According to Hyper-V TLFS Version 6.0b, struct hv_message_header members
should be defined in the order:
message_type, _reserved, message_flags, payload_size
but we have it defined in the order:
message_type, payload_size, message_flags, _reserved
that is, the payload_size and _reserved members swapped. Due to this mix
up, we were inadvertently causing two issues:
- The payload_size field has invalid data; it didn't cause an issue
so far because we are delivering only timer messages which has fixed
size payloads the guest probably did a sizeof(payload) instead
relying on the value of payload_size member.
- The message_flags was always delivered as 0 to the guest;
fortunately, according to section 13.3.1 message_flags is also
treated as a reserved field.
Although this is not causing an issue now, it might in future (we are
adding more message types in our VSM implementation) so fix it to
reflect the specification.
Signed-off-by: Siddharth Chandrasekaran <sidcha@amazon.de>
---
include/hw/hyperv/hyperv-proto.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/include/hw/hyperv/hyperv-proto.h b/include/hw/hyperv/hyperv-proto.h
index 21dc28aee9..f578a60e78 100644
--- a/include/hw/hyperv/hyperv-proto.h
+++ b/include/hw/hyperv/hyperv-proto.h
@@ -101,9 +101,9 @@ struct hyperv_signal_event_input {
*/
struct hyperv_message_header {
uint32_t message_type;
- uint8_t payload_size;
- uint8_t message_flags; /* HV_MESSAGE_FLAG_XX */
uint8_t _reserved[2];
+ uint8_t message_flags; /* HV_MESSAGE_FLAG_XX */
+ uint8_t payload_size;
uint64_t sender;
};
--
2.17.1
Amazon Development Center Germany GmbH
Krausenstr. 38
10117 Berlin
Geschaeftsfuehrung: Christian Schlaeger, Jonathan Weiss
Eingetragen am Amtsgericht Charlottenburg unter HRB 149173 B
Sitz: Berlin
Ust-ID: DE 289 237 879
reply other threads:[~2021-07-29 13:52 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210729135210.16970-1-sidcha@amazon.de \
--to=sidcha@amazon.de \
--cc=iaslan@amazon.de \
--cc=kvm@vger.kernel.org \
--cc=liran@amazon.com \
--cc=mtosatti@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=sidcha.dev@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.