Observed Issue
==============
With lttng-ust 2.13, when using the event notification capture feature
to capture a context field, e.g. '$ctx.cpu_id', the captured value is
often observed in reverse byte order.
This issue is not visible in lttng-ust 2.12 because it does not
implement the event notification capture feature. However, it would
become observable if a lttng-tools emits a filter bytecode
BYTECODE_OP_GET_SYMBOL instruction to load the context value. For
compatibility purposes, lttng-tools only uses
BYTECODE_OP_GET_CONTEXT_REF to load the filter context fields,
but nothing prevents a future lttng-tools version from using
BYTECODE_OP_GET_SYMBOL instead.
Cause
=====
Within the bytecode interpreter, context_get_index() leaves the "rev_bo"
field uninitialized in the top of stack.
Solution
========
Initialize the rev_bo field based on the context field type
reserve_byte_order field.
Known drawbacks
===============
None.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I74996d501cee3c269658d98dfc0d0050b74c5ddb
ptr->u.u64 = v.u.s64; /* Cast. */
ptr->ptr = &ptr->u.u64;
}
ptr->u.u64 = v.u.s64; /* Cast. */
ptr->ptr = &ptr->u.u64;
}
+ ptr->rev_bo = field->type.u.basic.integer.reverse_byte_order;
break;
case atype_enum:
{
break;
case atype_enum:
{
ptr->u.u64 = v.u.s64; /* Cast. */
ptr->ptr = &ptr->u.u64;
}
ptr->u.u64 = v.u.s64; /* Cast. */
ptr->ptr = &ptr->u.u64;
}
+ ptr->rev_bo = itype->reverse_byte_order;
break;
}
case atype_array:
break;
}
case atype_array:
ctx_field->get_value(ctx_field, &v);
ptr->u.d = v.u.d;
ptr->ptr = &ptr->u.d;
ctx_field->get_value(ctx_field, &v);
ptr->u.d = v.u.d;
ptr->ptr = &ptr->u.d;
+ ptr->rev_bo = field->type.u.basic._float.reverse_byte_order;
break;
case atype_dynamic:
ctx_field->get_value(ctx_field, &v);
break;
case atype_dynamic:
ctx_field->get_value(ctx_field, &v);
ptr->object_type = OBJECT_TYPE_S64;
ptr->u.s64 = v.u.s64;
ptr->ptr = &ptr->u.s64;
ptr->object_type = OBJECT_TYPE_S64;
ptr->u.s64 = v.u.s64;
ptr->ptr = &ptr->u.s64;
+ /*
+ * struct lttng_ctx_value does not currently
+ * feature a byte order field.
+ */
+ ptr->rev_bo = false;
dbg_printf("context get index dynamic s64 %" PRIi64 "\n", ptr->u.s64);
break;
case LTTNG_UST_DYNAMIC_TYPE_DOUBLE:
ptr->object_type = OBJECT_TYPE_DOUBLE;
ptr->u.d = v.u.d;
ptr->ptr = &ptr->u.d;
dbg_printf("context get index dynamic s64 %" PRIi64 "\n", ptr->u.s64);
break;
case LTTNG_UST_DYNAMIC_TYPE_DOUBLE:
ptr->object_type = OBJECT_TYPE_DOUBLE;
ptr->u.d = v.u.d;
ptr->ptr = &ptr->u.d;
+ /*
+ * struct lttng_ctx_value does not currently
+ * feature a byte order field.
+ */
+ ptr->rev_bo = false;
dbg_printf("context get index dynamic double %g\n", ptr->u.d);
break;
case LTTNG_UST_DYNAMIC_TYPE_STRING:
dbg_printf("context get index dynamic double %g\n", ptr->u.d);
break;
case LTTNG_UST_DYNAMIC_TYPE_STRING: