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();
}
/* 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;
}
{
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();
}
offset_bx++;
offset_ax++;
}
- if (has_user) {
+ if (has_user)
pagefault_enable();
- set_fs(old_fs);
- }
+
return diff;
}
struct lttng_probe_ctx *lttng_probe_ctx,
const char *filter_stack_data)
{
- return 0;
+ return LTTNG_FILTER_DISCARD;
}
#ifdef INTERPRETER_USE_SWITCH
start_pc = &bytecode->data[0]; \
for (pc = next_pc = start_pc; pc - start_pc < bytecode->len; \
pc = next_pc) { \
- dbg_printk("Executing op %s (%u)\n", \
+ dbg_printk("LTTng: Executing op %s (%u)\n", \
lttng_filter_print_op((unsigned int) *(filter_opcode_t *) pc), \
(unsigned int) *(filter_opcode_t *) pc); \
switch (*(filter_opcode_t *) pc) {
}
case atype_array_nestable:
if (!lttng_is_bytewise_integer(field->type.u.array_nestable.elem_type)) {
- printk(KERN_WARNING "Array nesting only supports integer types.\n");
+ printk(KERN_WARNING "LTTng: filter: Array nesting only supports integer types.\n");
return -EINVAL;
}
if (field->type.u.array_nestable.elem_type->u.integer.encoding == lttng_encode_none) {
- printk(KERN_WARNING "Only string arrays are supported for contexts.\n");
+ printk(KERN_WARNING "LTTng: filter: Only string arrays are supported for contexts.\n");
return -EINVAL;
}
ptr->object_type = OBJECT_TYPE_STRING;
break;
case atype_sequence_nestable:
if (!lttng_is_bytewise_integer(field->type.u.sequence_nestable.elem_type)) {
- printk(KERN_WARNING "Sequence nesting only supports integer types.\n");
+ printk(KERN_WARNING "LTTng: filter: Sequence nesting only supports integer types.\n");
return -EINVAL;
}
if (field->type.u.sequence_nestable.elem_type->u.integer.encoding == lttng_encode_none) {
- printk(KERN_WARNING "Only string sequences are supported for contexts.\n");
+ printk(KERN_WARNING "LTTng: filter: Only string sequences are supported for contexts.\n");
return -EINVAL;
}
ptr->object_type = OBJECT_TYPE_STRING;
ptr->ptr = v.str;
break;
case atype_struct_nestable:
- printk(KERN_WARNING "Structure type cannot be loaded.\n");
+ printk(KERN_WARNING "LTTng: filter: Structure type cannot be loaded.\n");
return -EINVAL;
case atype_variant_nestable:
- printk(KERN_WARNING "Variant type cannot be loaded.\n");
+ printk(KERN_WARNING "LTTng: filter: Variant type cannot be loaded.\n");
return -EINVAL;
default:
- printk(KERN_WARNING "Unknown type: %d", (int) field->type.atype);
+ printk(KERN_WARNING "LTTng: filter: Unknown type: %d", (int) field->type.atype);
return -EINVAL;
}
return 0;
break;
}
case OBJECT_TYPE_STRUCT:
- printk(KERN_WARNING "Nested structures are not supported yet.\n");
+ printk(KERN_WARNING "LTTng: filter: Nested structures are not supported yet.\n");
ret = -EINVAL;
goto end;
case OBJECT_TYPE_VARIANT:
default:
- printk(KERN_WARNING "Unexpected get index type %d",
+ printk(KERN_WARNING "LTTng: filter: Unexpected get index type %d",
(int) stack_top->u.ptr.object_type);
ret = -EINVAL;
goto end;
case OBJECT_TYPE_ARRAY:
case OBJECT_TYPE_STRUCT:
case OBJECT_TYPE_VARIANT:
- printk(KERN_WARNING "Sequences, arrays, struct and variant cannot be loaded (nested types).\n");
+ printk(KERN_WARNING "LTTng: filter: Sequences, arrays, struct and variant cannot be loaded (nested types).\n");
ret = -EINVAL;
goto end;
}
#ifdef INTERPRETER_USE_SWITCH
default:
#endif /* INTERPRETER_USE_SWITCH */
- printk(KERN_WARNING "unknown bytecode op %u\n",
+ printk(KERN_WARNING "LTTng: filter: unknown bytecode op %u\n",
(unsigned int) *(filter_opcode_t *) pc);
ret = -EINVAL;
goto end;
OP(FILTER_OP_RETURN):
OP(FILTER_OP_RETURN_S64):
- /* LTTNG_FILTER_DISCARD or LTTNG_FILTER_RECORD_FLAG */
+ /* LTTNG_FILTER_DISCARD or LTTNG_FILTER_RECORD_FLAG */
retval = !!estack_ax_v;
ret = 0;
goto end;
OP(FILTER_OP_MOD):
OP(FILTER_OP_PLUS):
OP(FILTER_OP_MINUS):
- printk(KERN_WARNING "unsupported bytecode op %u\n",
+ printk(KERN_WARNING "LTTng: filter: unsupported bytecode op %u\n",
(unsigned int) *(filter_opcode_t *) pc);
ret = -EINVAL;
goto end;
OP(FILTER_OP_LT):
OP(FILTER_OP_GE):
OP(FILTER_OP_LE):
- printk(KERN_WARNING "unsupported non-specialized bytecode op %u\n",
+ printk(KERN_WARNING "LTTng: filter: unsupported non-specialized bytecode op %u\n",
(unsigned int) *(filter_opcode_t *) pc);
ret = -EINVAL;
goto end;
OP(FILTER_OP_UNARY_PLUS):
OP(FILTER_OP_UNARY_MINUS):
OP(FILTER_OP_UNARY_NOT):
- printk(KERN_WARNING "unsupported non-specialized bytecode op %u\n",
+ printk(KERN_WARNING "LTTng: filter: unsupported non-specialized bytecode op %u\n",
(unsigned int) *(filter_opcode_t *) pc);
ret = -EINVAL;
goto end;
/* cast */
OP(FILTER_OP_CAST_TO_S64):
- printk(KERN_WARNING "unsupported non-specialized bytecode op %u\n",
+ printk(KERN_WARNING "LTTng: filter: unsupported non-specialized bytecode op %u\n",
(unsigned int) *(filter_opcode_t *) pc);
ret = -EINVAL;
goto end;
dbg_printk("op get symbol\n");
switch (estack_ax(stack, top)->u.ptr.type) {
case LOAD_OBJECT:
- printk(KERN_WARNING "Nested fields not implemented yet.\n");
+ printk(KERN_WARNING "LTTng: filter: Nested fields not implemented yet.\n");
ret = -EINVAL;
goto end;
case LOAD_ROOT_CONTEXT:
END_OP
end:
- /* return 0 (discard) on error */
+ /* Return _DISCARD on error. */
if (ret)
- return 0;
+ return LTTNG_FILTER_DISCARD;
return retval;
}