tech-toolchain archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: CVS commit: src/external/gpl3/gcc/dist/libsanitizer/sanitizer_common



On Fri, May 25, 2018 at 09:54:51 +0200, Kamil Rytarowski wrote:

> On 25.05.2018 09:06, Martin Husemann wrote:
> > On Fri, May 25, 2018 at 07:39:36AM +0200, Kamil Rytarowski wrote:
> >> Please test this patch:
> >>
> >> http://netbsd.org/~kamil/patch-00048-mmap-munmap-sanitizers.txt
> >>
> >> It works for me on amd64 and i386.
> > 
> > Why do you have to go via dlsym() ?
> > 
> > Martin
> > 
> 
> In general: in order to bypass mmap() interceptor. If we call the mmap
> symbol, it's intercepted by a sanitizer. If and interceptor is not in
> the interest of a sanitizer or sanitizer-like program/library - we
> fallback to the default one with RTLD_DEFAULT.
> 
> In particular: UBSan does not install mmap() interceptor, it's used by
> other sanitizers like ASan or TSan. The mmap symbol installed by an
> interceptor is compiled into executable into the .text section and is
> resolved first, before mmap@PLT.
> 
> In the particular NetBSD case: we access the __mmap symbol without dlsym(3).
> 
> In the proposed code, I'm presenting a generic approach to be used for
> all kernel syscalls used internally in the sanitizers, regardless of
> being namespaced or not. getpid is a good example of a not namespaced
> symbol and we want to execute it internally in internal_getpid().
> 
> As noted by Joerg, I want to bypass potential cycle with cancel point in
> libpthread(3) in mmap/_mmap.

As also noted by Joerg, using __mmap does just that.   I'm confused.

-uwe


Home | Main Index | Thread Index | Old Index