Fix: bytecode linker: iteration on wrong list head
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Fri, 12 Mar 2021 13:42:23 +0000 (08:42 -0500)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Fri, 12 Mar 2021 13:58:51 +0000 (08:58 -0500)
commit5bdf9cccfc9093cafbaf5dfd1d9d69aae2ac598d
tree9c63583af7ce00d4eae87ebe7688d869a832f185
parent31a85ea9c0e82d7708dfd729dc7055e1ab909d0a
Fix: bytecode linker: iteration on wrong list head

lttng_enabler_link_bytecode() calls link_bytecode() passing an insertion
location (insert_loc) within the list. This insert location is meant to
be used as cursor position where to add the new element.

However, bytecode_is_linked() uses it as iteration list head, and this
is where things fall apart: it will thus consider the real list head as
being a list node, and will erroneously think that it is contained
within a struct lttng_bytecode_runtime, and thus try to perform possibly
out-of-bound read or read garbage data for the comparison.

It worked fine most of the time because in usual scenarios the insert
location is the list head. It falls apart when many bytecodes are linked
to a given event.

Fixes: 53b9d7db85d ("Decouple `struct lttng_event` from filter code")
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: Ie47171e981986a30b45b92f82811ff15aae38ad2
liblttng-ust/lttng-bytecode.c
This page took 0.025706 seconds and 4 git commands to generate.