projects
/
lttng-ust.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Cleanup: apply `include-what-you-use` guideline for `size_t`
[lttng-ust.git]
/
liblttng-ust
/
lttng-filter-interpreter.c
diff --git
a/liblttng-ust/lttng-filter-interpreter.c
b/liblttng-ust/lttng-filter-interpreter.c
index 1e7b12a5da4e0243ed1e00deb9b359b0569bb789..f246ce2a0b3383d1f000b3e17f253a77308ef6b1 100644
(file)
--- a/
liblttng-ust/lttng-filter-interpreter.c
+++ b/
liblttng-ust/lttng-filter-interpreter.c
@@
-25,8
+25,9
@@
*/
#define _LGPL_SOURCE
*/
#define _LGPL_SOURCE
-#include <
urcu-pointer
.h>
+#include <
stddef
.h>
#include <stdint.h>
#include <stdint.h>
+#include <urcu-pointer.h>
#include <byteswap.h>
#include "lttng-filter.h"
#include "string-utils.h"
#include <byteswap.h>
#include "lttng-filter.h"
#include "string-utils.h"
@@
-742,6
+743,8
@@
uint64_t lttng_filter_interpret_bytecode(void *filter_data,
[ FILTER_OP_LOAD_FIELD_DOUBLE ] = &&LABEL_FILTER_OP_LOAD_FIELD_DOUBLE,
[ FILTER_OP_UNARY_BIT_NOT ] = &&LABEL_FILTER_OP_UNARY_BIT_NOT,
[ FILTER_OP_LOAD_FIELD_DOUBLE ] = &&LABEL_FILTER_OP_LOAD_FIELD_DOUBLE,
[ FILTER_OP_UNARY_BIT_NOT ] = &&LABEL_FILTER_OP_UNARY_BIT_NOT,
+
+ [ FILTER_OP_RETURN_S64 ] = &&LABEL_FILTER_OP_RETURN_S64,
};
#endif /* #ifndef INTERPRETER_USE_SWITCH */
};
#endif /* #ifndef INTERPRETER_USE_SWITCH */
@@
-774,6
+777,12
@@
uint64_t lttng_filter_interpret_bytecode(void *filter_data,
ret = 0;
goto end;
ret = 0;
goto end;
+ OP(FILTER_OP_RETURN_S64):
+ /* LTTNG_FILTER_DISCARD or LTTNG_FILTER_RECORD_FLAG */
+ retval = !!estack_ax_v;
+ ret = 0;
+ goto end;
+
/* binary */
OP(FILTER_OP_MUL):
OP(FILTER_OP_DIV):
/* binary */
OP(FILTER_OP_MUL):
OP(FILTER_OP_DIV):
@@
-1557,8
+1566,12
@@
uint64_t lttng_filter_interpret_bytecode(void *filter_data,
ret = -EINVAL;
goto end;
}
ret = -EINVAL;
goto end;
}
-
- res = (estack_bx_v >> estack_ax_v);
+ /* Catch undefined behavior. */
+ if (caa_unlikely(estack_ax_v < 0 || estack_ax_v >= 64)) {
+ ret = -EINVAL;
+ goto end;
+ }
+ res = ((uint64_t) estack_bx_v >> (uint32_t) estack_ax_v);
estack_pop(stack, top, ax, bx, ax_t, bx_t);
estack_ax_v = res;
estack_ax_t = REG_S64;
estack_pop(stack, top, ax, bx, ax_t, bx_t);
estack_ax_v = res;
estack_ax_t = REG_S64;
@@
-1574,8
+1587,12
@@
uint64_t lttng_filter_interpret_bytecode(void *filter_data,
ret = -EINVAL;
goto end;
}
ret = -EINVAL;
goto end;
}
-
- res = (estack_bx_v << estack_ax_v);
+ /* Catch undefined behavior. */
+ if (caa_unlikely(estack_ax_v < 0 || estack_ax_v >= 64)) {
+ ret = -EINVAL;
+ goto end;
+ }
+ res = ((uint64_t) estack_bx_v << (uint32_t) estack_ax_v);
estack_pop(stack, top, ax, bx, ax_t, bx_t);
estack_ax_v = res;
estack_ax_t = REG_S64;
estack_pop(stack, top, ax, bx, ax_t, bx_t);
estack_ax_v = res;
estack_ax_t = REG_S64;
@@
-1592,7
+1609,7
@@
uint64_t lttng_filter_interpret_bytecode(void *filter_data,
goto end;
}
goto end;
}
- res = (
estack_bx_v &
estack_ax_v);
+ res = (
(uint64_t) estack_bx_v & (uint64_t)
estack_ax_v);
estack_pop(stack, top, ax, bx, ax_t, bx_t);
estack_ax_v = res;
estack_ax_t = REG_S64;
estack_pop(stack, top, ax, bx, ax_t, bx_t);
estack_ax_v = res;
estack_ax_t = REG_S64;
@@
-1609,7
+1626,7
@@
uint64_t lttng_filter_interpret_bytecode(void *filter_data,
goto end;
}
goto end;
}
- res = (
estack_bx_v |
estack_ax_v);
+ res = (
(uint64_t) estack_bx_v | (uint64_t)
estack_ax_v);
estack_pop(stack, top, ax, bx, ax_t, bx_t);
estack_ax_v = res;
estack_ax_t = REG_S64;
estack_pop(stack, top, ax, bx, ax_t, bx_t);
estack_ax_v = res;
estack_ax_t = REG_S64;
@@
-1626,7
+1643,7
@@
uint64_t lttng_filter_interpret_bytecode(void *filter_data,
goto end;
}
goto end;
}
- res = (
estack_bx_v ^
estack_ax_v);
+ res = (
(uint64_t) estack_bx_v ^ (uint64_t)
estack_ax_v);
estack_pop(stack, top, ax, bx, ax_t, bx_t);
estack_ax_v = res;
estack_ax_t = REG_S64;
estack_pop(stack, top, ax, bx, ax_t, bx_t);
estack_ax_v = res;
estack_ax_t = REG_S64;
@@
-1703,7
+1720,7
@@
uint64_t lttng_filter_interpret_bytecode(void *filter_data,
goto end;
}
goto end;
}
- estack_ax_v = ~estack_ax_v;
+ estack_ax_v = ~
(uint64_t)
estack_ax_v;
next_pc += sizeof(struct unary_op);
PO;
}
next_pc += sizeof(struct unary_op);
PO;
}
This page took
0.027097 seconds
and
4
git commands to generate.