X-Git-Url: http://git.lttng.org/?a=blobdiff_plain;f=lttng-syscalls.c;h=846946ad374ca00d7af1b4f3c36fa0d60155938d;hb=24875133a4330acb17b33bc9b3a57e59e73022a6;hp=1489934f3319bbad05de08d3c404f155bd2feac7;hpb=cecef7f86625593d7e26337294ceda7252557f59;p=lttng-modules.git diff --git a/lttng-syscalls.c b/lttng-syscalls.c index 1489934f..846946ad 100644 --- a/lttng-syscalls.c +++ b/lttng-syscalls.c @@ -1036,6 +1036,8 @@ int lttng_syscall_filter_disable(struct lttng_channel *chan, WARN_ON_ONCE(!chan->sc_table); if (!chan->sc_filter) { + if (!chan->syscall_all) + return -EEXIST; filter = kzalloc(sizeof(struct lttng_syscall_filter), GFP_KERNEL); if (!filter) @@ -1048,6 +1050,14 @@ int lttng_syscall_filter_disable(struct lttng_channel *chan, } if (!name) { + /* Fail if all syscalls are already disabled. */ + if (bitmap_empty(filter->sc, NR_syscalls) + && bitmap_empty(filter->sc_compat, + NR_compat_syscalls)) { + ret = -EEXIST; + goto error; + } + /* Disable all system calls */ bitmap_clear(filter->sc, 0, NR_syscalls); bitmap_clear(filter->sc_compat, 0, NR_compat_syscalls); @@ -1220,12 +1230,12 @@ long lttng_channel_syscall_mask(struct lttng_channel *channel, for (bit = 0; bit < ARRAY_SIZE(sc_table); bit++) { bt_bitfield_write_be(tmp_mask, char, bit, 1, - test_bit(bit, filter->sc)); + filter ? test_bit(bit, filter->sc) : 1); } 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)); + filter ? test_bit(bit - ARRAY_SIZE(sc_table), + filter->sc_compat) : 1); } if (copy_to_user(usyscall_mask->mask, tmp_mask, bitmask_len)) ret = -EFAULT;