X-Git-Url: https://git.lttng.org/?a=blobdiff_plain;f=src%2Flttng-abi.c;h=a78205c4159392bf5b69d2aa87428dacfc8d8fff;hb=562376193c44ad44a9243cd880d5e424f0c25b04;hp=c06aa79acfe213c152a968ca20d04d9954c05c13;hpb=2d16d65ba3281b287de74c49a11ffc9764a0df82;p=lttng-modules.git diff --git a/src/lttng-abi.c b/src/lttng-abi.c index c06aa79a..a78205c4 100644 --- a/src/lttng-abi.c +++ b/src/lttng-abi.c @@ -1746,9 +1746,19 @@ int lttng_abi_validate_event_param(struct lttng_kernel_event *event_param) } break; + case LTTNG_KERNEL_KRETPROBE: + switch (event_param->u.kretprobe.entryexit) { + case LTTNG_KERNEL_SYSCALL_ENTRYEXIT: + break; + case LTTNG_KERNEL_SYSCALL_ENTRY: /* Fall-through */ + case LTTNG_KERNEL_SYSCALL_EXIT: /* Fall-through */ + default: + return -EINVAL; + } + break; + case LTTNG_KERNEL_TRACEPOINT: /* Fall-through */ case LTTNG_KERNEL_KPROBE: /* Fall-through */ - case LTTNG_KERNEL_KRETPROBE: /* Fall-through */ case LTTNG_KERNEL_UPROBE: break; @@ -1804,8 +1814,11 @@ int lttng_abi_create_event(struct file *channel_file, ret = lttng_abi_validate_event_param(event_param); if (ret) goto event_error; - if (event_param->instrumentation == LTTNG_KERNEL_TRACEPOINT - || event_param->instrumentation == LTTNG_KERNEL_SYSCALL) { + + switch (event_param->instrumentation) { + case LTTNG_KERNEL_TRACEPOINT: /* Fall-through */ + case LTTNG_KERNEL_SYSCALL: + { struct lttng_event_enabler *event_enabler; if (strutils_is_star_glob_pattern(event_param->name)) { @@ -1820,7 +1833,13 @@ int lttng_abi_create_event(struct file *channel_file, event_param, channel); } priv = event_enabler; - } else { + break; + } + + case LTTNG_KERNEL_KPROBE: /* Fall-through */ + case LTTNG_KERNEL_KRETPROBE: /* Fall-through */ + case LTTNG_KERNEL_UPROBE: + { struct lttng_event *event; /* @@ -1836,6 +1855,14 @@ int lttng_abi_create_event(struct file *channel_file, goto event_error; } priv = event; + break; + } + + case LTTNG_KERNEL_FUNCTION: /* Fall-through */ + case LTTNG_KERNEL_NOOP: /* Fall-through */ + default: + ret = -EINVAL; + goto event_error; } event_file->private_data = priv; fd_install(event_fd, event_file); @@ -2015,8 +2042,14 @@ int lttng_abi_create_event_notifier(struct file *event_notifier_group_file, goto refcount_error; } - if (event_notifier_param->event.instrumentation == LTTNG_KERNEL_TRACEPOINT - || event_notifier_param->event.instrumentation == LTTNG_KERNEL_SYSCALL) { + ret = lttng_abi_validate_event_param(&event_notifier_param->event); + if (ret) + goto event_notifier_error; + + switch (event_notifier_param->event.instrumentation) { + case LTTNG_KERNEL_TRACEPOINT: /* Fall-through */ + case LTTNG_KERNEL_SYSCALL: + { struct lttng_event_notifier_enabler *enabler; if (strutils_is_star_glob_pattern(event_notifier_param->event.name)) { @@ -2035,7 +2068,13 @@ int lttng_abi_create_event_notifier(struct file *event_notifier_group_file, event_notifier_param); } priv = enabler; - } else { + break; + } + + case LTTNG_KERNEL_KPROBE: /* Fall-through */ + case LTTNG_KERNEL_KRETPROBE: /* Fall-through */ + case LTTNG_KERNEL_UPROBE: + { struct lttng_event_notifier *event_notifier; /* @@ -2054,6 +2093,14 @@ int lttng_abi_create_event_notifier(struct file *event_notifier_group_file, goto event_notifier_error; } priv = event_notifier; + break; + } + + case LTTNG_KERNEL_FUNCTION: /* Fall-through */ + case LTTNG_KERNEL_NOOP: /* Fall-through */ + default: + ret = -EINVAL; + goto event_notifier_error; } event_notifier_file->private_data = priv; fd_install(event_notifier_fd, event_notifier_file);