Fix: reloc offset validation error out on filters with no reloc table
A message that is not in the archive (sent off-list or not yet received): [email protected]
Mathieu Desnoyers
AppliedQuoted 3 lines · * Christian Babeux ([email protected]) wrote:
The reloc table is currently appended at the end of the bytecode data. With this scheme, the reloc table offset will be equal to the length of the bytecode data.
merged, thanks!
Mathieu
Quoted 98 lines
<- length ->
+----------+-------------+ | BYTECODE | RELOC TABLE | +----------+-------------+ | +--> Reloc table offsetA special case arise with filters with no reloc table.
Example:
Filter: "myString" == "yourString"
./filter-grammar-test -p -B -i -b < bogus
<root><op type="=="> <expression> <string value="myString"/> </expression> <expression> <string value="yourString"/> </expression> </op></root>
Generating IR... done
Validating IR... done
Generating bytecode... done
Size of bytecode generated: 24 bytes.
Bytecode:Val. Operator
---- --------0x40(FILTER_OP_LOAD_STRING)0x6Dm0x79y0x53S0x74t0x72r0x69i0x6En0x67g0x00\00x40(FILTER_OP_LOAD_STRING)0x79y0x6Fo0x75u0x72r0x53S0x74t0x72r0x69i0x6En0x67g0x00\00x0C(FILTER_OP_EQ)0x01(FILTER_OP_RETURN)Reloc table (offset: 24):
Empty<- 24 ->
+----------+ | BYTECODE | <- No reloc table +----------+ | +--> Reloc table offsetIn this case, we see that the reloc table offset (24) is indeed equal to the length of the bytecode (24), but the reloc table is _empty_. Thus, the
reloc_offsetreceived inhandle_message()will be equal to thedata_sizeand will be wrongly flagged as not within the data even thought the filter is entirely valid.The fix is to simply allow a
reloc_offsetto be equal to thedata_size.Fixes #342
Signed-off-by Christian Babeux <[email protected]>--- liblttng-ust/lttng-ust-comm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)liblttng-ust/lttng-ust-comm.c +1
-1@@ -294,7 +294,7 @@ int handle_message(struct sock_info *sock_info, goto error; } -if (lum->u.filter.reloc_offset > lum->u.filter.data_size -1 ) { +if (lum->u.filter.reloc_offset > lum->u.filter.data_size) {ERR ("Filter reloc offset %u is not within data\n" , lum->u.filter.reloc_offset); ret = -EINVAL ;Signature · 1 line
1.7.12
Signature · 4 lines
Mathieu Desnoyers Operating System Efficiency R&D Consultant EfficiOS Inc. http://www.efficios.com