bytecode: add `REG_U64` interpreter register type
[lttng-modules.git] / src / lttng-filter-interpreter.c
index b38bc126ef1eb4e368b11c0a067b961eed8edddf..7c05c24f97786127fbdd8fffc94ae83fcbcd8c80 100644 (file)
@@ -8,7 +8,7 @@
  */
 
 #include <wrapper/uaccess.h>
-#include <wrapper/frame.h>
+#include <wrapper/objtool.h>
 #include <wrapper/types.h>
 #include <linux/swab.h>
 
@@ -81,16 +81,14 @@ static
 int stack_star_glob_match(struct estack *stack, int top, const char *cmp_type)
 {
        bool has_user = false;
-       mm_segment_t old_fs;
        int result;
        struct estack_entry *pattern_reg;
        struct estack_entry *candidate_reg;
 
+       /* Disable the page fault handler when reading from userspace. */
        if (estack_bx(stack, top)->u.s.user
                        || estack_ax(stack, top)->u.s.user) {
                has_user = true;
-               old_fs = get_fs();
-               set_fs(KERNEL_DS);
                pagefault_disable();
        }
 
@@ -106,10 +104,8 @@ int stack_star_glob_match(struct estack *stack, int top, const char *cmp_type)
        /* Perform the match operation. */
        result = !strutils_star_glob_match_char_cb(get_char_at_cb,
                pattern_reg, get_char_at_cb, candidate_reg);
-       if (has_user) {
+       if (has_user)
                pagefault_enable();
-               set_fs(old_fs);
-       }
 
        return result;
 }
@@ -119,13 +115,10 @@ int stack_strcmp(struct estack *stack, int top, const char *cmp_type)
 {
        size_t offset_bx = 0, offset_ax = 0;
        int diff, has_user = 0;
-       mm_segment_t old_fs;
 
        if (estack_bx(stack, top)->u.s.user
                        || estack_ax(stack, top)->u.s.user) {
                has_user = 1;
-               old_fs = get_fs();
-               set_fs(KERNEL_DS);
                pagefault_disable();
        }
 
@@ -210,10 +203,9 @@ int stack_strcmp(struct estack *stack, int top, const char *cmp_type)
                offset_bx++;
                offset_ax++;
        }
-       if (has_user) {
+       if (has_user)
                pagefault_enable();
-               set_fs(old_fs);
-       }
+
        return diff;
 }
 
@@ -270,6 +262,9 @@ LABEL_##name
 
 #endif
 
+#define IS_INTEGER_REGISTER(reg_type) \
+               (reg_type == REG_S64 || reg_type == REG_U64)
+
 static int context_get_index(struct lttng_probe_ctx *lttng_probe_ctx,
                struct load_ptr *ptr,
                uint32_t idx)
@@ -469,6 +464,7 @@ static int dynamic_load_field(struct estack_entry *stack_top)
        case OBJECT_TYPE_S8:
                dbg_printk("op load field s8\n");
                stack_top->u.v = *(int8_t *) stack_top->u.ptr.ptr;
+               stack_top->type = REG_S64;
                break;
        case OBJECT_TYPE_S16:
        {
@@ -479,6 +475,7 @@ static int dynamic_load_field(struct estack_entry *stack_top)
                if (stack_top->u.ptr.rev_bo)
                        __swab16s(&tmp);
                stack_top->u.v = tmp;
+               stack_top->type = REG_S64;
                break;
        }
        case OBJECT_TYPE_S32:
@@ -490,6 +487,7 @@ static int dynamic_load_field(struct estack_entry *stack_top)
                if (stack_top->u.ptr.rev_bo)
                        __swab32s(&tmp);
                stack_top->u.v = tmp;
+               stack_top->type = REG_S64;
                break;
        }
        case OBJECT_TYPE_S64:
@@ -501,11 +499,13 @@ static int dynamic_load_field(struct estack_entry *stack_top)
                if (stack_top->u.ptr.rev_bo)
                        __swab64s(&tmp);
                stack_top->u.v = tmp;
+               stack_top->type = REG_S64;
                break;
        }
        case OBJECT_TYPE_U8:
                dbg_printk("op load field u8\n");
                stack_top->u.v = *(uint8_t *) stack_top->u.ptr.ptr;
