Alan T. DeKok [Thu, 6 Apr 2023 19:24:20 +0000 (15:24 -0400)]
use a global mutex for TLS, not a per-socket mutex.
Apparently accessing the SSL_SESSION also requires mutex-protected
access to the underlying SSL_CTX. So we set a global mutex, which
will slow things down a bit in the contended case. But it won't
cause blocking issues which stops the server entirely.
Jorge Pereira [Tue, 28 Mar 2023 17:01:34 +0000 (14:01 -0300)]
Fix pthread.h include (#4943)
It needs to avoid:
src/lib/event.c:127:2: error: call to undeclared function 'pthread_mutex_destroy'; ISO C99 and later do not support implicit function declarations [-Werror,-Wimplicit-function-declaration]
CC src/lib/getaddrinfo.c
pthread_mutex_destroy(&el->mutex);
^
src/lib/event.c:162:9: error: call to undeclared function 'pthread_mutex_init'; ISO C99 and later do not support implicit function declarations [-Werror,-Wimplicit-function-declaration]
pthread_mutex_init(&el->mutex, NULL);
^
src/lib/event.c:478:2: error: call to undeclared function 'pthread_mutex_lock'; ISO C99 and later do not support implicit function declarations [-Werror,-Wimplicit-function-declaration]
pthread_mutex_lock(&el->mutex);
^
Jorge Pereira [Thu, 23 Mar 2023 00:10:20 +0000 (21:10 -0300)]
Fix runtime LSAN/ASAN error in command.c
Such error:
src/main/command.c:185:12: runtime error: member access within null
pointer of type 'struct sockaddr_un'
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior
src/main/command.c:185:12 in
Jorge Pereira [Thu, 9 Mar 2023 19:05:52 +0000 (16:05 -0300)]
Fix runtime LSAN/ASAN error in src/lib/atomic_queue.c
Such error:
runtime error: member access within misaligned address 0x7f0e163fe860
for type 'fr_atomic_queue_t' (aka 'struct fr_atomic_queue_t'),
which requires 128 byte alignment 0x7f0e163fe860: note: pointer points here)
In that case, it was necessary backport talloc_aligned_array()
Direct leak of 96 byte(s) in 1 object(s) allocated from:
#0 0x5598fcd87f3e in malloc (/home/jpereira/Devel/FreeRADIUS/freeradius-server-v3.2.x.git-linux/build/bin/local/radiusd+0x20cf3e) (BuildId: 3bf5bfb4fd72e1e1112726414556f8a4f339789f)
#1 0x7f1cc4453d7f in __talloc_with_prefix /build/talloc-NvEq5A/talloc-2.3.3/bin/default/../../talloc.c:783:9
#2 0x7f1cc4455a5d in __talloc /build/talloc-NvEq5A/talloc-2.3.3/bin/default/../../talloc.c:825:9
#3 0x7f1cc4455a5d in _talloc_named_const /build/talloc-NvEq5A/talloc-2.3.3/bin/default/../../talloc.c:982:8
#4 0x7f1cc4455a5d in talloc_enable_null_tracking /build/talloc-NvEq5A/talloc-2.3.3/bin/default/../../talloc.c:2353:18
#5 0x7f1cc4455a5d in talloc_enable_null_tracking /build/talloc-NvEq5A/talloc-2.3.3/bin/default/../../talloc.c:2350:15
#6 0x5598fceb65b1 in main /home/jpereira/Devel/FreeRADIUS/freeradius-server-v3.2.x.git-linux/src/main/radiusd.c:313:3
#7 0x7f1cc342350f in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16
#8 0x7f1cc34235c8 in __libc_start_main csu/../csu/libc-start.c:381:3
#9 0x5598fcd02514 in _start (/home/jpereira/Devel/FreeRADIUS/freeradius-server-v3.2.x.git-linux/build/bin/local/radiusd+0x187514) (BuildId: 3bf5bfb4fd72e1e1112726414556f8a4f339789f)
SUMMARY: AddressSanitizer: 96 byte(s) leaked in 1 allocation(s).
Alan T. DeKok [Fri, 17 Mar 2023 13:40:19 +0000 (09:40 -0400)]
disallow CoA for fake packets. Fixes #4929
The CoA handling in process.c requires that the CoA packet be
associated with a "real" request. i.e. one that was received from
the network, and is therefore long-lived.
"fake" packets, such as ones sent to a virtual home server, or
packets used in the "inner-tunnel" virtual server can't do CoA.
This is because the fake packets are freed immediately after they
are processed, and there is no way for them to push the CoA child
into the main event loop.
Jorge Pereira [Tue, 14 Mar 2023 19:09:56 +0000 (16:09 -0300)]
Fix runtime error in file_common()
Such error:
src/modules/rlm_files/rlm_files.c:431:49: runtime error: null pointer passed as argument 3, which is declared to never be null
src/freeradius-devel/radiusd.h:603:89: note: nonnull attribute specified here
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior src/modules/rlm_files/rlm_files.c:431:49 in
Jorge Pereira [Tue, 14 Mar 2023 19:05:42 +0000 (16:05 -0300)]
Fix runtime error in cf_file_open()
Such error:
src/main/conffile.c:333:22: runtime error: load of value 190, which is not a valid value for type 'bool'
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior src/main/conffile.c:333:22 in