[ 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 */
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):
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;
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;
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;
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;
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;
goto end;
}
- estack_ax_v = ~estack_ax_v;
+ estack_ax_v = ~(uint64_t) estack_ax_v;
next_pc += sizeof(struct unary_op);
PO;
}