+               stack_top->type = REG_U64;
                break;
        case OBJECT_TYPE_U16:
        {
@@ -516,6 +516,7 @@ static int dynamic_load_field(struct estack_entry *stack_top)
                if (stack_top->u.ptr.rev_bo)
                        __swab16s(&tmp);
                stack_top->u.v = tmp;
+               stack_top->type = REG_U64;
                break;
        }
        case OBJECT_TYPE_U32:
@@ -527,6 +528,7 @@ static int dynamic_load_field(struct estack_entry *stack_top)
                if (stack_top->u.ptr.rev_bo)
                        __swab32s(&tmp);
                stack_top->u.v = tmp;
+               stack_top->type = REG_U64;
                break;
        }
        case OBJECT_TYPE_U64:
@@ -538,6 +540,7 @@ static int dynamic_load_field(struct estack_entry *stack_top)
                if (stack_top->u.ptr.rev_bo)
                        __swab64s(&tmp);
                stack_top->u.v = tmp;
+               stack_top->type = REG_U64;
                break;
        }
        case OBJECT_TYPE_STRING:
@@ -555,6 +558,7 @@ static int dynamic_load_field(struct estack_entry *stack_top)
                stack_top->u.s.seq_len = LTTNG_SIZE_MAX;
                stack_top->u.s.literal_type =
                        ESTACK_STRING_LITERAL_TYPE_NONE;
+               stack_top->type = REG_STRING;
                break;
        }
        case OBJECT_TYPE_STRING_SEQUENCE:
@@ -572,6 +576,7 @@ static int dynamic_load_field(struct estack_entry *stack_top)
                }
                stack_top->u.s.literal_type =
                        ESTACK_STRING_LITERAL_TYPE_NONE;
+               stack_top->type = REG_STRING;
                break;
        }
        case OBJECT_TYPE_DYNAMIC:
