[PATCH] D40714: Correct atexit(3) support in MSan/NetBSD

Kamil Rytarowski via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 1 04:23:20 PST 2017


krytarowski created this revision.
krytarowski added a project: Sanitizers.

The NetBSD specific implementation of cxa_atexit() does not
preserve the 2nd argument if dso is equal to NULL.

Changes:

- Split paths of handling intercepted __cxa_atexit() and atexit(3). This affects all supported Operating Systems.
- Add a local stack-like structure to hold the __cxa_atexit() context. atexit(3) is documented in the C standard as calling callback from the earliest to the oldest entry. This path also fixes potential ABI problem of passing an argument to a function from the atexit(3) callback mechanism.
- Allow usage of global vars with ctors in interceptors. This allows to use Vector without automatic cleaning up the structures.
- Add MSan specific Vector class.

This code has been modeled after TSan implementation for the same functions.

Sponsored by <The NetBSD Foundation>


Repository:
  rL LLVM

https://reviews.llvm.org/D40714

Files:
  lib/msan/msan_interceptors.cc
  lib/msan/msan_vector.h

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D40714.125107.patch
Type: text/x-patch
Size: 6360 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171201/6660cd97/attachment.bin>


More information about the llvm-commits mailing list