X-Git-Url: http://git.liburcu.org/?a=blobdiff_plain;f=lttng-syscalls.c;h=5fcbe6fc55ce955de7a056b81dc83003cebcbd16;hb=b53047135828b997a4eeb2cae7344cb169aa9c8c;hp=3d2025eb35525f9a2f601e7379e7899aaf24179a;hpb=c50bdba26664558b966a324cd382bd2959f0444e;p=lttng-modules.git diff --git a/lttng-syscalls.c b/lttng-syscalls.c index 3d2025eb..5fcbe6fc 100644 --- a/lttng-syscalls.c +++ b/lttng-syscalls.c @@ -22,12 +22,11 @@ #include #include -#include -#include -#include -#include -#include -#include +#include +#include +#include + +#define LTTNG_SYSCALL_NR_ARGS 6 #ifndef CONFIG_COMPAT # ifndef is_compat_task @@ -82,9 +81,7 @@ struct timeval; struct itimerval; struct itimerspec; -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,6,0)) typedef __kernel_old_time_t time_t; -#endif #ifdef IA32_NR_syscalls #define NR_compat_syscalls IA32_NR_syscalls @@ -377,7 +374,7 @@ static void syscall_entry_unknown(struct lttng_event *event, { unsigned long args[LTTNG_SYSCALL_NR_ARGS]; - lttng_syscall_get_arguments(current, regs, args); + syscall_get_arguments(current, regs, args); if (unlikely(in_compat_syscall())) __event_probe__compat_syscall_entry_unknown(event, id, args); else @@ -394,7 +391,7 @@ void syscall_entry_probe(void *__data, struct pt_regs *regs, long id) if (unlikely(in_compat_syscall())) { struct lttng_syscall_filter *filter; - filter = lttng_rcu_dereference(chan->sc_filter); + filter = rcu_dereference_raw_check(chan->sc_filter); if (filter) { if (id < 0 || id >= NR_compat_syscalls || !test_bit(id, filter->sc_compat)) { @@ -408,7 +405,7 @@ void syscall_entry_probe(void *__data, struct pt_regs *regs, long id) } else { struct lttng_syscall_filter *filter; - filter = lttng_rcu_dereference(chan->sc_filter); + filter = rcu_dereference_raw_check(chan->sc_filter); if (filter) { if (id < 0 || id >= NR_syscalls || !test_bit(id, filter->sc)) { @@ -448,7 +445,7 @@ void syscall_entry_probe(void *__data, struct pt_regs *regs, long id) void (*fptr)(void *__data, unsigned long arg0) = entry->func; unsigned long args[LTTNG_SYSCALL_NR_ARGS]; - lttng_syscall_get_arguments(current, regs, args); + syscall_get_arguments(current, regs, args); fptr(event, args[0]); break; } @@ -459,7 +456,7 @@ void syscall_entry_probe(void *__data, struct pt_regs *regs, long id) unsigned long arg1) = entry->func; unsigned long args[LTTNG_SYSCALL_NR_ARGS]; - lttng_syscall_get_arguments(current, regs, args); + syscall_get_arguments(current, regs, args); fptr(event, args[0], args[1]); break; } @@ -471,7 +468,7 @@ void syscall_entry_probe(void *__data, struct pt_regs *regs, long id) unsigned long arg2) = entry->func; unsigned long args[LTTNG_SYSCALL_NR_ARGS]; - lttng_syscall_get_arguments(current, regs, args); + syscall_get_arguments(current, regs, args); fptr(event, args[0], args[1], args[2]); break; } @@ -484,7 +481,7 @@ void syscall_entry_probe(void *__data, struct pt_regs *regs, long id) unsigned long arg3) = entry->func; unsigned long args[LTTNG_SYSCALL_NR_ARGS]; - lttng_syscall_get_arguments(current, regs, args); + syscall_get_arguments(current, regs, args); fptr(event, args[0], args[1], args[2], args[3]); break; } @@ -498,7 +495,7 @@ void syscall_entry_probe(void *__data, struct pt_regs *regs, long id) unsigned long arg4) = entry->func; unsigned long args[LTTNG_SYSCALL_NR_ARGS]; - lttng_syscall_get_arguments(current, regs, args); + syscall_get_arguments(current, regs, args); fptr(event, args[0], args[1], args[2], args[3], args[4]); break; } @@ -513,7 +510,7 @@ void syscall_entry_probe(void *__data, struct pt_regs *regs, long id) unsigned long arg5) = entry->func; unsigned long args[LTTNG_SYSCALL_NR_ARGS]; - lttng_syscall_get_arguments(current, regs, args); + syscall_get_arguments(current, regs, args); fptr(event, args[0], args[1], args[2], args[3], args[4], args[5]); break; @@ -528,7 +525,7 @@ static void syscall_exit_unknown(struct lttng_event *event, { unsigned long args[LTTNG_SYSCALL_NR_ARGS]; - lttng_syscall_get_arguments(current, regs, args); + syscall_get_arguments(current, regs, args); if (unlikely(in_compat_syscall())) __event_probe__compat_syscall_exit_unknown(event, id, ret, args); @@ -548,7 +545,7 @@ void syscall_exit_probe(void *__data, struct pt_regs *regs, long ret) if (unlikely(in_compat_syscall())) { struct lttng_syscall_filter *filter; - filter = lttng_rcu_dereference(chan->sc_filter); + filter = rcu_dereference_raw_check(chan->sc_filter); if (filter) { if (id < 0 || id >= NR_compat_syscalls || !test_bit(id, filter->sc_compat)) { @@ -562,7 +559,7 @@ void syscall_exit_probe(void *__data, struct pt_regs *regs, long ret) } else { struct lttng_syscall_filter *filter; - filter = lttng_rcu_dereference(chan->sc_filter); + filter = rcu_dereference_raw_check(chan->sc_filter); if (filter) { if (id < 0 || id >= NR_syscalls || !test_bit(id, filter->sc)) { @@ -604,7 +601,7 @@ void syscall_exit_probe(void *__data, struct pt_regs *regs, long ret) unsigned long arg0) = entry->func; unsigned long args[LTTNG_SYSCALL_NR_ARGS]; - lttng_syscall_get_arguments(current, regs, args); + syscall_get_arguments(current, regs, args); fptr(event, ret, args[0]); break; } @@ -616,7 +613,7 @@ void syscall_exit_probe(void *__data, struct pt_regs *regs, long ret) unsigned long arg1) = entry->func; unsigned long args[LTTNG_SYSCALL_NR_ARGS]; - lttng_syscall_get_arguments(current, regs, args); + syscall_get_arguments(current, regs, args); fptr(event, ret, args[0], args[1]); break; } @@ -629,7 +626,7 @@ void syscall_exit_probe(void *__data, struct pt_regs *regs, long ret) unsigned long arg2) = entry->func; unsigned long args[LTTNG_SYSCALL_NR_ARGS]; - lttng_syscall_get_arguments(current, regs, args); + syscall_get_arguments(current, regs, args); fptr(event, ret, args[0], args[1], args[2]); break; } @@ -643,7 +640,7 @@ void syscall_exit_probe(void *__data, struct pt_regs *regs, long ret) unsigned long arg3) = entry->func; unsigned long args[LTTNG_SYSCALL_NR_ARGS]; - lttng_syscall_get_arguments(current, regs, args); + syscall_get_arguments(current, regs, args); fptr(event, ret, args[0], args[1], args[2], args[3]); break; } @@ -658,7 +655,7 @@ void syscall_exit_probe(void *__data, struct pt_regs *regs, long ret) unsigned long arg4) = entry->func; unsigned long args[LTTNG_SYSCALL_NR_ARGS]; - lttng_syscall_get_arguments(current, regs, args); + syscall_get_arguments(current, regs, args); fptr(event, ret, args[0], args[1], args[2], args[3], args[4]); break; } @@ -674,7 +671,7 @@ void syscall_exit_probe(void *__data, struct pt_regs *regs, long ret) unsigned long arg5) = entry->func; unsigned long args[LTTNG_SYSCALL_NR_ARGS]; - lttng_syscall_get_arguments(current, regs, args); + syscall_get_arguments(current, regs, args); fptr(event, ret, args[0], args[1], args[2], args[3], args[4], args[5]); break; @@ -883,7 +880,7 @@ int lttng_syscalls_register(struct lttng_channel *chan, void *filter) return ret; #endif if (!chan->sys_enter_registered) { - ret = lttng_wrapper_tracepoint_probe_register("sys_enter", + ret = lttng_tracepoint_probe_register("sys_enter", (void *) syscall_entry_probe, chan); if (ret) return ret; @@ -894,10 +891,10 @@ int lttng_syscalls_register(struct lttng_channel *chan, void *filter) * conflict with sys_exit syscall entry. */ if (!chan->sys_exit_registered) { - ret = lttng_wrapper_tracepoint_probe_register("sys_exit", + ret = lttng_tracepoint_probe_register("sys_exit", (void *) syscall_exit_probe, chan); if (ret) { - WARN_ON_ONCE(lttng_wrapper_tracepoint_probe_unregister("sys_enter", + WARN_ON_ONCE(lttng_tracepoint_probe_unregister("sys_enter", (void *) syscall_entry_probe, chan)); return ret; } @@ -916,14 +913,14 @@ int lttng_syscalls_unregister(struct lttng_channel *chan) if (!chan->sc_table) return 0; if (chan->sys_enter_registered) { - ret = lttng_wrapper_tracepoint_probe_unregister("sys_enter", + ret = lttng_tracepoint_probe_unregister("sys_enter", (void *) syscall_entry_probe, chan); if (ret) return ret; chan->sys_enter_registered = 0; } if (chan->sys_exit_registered) { - ret = lttng_wrapper_tracepoint_probe_unregister("sys_exit", + ret = lttng_tracepoint_probe_unregister("sys_exit", (void *) syscall_exit_probe, chan); if (ret) return ret; @@ -1295,7 +1292,7 @@ int lttng_abi_syscall_list(void) struct file *syscall_list_file; int file_fd, ret; - file_fd = lttng_get_unused_fd(); + file_fd = get_unused_fd_flags(0); if (file_fd < 0) { ret = file_fd; goto fd_error;