@@ -614,6 +619,7 @@ uint64_t lttng_filter_interpret_bytecode(void *filter_data,
        struct estack _stack;
        struct estack *stack = &_stack;
        register int64_t ax = 0, bx = 0;
+       register enum entry_type ax_t = REG_TYPE_UNKNOWN, bx_t = REG_TYPE_UNKNOWN;
        register int top = FILTER_STACK_EMPTY;
 #ifndef INTERPRETER_USE_SWITCH
        static void *dispatch[NR_FILTER_OPS] = {
@@ -772,7 +778,19 @@ uint64_t lttng_filter_interpret_bytecode(void *filter_data,
                OP(FILTER_OP_RETURN):
                OP(FILTER_OP_RETURN_S64):
                        /* LTTNG_FILTER_DISCARD or LTTNG_FILTER_RECORD_FLAG */
-                       retval = !!estack_ax_v;
+                       switch (estack_ax_t) {
+                       case REG_S64:
+                       case REG_U64:
+                               retval = !!estack_ax_v;
+                               break;
+                       case REG_DOUBLE:
+                       case REG_STRING:
+                       case REG_PTR:
+                       case REG_STAR_GLOB_STRING:
+                       case REG_TYPE_UNKNOWN:
+                               ret = -EINVAL;
+                               goto end;
+                       }
                        ret = 0;
                        goto end;
 
@@ -803,8 +821,9 @@ uint64_t lttng_filter_interpret_bytecode(void *filter_data,
                        int res;
 
                        res = (stack_strcmp(stack, top, "==") == 0);
-                       estack_pop(stack, top, ax, bx);
+                       estack_pop(stack, top, ax, bx, ax_t, bx_t);
                        estack_ax_v = res;
+                       estack_ax_t = REG_S64;
                        next_pc += sizeof(struct binary_op);
                        PO;
                }
@@ -813,8 +832,9 @@ uint64_t lttng_filter_interpret_bytecode(void *filter_data,
                        int res;
 
                        res = (stack_strcmp(stack, top, "!=") != 0);
-                       estack_pop(stack, top, ax, bx);
+                       estack_pop(stack, top, ax, bx, ax_t, bx_t);
                        estack_ax_v = res;
+                       estack_ax_t = REG_S64;
                        next_pc += sizeof(struct binary_op);
                        PO;
                }
@@ -823,8 +843,9 @@ uint64_t lttng_filter_interpret_bytecode(void *filter_data,
                        int res;
 
                        res = (stack_strcmp(stack, top, ">") > 0);
-                       estack_pop(stack, top, ax, bx);
+                       estack_pop(stack, top, ax, bx, ax_t, bx_t);
                        estack_ax_v = res;
+                       estack_ax_t = REG_S64;
                        next_pc += sizeof(struct binary_op);
                        PO;
                }
@@ -833,8 +854,9 @@ uint64_t lttng_filter_interpret_bytecode(void *filter_data,
                        int res;
 
                        res = (stack_strcmp(stack, top, "<") < 0);
-                       estack_pop(stack, top, ax, bx);
+                       estack_pop(stack, top, ax, bx, ax_t, bx_t);
                        estack_ax_v = res;
+                       estack_ax_t = REG_S64;
                        next_pc += sizeof(struct binary_op);
                        PO;
                }
@@ -843,8 +865,9 @@ uint64_t lttng_filter_interpret_bytecode(void *filter_data,
                        int res;
 
                        res = (stack_strcmp(stack, top, ">=") >= 0);
-                       estack_pop(stack, top, ax, bx);
+                       estack_pop(stack, top, ax, bx, ax_t, bx_t);
                        estack_ax_v = res;
+                       estack_ax_t = REG_S64;
                        next_pc += sizeof(struct binary_op);
                        PO;
                }
@@ -853,8 +876,9 @@ uint64_t lttng_filter_interpret_bytecode(void *filter_data,
                        int res;
 
                        res = (stack_strcmp(stack, top, "<=") <= 0);
-                       estack_pop(stack, top, ax, bx);
+                       estack_pop(stack, top, ax, bx, ax_t, bx_t);
                        estack_ax_v = res;
+                       estack_ax_t = REG_S64;
                        next_pc += sizeof(struct binary_op);
                        PO;
                }
@@ -864,8 +888,9 @@ uint64_t lttng_filter_interpret_bytecode(void *filter_data,
                        int res;
 
                        res = (stack_star_glob_match(stack, top, "==") == 0);
-                       estack_pop(stack, top, ax, bx);
+                       estack_pop(stack, top, ax, bx, ax_t, bx_t);
                        estack_ax_v = res;
+                       estack_ax_t = REG_S64;
                        next_pc += sizeof(struct binary_op);
                        PO;
                }
@@ -874,8 +899,9 @@ uint64_t lttng_filter_interpret_bytecode(void *filter_data,
                        int res;
 
                        res = (stack_star_glob_match(stack, top, "!=") != 0);
-                       estack_pop(stack, top, ax, bx);
+                       estack_pop(stack, top, ax, bx, ax_t, bx_t);
                        estack_ax_v = res;
+                       estack_ax_t = REG_S64;
                        next_pc += sizeof(struct binary_op);
                        PO;
                }
@@ -885,8 +911,9 @@ uint64_t lttng_filter_interpret_bytecode(void *filter_data,
                        int res;
 
                        res = (estack_bx_v == estack_ax_v);
-                       estack_pop(stack, top, ax, bx);
+                       estack_pop(stack, top, ax, bx, ax_t, bx_t);
                        estack_ax_v = res;
+                       estack_ax_t = REG_S64;
                        next_pc += sizeof(struct binary_op);
                        PO;
                }
@@ -895,8 +922,9 @@ uint64_t lttng_filter_interpret_bytecode(void *filter_data,
                        int res;
 
                        res = (estack_bx_v != estack_ax_v);
-                       estack_pop(stack, top, ax, bx);
+                       estack_pop(stack, top, ax, bx, ax_t, bx_t);
                        estack_ax_v = res;
+                       estack_ax_t = REG_S64;
                        next_pc += sizeof(struct binary_op);
                        PO;
                }
@@ -905,8 +933,9 @@ uint64_t lttng_filter_interpret_bytecode(void *filter_data,
                        int res;
 
                        res = (estack_bx_v > estack_ax_v);
-                       estack_pop(stack, top, ax, bx);
+                       estack_pop(stack, top, ax, bx, ax_t, bx_t);
                        estack_ax_v = res;
+                       estack_ax_t = REG_S64;
                        next_pc += sizeof(struct binary_op);
                        PO;
                }
@@ -915,8 +944,9 @@ uint64_t lttng_filter_interpret_bytecode(void *filter_data,
                        int res;
 
                        res = (estack_bx_v < estack_ax_v);
-                       estack_pop(stack, top, ax, bx);
+                       estack_pop(stack, top, ax, bx, ax_t, bx_t);
                        estack_ax_v = res;
+                       estack_ax_t = REG_S64;
                        next_pc += sizeof(struct binary_op);
                        PO;
                }
@@ -925,8 +955,9 @@ uint64_t lttng_filter_interpret_bytecode(void *filter_data,
                        int res;
 
                        res = (estack_bx_v >= estack_ax_v);
-                       estack_pop(stack, top, ax, bx);
+                       estack_pop(stack, top, ax, bx, ax_t, bx_t);
                        estack_ax_v = res;
+                       estack_ax_t = REG_S64;
                        next_pc += sizeof(struct binary_op);
                        PO;
                }
@@ -935,8 +966,9 @@ uint64_t lttng_filter_interpret_bytecode(void *filter_data,
                        int res;
 
                        res = (estack_bx_v <= estack_ax_v);
-                       estack_pop(stack, top, ax, bx);
+                       estack_pop(stack, top, ax, bx, ax_t, bx_t);
                        estack_ax_v = res;
+                       estack_ax_t = REG_S64;
                        next_pc += sizeof(struct binary_op);
                        PO;
                }
@@ -973,14 +1005,20 @@ uint64_t lttng_filter_interpret_bytecode(void *filter_data,
                {
                        int64_t res;
 
+                       if (!IS_INTEGER_REGISTER(estack_ax_t) || !IS_INTEGER_REGISTER(estack_bx_t)) {
+                               ret = -EINVAL;
+                               goto end;
+                       }
+
                        /* Catch undefined behavior. */
                        if (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);
+                       estack_pop(stack, top, ax, bx, ax_t, bx_t);
                        estack_ax_v = res;
+                       estack_ax_t = REG_U64;
                        next_pc += sizeof(struct binary_op);
                        PO;
                }
@@ -988,14 +1026,20 @@ uint64_t lttng_filter_interpret_bytecode(void *filter_data,
                {
                        int64_t res;
 
+                       if (!IS_INTEGER_REGISTER(estack_ax_t) || !IS_INTEGER_REGISTER(estack_bx_t)) {
+                               ret = -EINVAL;
+                               goto end;
+                       }
+
                        /* Catch undefined behavior. */
                        if (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);
+                       estack_pop(stack, top, ax, bx, ax_t, bx_t);
                        estack_ax_v = res;
+                       estack_ax_t = REG_U64;
                        next_pc += sizeof(struct binary_op);
                        PO;
                }
@@ -1003,9 +1047,15 @@ uint64_t lttng_filter_interpret_bytecode(void *filter_data,
                {
                        int64_t res;
 
+                       if (!IS_INTEGER_REGISTER(estack_ax_t) || !IS_INTEGER_REGISTER(estack_bx_t)) {
+                               ret = -EINVAL;
+                               goto end;
+                       }
+
                        res = ((uint64_t) estack_bx_v & (uint64_t) estack_ax_v);
-                       estack_pop(stack, top, ax, bx);
+                       estack_pop(stack, top, ax, bx, ax_t, bx_t);
                        estack_ax_v = res;
+                       estack_ax_t = REG_U64;
                        next_pc += sizeof(struct binary_op);
                        PO;
                }
@@ -1013,9 +1063,15 @@ uint64_t lttng_filter_interpret_bytecode(void *filter_data,
                {
                        int64_t res;
 
+                       if (!IS_INTEGER_REGISTER(estack_ax_t) || !IS_INTEGER_REGISTER(estack_bx_t)) {
+                               ret = -EINVAL;
+                               goto end;
+                       }
+
                        res = ((uint64_t) estack_bx_v | (uint64_t) estack_ax_v);
-                       estack_pop(stack, top, ax, bx);
+                       estack_pop(stack, top, ax, bx, ax_t, bx_t);
                        estack_ax_v = res;
+                       estack_ax_t = REG_U64;
                        next_pc += sizeof(struct binary_op);
                        PO;
                }
@@ -1023,9 +1079,15 @@ uint64_t lttng_filter_interpret_bytecode(void *filter_data,
                {
                        int64_t res;
 
+                       if (!IS_INTEGER_REGISTER(estack_ax_t) || !IS_INTEGER_REGISTER(estack_bx_t)) {
+                               ret = -EINVAL;
+                               goto end;
+                       }
+
                        res = ((uint64_t) estack_bx_v ^ (uint64_t) estack_ax_v);
-                       estack_pop(stack, top, ax, bx);
+                       estack_pop(stack, top, ax, bx, ax_t, bx_t);
                        estack_ax_v = res;
+                       estack_ax_t = REG_U64;
                        next_pc += sizeof(struct binary_op);
                        PO;
                }
@@ -1043,6 +1105,7 @@ uint64_t lttng_filter_interpret_bytecode(void *filter_data,
                OP(FILTER_OP_UNARY_BIT_NOT):
                {
                        estack_ax_v = ~(uint64_t) estack_ax_v;
+                       estack_ax_t = REG_S64;
                        next_pc += sizeof(struct unary_op);
                        PO;
                }
@@ -1055,6 +1118,7 @@ uint64_t lttng_filter_interpret_bytecode(void *filter_data,
                OP(FILTER_OP_UNARY_MINUS_S64):
                {
                        estack_ax_v = -estack_ax_v;
+                       estack_ax_t = REG_S64;
                        next_pc += sizeof(struct unary_op);
                        PO;
                }
@@ -1067,6 +1131,7 @@ uint64_t lttng_filter_interpret_bytecode(void *filter_data,
                OP(FILTER_OP_UNARY_NOT_S64):
                {
                        estack_ax_v = !estack_ax_v;
+                       estack_ax_t = REG_S64;
                        next_pc += sizeof(struct unary_op);
                        PO;
                }
@@ -1088,7 +1153,7 @@ uint64_t lttng_filter_interpret_bytecode(void *filter_data,
                                next_pc = start_pc + insn->skip_offset;
                        } else {
                                /* Pop 1 when jump not taken */
-                               estack_pop(stack, top, ax, bx);
+                               estack_pop(stack, top, ax, bx, ax_t, bx_t);
                                next_pc += sizeof(struct logical_op);
                        }
                        PO;
@@ -1106,7 +1171,7 @@ uint64_t lttng_filter_interpret_bytecode(void *filter_data,
                                next_pc = start_pc + insn->skip_offset;
                        } else {
                                /* Pop 1 when jump not taken */
-                               estack_pop(stack, top, ax, bx);
+                               estack_pop(stack, top, ax, bx, ax_t, bx_t);
                                next_pc += sizeof(struct logical_op);
                        }
                        PO;
@@ -1121,7 +1186,7 @@ uint64_t lttng_filter_interpret_bytecode(void *filter_data,
 
                        dbg_printk("load field ref offset %u type string\n",
                                ref->offset);
-                       estack_push(stack, top, ax, bx);
+                       estack_push(stack, top, ax, bx, ax_t, bx_t);
                        estack_ax(stack, top)->u.s.str =
                                *(const char * const *) &filter_stack_data[ref->offset];
                        if (unlikely(!estack_ax(stack, top)->u.s.str)) {
@@ -1133,6 +1198,7 @@ uint64_t lttng_filter_interpret_bytecode(void *filter_data,
                        estack_ax(stack, top)->u.s.literal_type =
                                ESTACK_STRING_LITERAL_TYPE_NONE;
                        estack_ax(stack, top)->u.s.user = 0;
+                       estack_ax(stack, top)->type = REG_STRING;
                        dbg_printk("ref load string %s\n", estack_ax(stack, top)->u.s.str);
                        next_pc += sizeof(struct load_op) + sizeof(struct field_ref);
                        PO;
@@ -1145,7 +1211,7 @@ uint64_t lttng_filter_interpret_bytecode(void *filter_data,
 
                        dbg_printk("load field ref offset %u type sequence\n",
                                ref->offset);
-                       estack_push(stack, top, ax, bx);
+                       estack_push(stack, top, ax, bx, ax_t, bx_t);
                        estack_ax(stack, top)->u.s.seq_len =
                                *(unsigned long *) &filter_stack_data[ref->offset];
                        estack_ax(stack, top)->u.s.str =
@@ -1170,9 +1236,10 @@ uint64_t lttng_filter_interpret_bytecode(void *filter_data,
 
                        dbg_printk("load field ref offset %u type s64\n",
                                ref->offset);
-                       estack_push(stack, top, ax, bx);
+                       estack_push(stack, top, ax, bx, ax_t, bx_t);
                        estack_ax_v =
                                ((struct literal_numeric *) &filter_stack_data[ref->offset])->v;
+                       estack_ax_t = REG_S64;
                        dbg_printk("ref load s64 %lld\n",
                                (long long) estack_ax_v);
                        next_pc += sizeof(struct load_op) + sizeof(struct field_ref);
@@ -1191,7 +1258,7 @@ uint64_t lttng_filter_interpret_bytecode(void *filter_data,
                        struct load_op *insn = (struct load_op *) pc;
 
                        dbg_printk("load string %s\n", insn->data);
-                       estack_push(stack, top, ax, bx);
+                       estack_push(stack, top, ax, bx, ax_t, bx_t);
                        estack_ax(stack, top)->u.s.str = insn->data;
                        estack_ax(stack, top)->u.s.seq_len = LTTNG_SIZE_MAX;
                        estack_ax(stack, top)->u.s.literal_type =
@@ -1206,7 +1273,7 @@ uint64_t lttng_filter_interpret_bytecode(void *filter_data,
                        struct load_op *insn = (struct load_op *) pc;
 
                        dbg_printk("load globbing pattern %s\n", insn->data);
-                       estack_push(stack, top, ax, bx);
+                       estack_push(stack, top, ax, bx, ax_t, bx_t);
                        estack_ax(stack, top)->u.s.str = insn->data;
                        estack_ax(stack, top)->u.s.seq_len = LTTNG_SIZE_MAX;
                        estack_ax(stack, top)->u.s.literal_type =
@@ -1220,8 +1287,9 @@ uint64_t lttng_filter_interpret_bytecode(void *filter_data,
                {
                        struct load_op *insn = (struct load_op *) pc;
 
-                       estack_push(stack, top, ax, bx);
+                       estack_push(stack, top, ax, bx, ax_t, bx_t);
                        estack_ax_v = ((struct literal_numeric *) insn->data)->v;
+                       estack_ax_t = REG_S64;
                        dbg_printk("load s64 %lld\n",
                                (long long) estack_ax_v);
                        next_pc += sizeof(struct load_op)
@@ -1266,7 +1334,7 @@ uint64_t lttng_filter_interpret_bytecode(void *filter_data,
                                ref->offset);
                        ctx_field = &lttng_static_ctx->fields[ref->offset];
                        ctx_field->get_value(ctx_field, lttng_probe_ctx, &v);
-                       estack_push(stack, top, ax, bx);
+                       estack_push(stack, top, ax, bx, ax_t, bx_t);
                        estack_ax(stack, top)->u.s.str = v.str;
                        if (unlikely(!estack_ax(stack, top)->u.s.str)) {
                                dbg_printk("Filter warning: loading a NULL string.\n");
@@ -1277,6 +1345,7 @@ uint64_t lttng_filter_interpret_bytecode(void *filter_data,
                        estack_ax(stack, top)->u.s.literal_type =
                                ESTACK_STRING_LITERAL_TYPE_NONE;
                        estack_ax(stack, top)->u.s.user = 0;
+                       estack_ax(stack, top)->type = REG_STRING;
                        dbg_printk("ref get context string %s\n", estack_ax(stack, top)->u.s.str);
                        next_pc += sizeof(struct load_op) + sizeof(struct field_ref);
                        PO;
@@ -1293,8 +1362,9 @@ uint64_t lttng_filter_interpret_bytecode(void *filter_data,
                                ref->offset);
                        ctx_field = &lttng_static_ctx->fields[ref->offset];
                        ctx_field->get_value(ctx_field, lttng_probe_ctx, &v);
-                       estack_push(stack, top, ax, bx);
+                       estack_push(stack, top, ax, bx, ax_t, bx_t);
                        estack_ax_v = v.s64;
+                       estack_ax_t = REG_S64;
                        dbg_printk("ref get context s64 %lld\n",
                                (long long) estack_ax_v);
                        next_pc += sizeof(struct load_op) + sizeof(struct field_ref);
@@ -1315,7 +1385,7 @@ uint64_t lttng_filter_interpret_bytecode(void *filter_data,
 
                        dbg_printk("load field ref offset %u type user string\n",
                                ref->offset);
-                       estack_push(stack, top, ax, bx);
+                       estack_push(stack, top, ax, bx, ax_t, bx_t);
                        estack_ax(stack, top)->u.s.user_str =
                                *(const char * const *) &filter_stack_data[ref->offset];
                        if (unlikely(!estack_ax(stack, top)->u.s.str)) {
@@ -1327,6 +1397,7 @@ uint64_t lttng_filter_interpret_bytecode(void *filter_data,
                        estack_ax(stack, top)->u.s.literal_type =
                                ESTACK_STRING_LITERAL_TYPE_NONE;
                        estack_ax(stack, top)->u.s.user = 1;
+                       estack_ax(stack, top)->type = REG_STRING;
                        dbg_printk("ref load string %s\n", estack_ax(stack, top)->u.s.str);
                        next_pc += sizeof(struct load_op) + sizeof(struct field_ref);
                        PO;
@@ -1339,7 +1410,7 @@ uint64_t lttng_filter_interpret_bytecode(void *filter_data,
 
                        dbg_printk("load field ref offset %u type user sequence\n",
                                ref->offset);
-                       estack_push(stack, top, ax, bx);
+                       estack_push(stack, top, ax, bx, ax_t, bx_t);
                        estack_ax(stack, top)->u.s.seq_len =
                                *(unsigned long *) &filter_stack_data[ref->offset];
                        estack_ax(stack, top)->u.s.user_str =
@@ -1360,10 +1431,11 @@ uint64_t lttng_filter_interpret_bytecode(void *filter_data,
                OP(FILTER_OP_GET_CONTEXT_ROOT):
                {
                        dbg_printk("op get context root\n");
-                       estack_push(stack, top, ax, bx);
+                       estack_push(stack, top, ax, bx, ax_t, bx_t);
                        estack_ax(stack, top)->u.ptr.type = LOAD_ROOT_CONTEXT;
                        /* "field" only needed for variants. */
                        estack_ax(stack, top)->u.ptr.field = NULL;
+                       estack_ax(stack, top)->type = REG_PTR;
                        next_pc += sizeof(struct load_op);
                        PO;
                }
@@ -1377,11 +1449,12 @@ uint64_t lttng_filter_interpret_bytecode(void *filter_data,
                OP(FILTER_OP_GET_PAYLOAD_ROOT):
                {
                        dbg_printk("op get app payload root\n");
-                       estack_push(stack, top, ax, bx);
+                       estack_push(stack, top, ax, bx, ax_t, bx_t);
                        estack_ax(stack, top)->u.ptr.type = LOAD_ROOT_PAYLOAD;
                        estack_ax(stack, top)->u.ptr.ptr = filter_stack_data;
                        /* "field" only needed for variants. */
                        estack_ax(stack, top)->u.ptr.field = NULL;
+                       estack_ax(stack, top)->type = REG_PTR;
                        next_pc += sizeof(struct load_op);
                        PO;
                }
@@ -1428,6 +1501,7 @@ uint64_t lttng_filter_interpret_bytecode(void *filter_data,
                        if (ret)
                                goto end;
                        estack_ax_v = estack_ax(stack, top)->u.v;
+                       estack_ax_t = estack_ax(stack, top)->type;
                        next_pc += sizeof(struct load_op) + sizeof(struct get_index_u16);
                        PO;
                }
@@ -1442,6 +1516,7 @@ uint64_t lttng_filter_interpret_bytecode(void *filter_data,
                        if (ret)
                                goto end;
                        estack_ax_v = estack_ax(stack, top)->u.v;
+                       estack_ax_t = estack_ax(stack, top)->type;
                        next_pc += sizeof(struct load_op) + sizeof(struct get_index_u64);
                        PO;
                }
@@ -1453,6 +1528,7 @@ uint64_t lttng_filter_interpret_bytecode(void *filter_data,
                        if (ret)
                                goto end;
                        estack_ax_v = estack_ax(stack, top)->u.v;
+                       estack_ax_t = estack_ax(stack, top)->type;
                        next_pc += sizeof(struct load_op);
                        PO;
                }
@@ -1462,6 +1538,7 @@ uint64_t lttng_filter_interpret_bytecode(void *filter_data,
                        dbg_printk("op load field s8\n");
 
                        estack_ax_v = *(int8_t *) estack_ax(stack, top)->u.ptr.ptr;
+                       estack_ax_t = REG_S64;
                        next_pc += sizeof(struct load_op);
                        PO;
                }
@@ -1470,6 +1547,7 @@ uint64_t lttng_filter_interpret_bytecode(void *filter_data,
                        dbg_printk("op load field s16\n");
 
                        estack_ax_v = *(int16_t *) estack_ax(stack, top)->u.ptr.ptr;
+                       estack_ax_t = REG_S64;
                        next_pc += sizeof(struct load_op);
                        PO;
                }
@@ -1478,6 +1556,7 @@ uint64_t lttng_filter_interpret_bytecode(void *filter_data,
                        dbg_printk("op load field s32\n");
 
                        estack_ax_v = *(int32_t *) estack_ax(stack, top)->u.ptr.ptr;
+                       estack_ax_t = REG_S64;
                        next_pc += sizeof(struct load_op);
                        PO;
                }
@@ -1486,6 +1565,7 @@ uint64_t lttng_filter_interpret_bytecode(void *filter_data,
                        dbg_printk("op load field s64\n");
 
                        estack_ax_v = *(int64_t *) estack_ax(stack, top)->u.ptr.ptr;
+                       estack_ax_t = REG_S64;
                        next_pc += sizeof(struct load_op);
                        PO;
                }
@@ -1494,6 +1574,7 @@ uint64_t lttng_filter_interpret_bytecode(void *filter_data,
                        dbg_printk("op load field u8\n");
 
                        estack_ax_v = *(uint8_t *) estack_ax(stack, top)->u.ptr.ptr;
+                       estack_ax_t = REG_S64;
                        next_pc += sizeof(struct load_op);
                        PO;
                }
@@ -1502,6 +1583,7 @@ uint64_t lttng_filter_interpret_bytecode(void *filter_data,
                        dbg_printk("op load field u16\n");
 
                        estack_ax_v = *(uint16_t *) estack_ax(stack, top)->u.ptr.ptr;
+                       estack_ax_t = REG_S64;
                        next_pc += sizeof(struct load_op);
                        PO;
                }
@@ -1510,6 +1592,7 @@ uint64_t lttng_filter_interpret_bytecode(void *filter_data,
                        dbg_printk("op load field u32\n");
 
                        estack_ax_v = *(uint32_t *) estack_ax(stack, top)->u.ptr.ptr;
+                       estack_ax_t = REG_S64;
                        next_pc += sizeof(struct load_op);
                        PO;
                }
@@ -1518,6 +1601,7 @@ uint64_t lttng_filter_interpret_bytecode(void *filter_data,
                        dbg_printk("op load field u64\n");
 
                        estack_ax_v = *(uint64_t *) estack_ax(stack, top)->u.ptr.ptr;
+                       estack_ax_t = REG_S64;
                        next_pc += sizeof(struct load_op);
                        PO;
                }
@@ -1542,6 +1626,7 @@ uint64_t lttng_filter_interpret_bytecode(void *filter_data,
                        estack_ax(stack, top)->u.s.seq_len = LTTNG_SIZE_MAX;
                        estack_ax(stack, top)->u.s.literal_type =
                                ESTACK_STRING_LITERAL_TYPE_NONE;
+                       estack_ax(stack, top)->type = REG_STRING;
                        next_pc += sizeof(struct load_op);
                        PO;
                }
@@ -1561,6 +1646,7 @@ uint64_t lttng_filter_interpret_bytecode(void *filter_data,
                        }
                        estack_ax(stack, top)->u.s.literal_type =
                                ESTACK_STRING_LITERAL_TYPE_NONE;
+                       estack_ax(stack, top)->type = REG_STRING;
                        next_pc += sizeof(struct load_op);
                        PO;
                }
This page took 0.033641 seconds and 4 git commands to generate.