Skip to contentSkip to conversation

xen/include: public: Document the padding in struct xen_hvm_param

PATCH In review Julien Grall 3 participants 4 messages Feb 6, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xen/include: public: Document the padding in struct xen_hvm_param

From: Julien Grall <[email protected]>

There is an implicit padding of 2 bytes in struct xen_hvm_param between the field domid and index. Make it explicit by introduce a padding field. This can also serve as documentation.

Note that I don't think we can mandate it to be zero because a guest may not have initialized the padding.

---
 xen/include/public/hvm/hvm_op.h | 1 +
 1 file changed, 1 insertion(+)
xen/include/public/hvm/hvm_op.h +1 -0
index 610e020a62..b599d3cbd0 100644
@@ -32,6 +32,7 @@
 #define HVMOP_get_param           1
 struct xen_hvm_param {
     domid_t  domid;    /* IN */
+    uint16_t pad;
     uint32_t index;    /* IN */
     uint64_t value;    /* IN/OUT */
 };
Signature · 7 lines
2.17.1


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Acked-by on v1 1/1
#1 lore raw
Quoted 8 lines · Julien Grall

From: Julien Grall <[email protected]>

There is an implicit padding of 2 bytes in struct xen_hvm_param between the field domid and index. Make it explicit by introduce a padding field. This can also serve as documentation.

Note that I don't think we can mandate it to be zero because a guest may not have initialized the padding.

Agreed - we can mandate such only at introduction, not at any later time.

Quoted 1 line

(I doubt this is the only missing field to make padding explicit.)

Jan

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#2 lore raw

Hi Jan,

Quoted 10 lines · Jan Beulich
Quoted 8 lines · Julien Grall

From: Julien Grall <[email protected]>

There is an implicit padding of 2 bytes in struct xen_hvm_param between the field domid and index. Make it explicit by introduce a padding field. This can also serve as documentation.

Note that I don't think we can mandate it to be zero because a guest may not have initialized the padding.

Quoted 6 lines

Agreed - we can mandate such only at introduction, not at any later time.

Quoted 1 line

Thank you!

Quoted 1 line

(I doubt this is the only missing field to make padding explicit.)

Probably not, sadly. I stumbled accross the HVM param implicit padding while looking at liveupdating the HVM param.

I guess I could use pahole to check the paddings are explicit for all the public structure.

Cheers,

Signature · 6 lines
Julien Grall

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Acked-by on v1 1/1
#3 lore raw
In reply to Julien Grall
Quoted 10 lines · Julien Grall

From: Julien Grall <[email protected]>

There is an implicit padding of 2 bytes in struct xen_hvm_param between the field domid and index. Make it explicit by introduce a padding field. This can also serve as documentation.

Note that I don't think we can mandate it to be zero because a guest may not have initialized the padding.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel