X-Git-Url: https://git.lttng.org/?a=blobdiff_plain;f=lttng-syscalls.c;h=622da6e206a5c683a5c1b006387789c46ac0126e;hb=af991434d1e5fd073968feae6befdb240942def5;hp=5cac721200bb8aa5cab44ffcfa281e380d7ccfe1;hpb=bcde0d5b7da973a9372b3db4acc0b08b9589e05b;p=lttng-modules.git diff --git a/lttng-syscalls.c b/lttng-syscalls.c index 5cac7212..622da6e2 100644 --- a/lttng-syscalls.c +++ b/lttng-syscalls.c @@ -91,6 +91,7 @@ struct mmap_arg_struct; #define PARAMS(args...) args /* Handle unknown syscalls */ +#undef TRACE_SYSTEM #define TRACE_SYSTEM syscalls_unknown #include "instrumentation/syscalls/headers/syscalls_unknown.h" #undef TRACE_SYSTEM @@ -374,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; @@ -388,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; @@ -398,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; } @@ -502,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]; @@ -528,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; @@ -542,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; @@ -552,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; } @@ -1229,13 +1230,31 @@ long lttng_channel_syscall_mask(struct lttng_channel *channel, filter = channel->sc_filter; for (bit = 0; bit < ARRAY_SIZE(sc_table); bit++) { - bt_bitfield_write_be(tmp_mask, char, bit, 1, - test_bit(bit, filter->sc)); + bool state; + + if (channel->sc_table) { + if (filter) + state = test_bit(bit, filter->sc); + else + state = 1; + } else { + state = 0; + } + bt_bitfield_write_be(tmp_mask, char, bit, 1, state); } for (; bit < sc_tables_len; bit++) { - bt_bitfield_write_be(tmp_mask, char, bit, 1, - test_bit(bit - ARRAY_SIZE(sc_table), - filter->sc_compat)); + bool state; + + if (channel->compat_sc_table) { + if (filter) + state = test_bit(bit - ARRAY_SIZE(sc_table), + filter->sc_compat); + else + state = 1; + } else { + state = 0; + } + bt_bitfield_write_be(tmp_mask, char, bit, 1, state); } if (copy_to_user(usyscall_mask->mask, tmp_mask, bitmask_len)) ret = -EFAULT;