Fix: Filter ABI changes to support FILTER_BYTECODE_MAX_LEN (65536)
authorChristian Babeux <christian.babeux@efficios.com>
Thu, 6 Sep 2012 21:05:01 +0000 (17:05 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Thu, 6 Sep 2012 21:05:01 +0000 (17:05 -0400)
In order to support the filter bytecode maximum length (65536 bytes),
the lttng_ust_filter_bytecode len field type must be able to
hold more than a uint16_t. Change the field type to a uint32_t.

Also, since the relocation table is located at the end of the actual
bytecode, the reloc_table_offset (reloc_offset in ust-abi) field must
support offset values larger than 65535. Change the field type to a
uint32_t. This change will allow support of relocation table appended
to larger bytecode without breaking the ABI if the need arise in the
future.

Both changes currently breaks the filter ABI, but this should be a
reasonable compromise since the filtering feature has not been
released yet.

Signed-off-by: Christian Babeux <christian.babeux@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
include/lttng/ust-abi.h
include/ust-comm.h
liblttng-ust/lttng-ust-comm.c

index 0489e89b8d206502f3a003869cd4bf6317ab6351..91639a7c6d43279ab60f85b0098d2bced8484d0b 100644 (file)
@@ -174,8 +174,8 @@ struct lttng_ust_calibrate {
 
 #define FILTER_BYTECODE_MAX_LEN                65536
 struct lttng_ust_filter_bytecode {
-       uint16_t len;
-       uint16_t reloc_offset;
+       uint32_t len;
+       uint32_t reloc_offset;
        char data[0];
 };
 
index b09fcca4f379728ab713ab1ec17b7dcb251c3eb0..4a3e4cea13ab9f89a9ba8365f9528d904ca51196 100644 (file)
@@ -132,8 +132,8 @@ struct ustcomm_ust_msg {
                struct lttng_ust_tracer_version version;
                struct lttng_ust_tracepoint_iter tracepoint;
                struct {
-                       uint16_t data_size;     /* following filter data */
-                       uint16_t reloc_offset;
+                       uint32_t data_size;     /* following filter data */
+                       uint32_t reloc_offset;
                } filter;
        } u;
 };
index 842876fb743c857cf519ff5161d8d333d639bd16..be64acd01d03e6b730cec0403a4edda21fbd90ac 100644 (file)
@@ -293,6 +293,14 @@ int handle_message(struct sock_info *sock_info,
                        ret = -EINVAL;
                        goto error;
                }
+
+               if (lum->u.filter.reloc_offset > lum->u.filter.data_size - 1) {
+                       ERR("Filter reloc offset %u is not within data\n",
+                               lum->u.filter.reloc_offset);
+                       ret = -EINVAL;
+                       goto error;
+               }
+
                bytecode = zmalloc(sizeof(*bytecode) + lum->u.filter.data_size);
                if (!bytecode) {
                        ret = -ENOMEM;
This page took 0.029856 seconds and 4 git commands to generate.