Document last supported kernel version for stable-2.10 branch
[lttng-modules.git] / lttng-filter-interpreter.c
index a09b04175af0c6dc996d297c7bf0af5d93392858..174f2b804f58fda409a477b657d884eb4d92c1d3 100644 (file)
@@ -24,8 +24,9 @@
  * SOFTWARE.
  */
 
-#include <linux/uaccess.h>
+#include <wrapper/uaccess.h>
 #include <wrapper/frame.h>
+#include <wrapper/types.h>
 
 #include <lttng-filter.h>
 #include <lttng-string-utils.h>
@@ -45,7 +46,7 @@ char get_char(struct estack_entry *reg, size_t offset)
                char c;
 
                /* Handle invalid access as end of string. */
-               if (unlikely(!access_ok(VERIFY_READ,
+               if (unlikely(!lttng_access_ok(VERIFY_READ,
                                reg->u.s.user_str + offset,
                                sizeof(c))))
                        return '\0';
@@ -96,16 +97,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();
        }
 
@@ -121,10 +120,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;
 }
@@ -134,13 +131,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();
        }
 
@@ -225,10 +219,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;
 }
 
@@ -726,7 +719,7 @@ uint64_t lttng_filter_interpret_bytecode(void *filter_data,
                                ret = -EINVAL;
                                goto end;
                        }
-                       estack_ax(stack, top)->u.s.seq_len = UINT_MAX;
+                       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)->u.s.user = 0;
@@ -790,7 +783,7 @@ uint64_t lttng_filter_interpret_bytecode(void *filter_data,
                        dbg_printk("load string %s\n", insn->data);
                        estack_push(stack, top, ax, bx);
                        estack_ax(stack, top)->u.s.str = insn->data;
-                       estack_ax(stack, top)->u.s.seq_len = UINT_MAX;
+                       estack_ax(stack, top)->u.s.seq_len = LTTNG_SIZE_MAX;
                        estack_ax(stack, top)->u.s.literal_type =
                                ESTACK_STRING_LITERAL_TYPE_PLAIN;
                        estack_ax(stack, top)->u.s.user = 0;
@@ -805,7 +798,7 @@ uint64_t lttng_filter_interpret_bytecode(void *filter_data,
                        dbg_printk("load globbing pattern %s\n", insn->data);
                        estack_push(stack, top, ax, bx);
                        estack_ax(stack, top)->u.s.str = insn->data;
-                       estack_ax(stack, top)->u.s.seq_len = UINT_MAX;
+                       estack_ax(stack, top)->u.s.seq_len = LTTNG_SIZE_MAX;
                        estack_ax(stack, top)->u.s.literal_type =
                                ESTACK_STRING_LITERAL_TYPE_STAR_GLOB;
                        estack_ax(stack, top)->u.s.user = 0;
@@ -870,7 +863,7 @@ uint64_t lttng_filter_interpret_bytecode(void *filter_data,
                                ret = -EINVAL;
                                goto end;
                        }
-                       estack_ax(stack, top)->u.s.seq_len = UINT_MAX;
+                       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)->u.s.user = 0;
@@ -920,7 +913,7 @@ uint64_t lttng_filter_interpret_bytecode(void *filter_data,
                                ret = -EINVAL;
                                goto end;
                        }
-                       estack_ax(stack, top)->u.s.seq_len = UINT_MAX;
+                       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)->u.s.user = 1;
This page took 0.024672 seconds and 4 git commands to generate.