mirror of
https://github.com/opnsense/src.git
synced 2026-05-28 04:12:45 -04:00
libthr: work around an ASAN false-positive
I got the following error with an ASAN-instrument libthr:
==803==ERROR: AddressSanitizer: stack-buffer-overflow on address 0x7fffffffcdb0 at pc 0x000801863396 bp 0x7ff8
READ of size 4 at 0x7fffffffcdb0 thread T0
#0 0x801863395 in handle_signal /local/scratch/alr48/cheri/freebsd/lib/libthr/thread/thr_sig.c:262:2
#1 0x801860da2 in thr_sighandler /local/scratch/alr48/cheri/freebsd/lib/libthr/thread/thr_sig.c:246:2
Address 0x7fffffffcdb0 is located in stack of thread T0 at offset 208 in frame
#0 0x80186080f in thr_sighandler /local/scratch/alr48/cheri/freebsd/lib/libthr/thread/thr_sig.c:213
This frame has 1 object(s):
[32, 64) 'act' (line 216) <== Memory access at offset 208 overflows this variable
HINT: this may be a false positive if your program uses some custom stack
This seems like a false-positive since the line in question is
`SIGSETOR(actp->sa_mask, ucp->uc_sigmask);` and it complains about a read
operation (from the ucontext_t argument) so this indicates to me that ASAN
does not understand that thr_sighandler() is a signal handler.
Differential Revision: https://reviews.freebsd.org/D31074
This commit is contained in:
parent
7bc797e3f3
commit
9efbe526e0
1 changed files with 6 additions and 0 deletions
|
|
@ -29,6 +29,12 @@ CFLAGS+=-I${SRCTOP}/lib/libthread_db
|
|||
CFLAGS.thr_stack.c+= -Wno-cast-align
|
||||
CFLAGS.rtld_malloc.c+= -Wno-cast-align
|
||||
CFLAGS.thr_symbols.c+= -Wno-missing-variable-declarations
|
||||
.if ${MK_ASAN} != "no"
|
||||
# False-positive ASAN error claiming the local "struct sigaction act;" is
|
||||
# overflowed by handle_signal() reading from the ucontext_t argument. This
|
||||
# could be caused by ASAN not treating this function as a signal handler.
|
||||
CFLAGS.thr_sig.c+= -fno-sanitize=address
|
||||
.endif
|
||||
|
||||
.ifndef NO_THREAD_UNWIND_STACK
|
||||
CFLAGS+=-fexceptions
|
||||
|
|
|
|||
Loading…
Reference in a new issue