X-Git-Url: http://git.lttng.org/?a=blobdiff_plain;f=liblttng-ust%2Flttng-ust-comm.c;h=596fd7dfbee9f566e76a9ed11adb00d744caa7e8;hb=b0c1425d1dbdd356172125a2dde4af4602a17326;hp=70dad7674a754e84bc636b1e3492c8548cbf3144;hpb=cd54f6d934faf715cbd12fa9665e94b6fe367802;p=lttng-ust.git diff --git a/liblttng-ust/lttng-ust-comm.c b/liblttng-ust/lttng-ust-comm.c index 70dad767..596fd7df 100644 --- a/liblttng-ust/lttng-ust-comm.c +++ b/liblttng-ust/lttng-ust-comm.c @@ -293,6 +293,14 @@ int handle_message(struct sock_info *sock_info, ret = -EINVAL; goto error; } + + if (lum->u.filter.reloc_offset > lum->u.filter.data_size - 1) { + ERR("Filter reloc offset %u is not within data\n", + lum->u.filter.reloc_offset); + ret = -EINVAL; + goto error; + } + bytecode = zmalloc(sizeof(*bytecode) + lum->u.filter.data_size); if (!bytecode) { ret = -ENOMEM; @@ -328,9 +336,6 @@ int handle_message(struct sock_info *sock_info, } bytecode->len = lum->u.filter.data_size; bytecode->reloc_offset = lum->u.filter.reloc_offset; - fprintf(stderr, "RECV len %d rel %d\n", - lum->u.filter.data_size, - lum->u.filter.reloc_offset); if (ops->cmd) { ret = ops->cmd(lum->handle, lum->cmd, (unsigned long) bytecode, @@ -611,9 +616,9 @@ int get_wait_shm(struct sock_info *sock_info, size_t mmap_size) ret = ftruncate(wait_shm_fd, mmap_size); if (ret) { PERROR("ftruncate"); - exit(EXIT_FAILURE); + _exit(EXIT_FAILURE); } - exit(EXIT_SUCCESS); + _exit(EXIT_SUCCESS); } /* * For local shm, we need to have rw access to accept @@ -931,6 +936,7 @@ void __attribute__((constructor)) lttng_ust_init(void) { struct timespec constructor_timeout; sigset_t sig_all_blocked, orig_parent_mask; + pthread_attr_t thread_attr; int timeout_mode; int ret; @@ -980,13 +986,22 @@ void __attribute__((constructor)) lttng_ust_init(void) ERR("pthread_sigmask: %s", strerror(ret)); } - ret = pthread_create(&global_apps.ust_listener, NULL, + ret = pthread_attr_init(&thread_attr); + if (ret) { + ERR("pthread_attr_init: %s", strerror(ret)); + } + ret = pthread_attr_setdetachstate(&thread_attr, PTHREAD_CREATE_DETACHED); + if (ret) { + ERR("pthread_attr_setdetachstate: %s", strerror(ret)); + } + + ret = pthread_create(&global_apps.ust_listener, &thread_attr, ust_listener_thread, &global_apps); if (ret) { ERR("pthread_create global: %s", strerror(ret)); } if (local_apps.allowed) { - ret = pthread_create(&local_apps.ust_listener, NULL, + ret = pthread_create(&local_apps.ust_listener, &thread_attr, ust_listener_thread, &local_apps); if (ret) { ERR("pthread_create local: %s", strerror(ret)); @@ -994,6 +1009,10 @@ void __attribute__((constructor)) lttng_ust_init(void) } else { handle_register_done(&local_apps); } + ret = pthread_attr_destroy(&thread_attr); + if (ret) { + ERR("pthread_attr_destroy: %s", strerror(ret)); + } /* Restore original signal mask in parent */ ret = pthread_sigmask(SIG_SETMASK, &orig_parent_mask, NULL);