callstack context: use delimiter when stack is incomplete
[lttng-modules.git] / lttng-filter-validator.c
index c7b81bb6bbd193187434bd5f2b5f21a48f3fff7a..a4ca777563fa9ca13e85281500b1f3db17de4d4f 100644 (file)
@@ -303,6 +303,7 @@ int bytecode_validate_overflow(struct bytecode_runtime *bytecode,
        }
 
        case FILTER_OP_RETURN:
+       case FILTER_OP_RETURN_S64:
        {
                if (unlikely(pc + sizeof(struct return_op)
                                > start_pc + bytecode->len)) {
@@ -513,6 +514,7 @@ int bytecode_validate_overflow(struct bytecode_runtime *bytecode,
                if (unlikely(pc + sizeof(struct load_op) + sizeof(struct get_symbol)
                                > start_pc + bytecode->len)) {
                        ret = -ERANGE;
+                       break;
                }
                ret = validate_get_symbol(bytecode, sym);
                break;
@@ -586,6 +588,7 @@ int validate_instruction_context(struct bytecode_runtime *bytecode,
        }
 
        case FILTER_OP_RETURN:
+       case FILTER_OP_RETURN_S64:
        {
                goto end;
        }
@@ -1183,6 +1186,28 @@ int exec_insn(struct bytecode_runtime *bytecode,
                goto end;
        }
 
+       case FILTER_OP_RETURN_S64:
+       {
+               if (!vstack_ax(stack)) {
+                       printk(KERN_WARNING "Empty stack\n");
+                       ret = -EINVAL;
+                       goto end;
+               }
+               switch (vstack_ax(stack)->type) {
+               case REG_S64:
+                       break;
+               default:
+               case REG_TYPE_UNKNOWN:
+                       printk(KERN_WARNING "Unexpected register type %d at end of bytecode\n",
+                               (int) vstack_ax(stack)->type);
+                       ret = -EINVAL;
+                       goto end;
+               }
+
+               ret = 0;
+               goto end;
+       }
+
        /* binary */
        case FILTER_OP_MUL:
        case FILTER_OP_DIV:
This page took 0.024023 seconds and 4 git commands to generate.