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
Jorge Pereira [Thu, 16 Mar 2023 16:12:43 +0000 (13:12 -0300)]
Fix memory leak in client_add()
Such error when we run: radiusd -CX
Configuration appears to be OK
Allocated memory at time of report:
Current state of talloced memory:
full talloc report on 'null_context' (total 1057 bytes in 4 blocks)
autofree_context contains 1 bytes in 2 blocks (ref 0) 0x608000000400
bool contains 1 bytes in 1 blocks (ref 0) 0x60b000044a90
RADCLIENT_LIST contains 1056 bytes in 1 blocks (ref 0) 0x6190000032e0
Jorge Pereira [Tue, 14 Mar 2023 21:36:01 +0000 (18:36 -0300)]
Fix heap-buffer-overflow in pap_auth_pbkdf2_parse()
==3061536==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x6100000053f9 at pc 0x7f3eb4ff6bbe bp 0x7fff630b7770 sp 0x7fff630b7768
READ of size 1 at 0x6100000053f9 thread T0
#0 0x7f3eb4ff6bbd in strlcpy /home/jpereira/Devel/FreeRADIUS/freeradius-server-v3.2.x.git-linux/src/lib/strlcpy.c:56:10
Nick Porter [Thu, 23 Feb 2023 18:25:33 +0000 (18:25 +0000)]
Define max_retries for pool connections (#4908)
Allows control over the number of times a connection operation can be
retried before the module call fails.
Previously this was always set to the number of connections in the pool
- so on a system with a large number of open connections, and a remote
server going slow, this would easily block threads.
Terry Burton [Thu, 16 Feb 2023 13:36:26 +0000 (13:36 +0000)]
Ensure service user has stable uid/gid between Docker distro versions (#4900)
Changing UID between image versions is deprecated because modern container
workflows involve automated image upgrade / rollback using the same mounted-in
volume (i.e. with persistent filesystem permissions).