Fix: hander negative get_syscall_nr return value
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mon, 29 Sep 2014 17:29:12 +0000 (13:29 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mon, 29 Sep 2014 17:29:12 +0000 (13:29 -0400)
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
instrumentation/syscalls/headers/syscalls_unknown.h
lttng-syscalls.c

index 6ff640e42ed110a6aadc38c9802bf8f49364458f..7868f85f42fe1b88c36fa50964efb3cdeb1f215d 100644 (file)
 #define TP_PROBE_CB(_template)          &syscall_entry_probe
 
 LTTNG_TRACEPOINT_EVENT(syscall_entry_unknown,
-       TP_PROTO(unsigned int id, unsigned long *args),
+       TP_PROTO(int id, unsigned long *args),
        TP_ARGS(id, args),
        TP_STRUCT__entry(
-               __field(unsigned int, id)
+               __field(int, id)
                __array(unsigned long, args, UNKNOWN_SYSCALL_NRARGS)
        ),
        TP_fast_assign(
@@ -23,10 +23,10 @@ LTTNG_TRACEPOINT_EVENT(syscall_entry_unknown,
        TP_printk()
 )
 LTTNG_TRACEPOINT_EVENT(compat_syscall_entry_unknown,
-       TP_PROTO(unsigned int id, unsigned long *args),
+       TP_PROTO(int id, unsigned long *args),
        TP_ARGS(id, args),
        TP_STRUCT__entry(
-               __field(unsigned int, id)
+               __field(int, id)
                __array(unsigned long, args, UNKNOWN_SYSCALL_NRARGS)
        ),
        TP_fast_assign(
@@ -40,10 +40,10 @@ LTTNG_TRACEPOINT_EVENT(compat_syscall_entry_unknown,
 #define TP_PROBE_CB(_template)          &syscall_exit_probe
 
 LTTNG_TRACEPOINT_EVENT(syscall_exit_unknown,
-       TP_PROTO(unsigned int id, long ret, unsigned long *args),
+       TP_PROTO(int id, long ret, unsigned long *args),
        TP_ARGS(id, ret, args),
        TP_STRUCT__entry(
-               __field(unsigned int, id)
+               __field(int, id)
                __field(long, ret)
                __array(unsigned long, args, UNKNOWN_SYSCALL_NRARGS)
        ),
@@ -55,10 +55,10 @@ LTTNG_TRACEPOINT_EVENT(syscall_exit_unknown,
        TP_printk()
 )
 LTTNG_TRACEPOINT_EVENT(compat_syscall_exit_unknown,
-       TP_PROTO(unsigned int id, long ret, unsigned long *args),
+       TP_PROTO(int id, long ret, unsigned long *args),
        TP_ARGS(id, ret, args),
        TP_STRUCT__entry(
-               __field(unsigned int, id)
+               __field(int, id)
                __field(long, ret)
                __array(unsigned long, args, UNKNOWN_SYSCALL_NRARGS)
        ),
index a4a8ed44cd9c76dbc38d0ce8e319182b9f52392e..5501997c48fdd73f730fc59e9ac7ecd84dc6fe50 100644 (file)
@@ -375,7 +375,7 @@ void syscall_entry_probe(void *__data, struct pt_regs *regs, long id)
 
                filter = rcu_dereference(chan->sc_filter);
                if (filter) {
-                       if (id >= NR_compat_syscalls
+                       if (id < 0 || id >= NR_compat_syscalls
                                || !test_bit(id, filter->sc_compat)) {
                                /* System call filtered out. */
                                return;
@@ -389,7 +389,7 @@ void syscall_entry_probe(void *__data, struct pt_regs *regs, long id)
 
                filter = rcu_dereference(chan->sc_filter);
                if (filter) {
-                       if (id >= NR_syscalls
+                       if (id < 0 || id >= NR_syscalls
                                || !test_bit(id, filter->sc)) {
                                /* System call filtered out. */
                                return;
@@ -399,7 +399,7 @@ void syscall_entry_probe(void *__data, struct pt_regs *regs, long id)
                table_len = ARRAY_SIZE(sc_table);
                unknown_event = chan->sc_unknown;
        }
-       if (unlikely(id >= table_len)) {
+       if (unlikely(id < 0 || id >= table_len)) {
                syscall_entry_unknown(unknown_event, regs, id);
                return;
        }
@@ -503,7 +503,7 @@ void syscall_entry_probe(void *__data, struct pt_regs *regs, long id)
 }
 
 static void syscall_exit_unknown(struct lttng_event *event,
-       struct pt_regs *regs, unsigned int id, long ret)
+       struct pt_regs *regs, int id, long ret)
 {
        unsigned long args[UNKNOWN_SYSCALL_NRARGS];
 
@@ -529,7 +529,7 @@ void syscall_exit_probe(void *__data, struct pt_regs *regs, long ret)
 
                filter = rcu_dereference(chan->sc_filter);
                if (filter) {
-                       if (id >= NR_compat_syscalls
+                       if (id < 0 || id >= NR_compat_syscalls
                                || !test_bit(id, filter->sc_compat)) {
                                /* System call filtered out. */
                                return;
@@ -543,7 +543,7 @@ void syscall_exit_probe(void *__data, struct pt_regs *regs, long ret)
 
                filter = rcu_dereference(chan->sc_filter);
                if (filter) {
-                       if (id >= NR_syscalls
+                       if (id < 0 || id >= NR_syscalls
                                || !test_bit(id, filter->sc)) {
                                /* System call filtered out. */
                                return;
@@ -553,7 +553,7 @@ void syscall_exit_probe(void *__data, struct pt_regs *regs, long ret)
                table_len = ARRAY_SIZE(sc_exit_table);
                unknown_event = chan->sc_exit_unknown;
        }
-       if (unlikely(id >= table_len)) {
+       if (unlikely(id < 0 || id >= table_len)) {
                syscall_exit_unknown(unknown_event, regs, id, ret);
                return;
        }
This page took 0.035515 seconds and 4 git commands to generate.