]> git.ipfire.org Git - pakfire.git/commitdiff
cgroup: Do not use TLS for buffer that is longer than one page
authorMichael Tremer <michael.tremer@ipfire.org>
Thu, 5 Oct 2023 10:31:59 +0000 (10:31 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Thu, 5 Oct 2023 10:31:59 +0000 (10:31 +0000)
There seems to be a compiler bug that causes memory corruption in any
spawned threads. This used to materialize mostly in downloading files
when cURL spawned a thread to call the glibc resolver.

See: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81142
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/libpakfire/cgroup.c

index b3f7584d399f511aa7c70513b4b4cb808c8eebb7..a63a7c211807d6fa0a2c361257424500d963d6aa 100644 (file)
@@ -34,8 +34,6 @@
 #include <pakfire/string.h>
 #include <pakfire/util.h>
 
-static __thread char bpf_log_buffer[BPF_LOG_BUF_SIZE];
-
 #define BUFFER_SIZE                    64 * 1024
 
 // Short form of mov, dst_reg = src_reg
@@ -215,6 +213,8 @@ static void pakfire_cgroup_free(struct pakfire_cgroup* cgroup) {
 }
 
 static int pakfire_cgroup_setup_devices(struct pakfire_cgroup* cgroup) {
+       char bpf_log_buffer[BPF_LOG_BUF_SIZE];
+
        LIBBPF_OPTS(bpf_prog_load_opts, opts,
                // Log Buffer
                .log_buf  = bpf_log_buffer,