From 61c70d3794a4e8c965bbdbdd19934374ab83a70d Mon Sep 17 00:00:00 2001 From: Mathieu Desnoyers Date: Mon, 24 Jan 2022 21:08:35 -0500 Subject: [PATCH] Fix: ustcomm: serialize variant_nestable type LTTng-UST 2.13 serializes the contents of the variant_nestable union field, but keeps the "atype" as lttng_ust_ctl_atype_variant. It happens to work by pure chance because the binary layout of the variant_nestable and legacy.variant union fields are the same, except for the alignment field of variant_nestable which is zeroed padding in the legacy.variant. Therefore, as long as the variant_nestable has a padding of 0, everything works out fine (which is currently the case). But it's better to fix this discrepancy in case we ever plan to use a nonzero variant alignment. Signed-off-by: Mathieu Desnoyers Change-Id: I96a3e1f6bfbe410ed61ea59313eb49b6c4f4b40d --- src/common/ustcomm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/common/ustcomm.c b/src/common/ustcomm.c index 252ed4f2..4c1fb0ef 100644 --- a/src/common/ustcomm.c +++ b/src/common/ustcomm.c @@ -998,7 +998,7 @@ int serialize_dynamic_type(struct lttng_ust_session *session, strncpy(uf->name, field_name, LTTNG_UST_ABI_SYM_NAME_LEN); uf->name[LTTNG_UST_ABI_SYM_NAME_LEN - 1] = '\0'; - uf->type.atype = lttng_ust_ctl_atype_variant; + uf->type.atype = lttng_ust_ctl_atype_variant_nestable; uf->type.u.variant_nestable.nr_choices = nr_choices; strncpy(uf->type.u.variant_nestable.tag_name, tag_field_name, -- 2.34.1