Re: leak sanitizer support

From: Eric Gullufsen <ricky_at_rickysquid.org>
Date: Wed, 05 Jan 2022 05:18:59 UTC
On Sun, Jan 02, 2022 at 09:01:56PM +0000, rickygee wrote:
> On Sun, Jan 02, 2022 at 07:35:06PM +0000, Eric Gullufsen wrote:
> > Awesome sounds great - will test with your new diff & module files posted &
> > report back here in a few - thanks!
> > 
> > On Sun, Jan 02, 2022 at 09:53:06AM -0800, Luoqi Chen wrote:
> > > locking issue and also to cleanup some unused code, would you mind trying
> > > out the new version? I've updated the diff files.
> > > 
> > > -luoqi
> > 
> 
> Hey Luoqi,
> 
> Dang you rock - I applied your updated patch against -current (commit
> 642f77be1d), and everything went swimmingly in initial testing:
>
> -Eric

Hey Luoqi,

Shoot so sorry for my confusion, but it looks like the updated diff/.cpp do not
actually run quite right on -current. I think this is due to the signature of
SuspendedThreadsList::GetRegistersAndSP changing in June 2021

A commit in June 2021 (e8d8bef9) changed this signature on you in
sanitizer_stoptheworld.h

Here is `git show` for that commit/file, where you can see the sig change:

[e@bsd /usr/src/contrib/llvm-project/compiler-rt/lib/sanitizer_common]$ git show
e8d8bef96 -- sanitizer_stoptheworld.h

[cut]
-   virtual PtraceRegistersStatus GetRegistersAndSP(uptr index, uptr *buffer,
-                                                   uptr *sp) const {
++  virtual PtraceRegistersStatus GetRegistersAndSP(
++      uptr index, InternalMmapVector<uptr> *buffer, uptr *sp) const {
 +    UNIMPLEMENTED();
 +  }
 +
[cut]

I think this explains my run-time errors when using lsan on -current (see
output)

[begin error output]
AddressSanitizer: CHECK failed: sanitizer_stoptheworld.h:37 "((0 &&
"unimplemented")) != (0)" (0x0, 0x0) 
(tid=169384)                                                                                             
AddressSanitizer:DEADLYSIGNAL
[end error output]

Anyway - just a heads up - you probably would have been right on it when you
moved up to the new header, instead of squinting at lldb like me for *awhile*.

Oh here is a patch it might be easier to see it that way:
https://raw.githubusercontent.com/emgullufsen/freebsd/lsan/lsan-params.diff

Thanks and sorry for my confusion earlier!
-Eric