Expanded API & added common interceptors. #4
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The goal here is to expand our API so that it can be semi-stable moving forward. This is the first of a series of two PRs. Once this and #9 are merged, the second PR will be created for the Rust runtime.
LLVM Runtime
bsan_internal.h
andbsan_internal.cpp
) with new endpoints for loading and storing provenance, reading, writing, allocating, deallocating, pushing and popping stack frames, and copying provenance in shadow memory. None have return values; instead, we use return pointers.bsan.h
andbsan.cpp
) to include matching functions for the internal API.BsanHooks
. Bothmalloc
andfree
are stored in a separate struct member,BsanAllocHooks
. This could remove an additional memory access when accessing theAllocator
in the Rust runtime. Also, instead of implementingAllocator
for& 'static GlobalContext
, we can implement it forBsanAllocHooks
and have it beCopy
. This lets us implement functions likefn(&'a GlobalState) -> Self
whereSelf
is something likeVec<u8, BsanAllocHooks>
without having requiring'a
to be'static
.Instrumentation Pass
BorrowVisitor
, which will collect and instrument relevant instructions in depth-first order, mirroring patterns used in ASAN and MSAN.__bsan_retval_tls
and__bsan_param_tls
) for the provenance of parameters and return values.