Fix: Filter ABI changes to support FILTER_BYTECODE_MAX_LEN (65536)
[lttng-ust.git] / liblttng-ust / lttng-ust-comm.c
index cca5dcf83716d9ce0e854305185689290b3e72aa..be64acd01d03e6b730cec0403a4edda21fbd90ac 100644 (file)
@@ -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;
@@ -928,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;
 
@@ -977,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));
@@ -991,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);
This page took 0.025357 seconds and 4 git commands to generate.