Page MenuHomeFreeBSD

libthr: work around an ASAN false-positive
ClosedPublic

Authored by arichardson on Jul 6 2021, 8:37 AM.
Tags
None
Referenced Files
Unknown Object (File)
Mon, May 6, 2:01 AM
Unknown Object (File)
Thu, May 2, 5:21 PM
Unknown Object (File)
Fri, Apr 19, 11:24 AM
Unknown Object (File)
Apr 7 2024, 9:29 AM
Unknown Object (File)
Mar 22 2024, 4:02 PM
Unknown Object (File)
Mar 22 2024, 4:02 PM
Unknown Object (File)
Mar 22 2024, 4:02 PM
Unknown Object (File)
Mar 10 2024, 1:54 AM
Subscribers

Details

Summary

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.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 40343
Build 37232: arc lint + arc unit