this DCHECK was not valid for hwasan_load1, and was not necessary for
the. the function is written without any assumptions of alignment of the
pointer.
Most sanitizers don't support static linking. One primary reason is the
incompatibility with interceptors. `GetTlsSize` is another reason.
asan/memprof use `__interception::DoesNotSupportStaticLinking`
(`_DYNAMIC` reference) to reject -static at link time. Port this
detector to other sanitizers. dfsan actually supports -static for
certain cases. Don't touch dfsan.
Existing code worked only for local, recorder FP, and the faulty address
are the same 1 MiB page.
Now, instead of guessing FP, we guess variable address.
We need to try just two cases of addresses around of faulty one.
Fixes https://github.com/google/sanitizers/issues/1723
…fatal error report
This makes the behavior of HWASan matching with ASan: always call user
provided callback function for an error report, but only call
`SetAbortMessage()` on Android when `flags()->halt_on_error` is true.
This is clearly a copy-paste mistake, fix it with this patch.
After checking the `local.function_name` is not null, it should check
the len for `local.function_name`, not `local.name`. And this could lead
to possible null dereference since the second
`internal_strlen(local.name)` does not guarantee `local.name` is not
null.
This is preparation for performance optimization.
We need to highlight that this is very specific lock, and should not be
used for other purposes.
Add `fork_child` parameter to distinguish processes after fork.
Lock Lsan and Thread related date at_fork.
Clean shadow before thread starts, forked process may reuse already
mapped stack of 'lost' parent thread for new threads.
When set to non-zero, the HWASan runtime will map the shadow base at the
specified constant address.
This is particularly useful in conjunction with the existing compiler
option
'hwasan-mapping-offset', which bakes a hardcoded constant address into
the instrumentation.
---------
Co-authored-by: Thurston Dang <thurston@google.com>
Due to a GCC bug (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=25940),
GCC doesn't consider extern "C" functions with the same name but
different namespace to be the same. As such, the default visibility
attribute (on a declaration outside the namespace) doesn't get applied
to the definition in the namespace and the symbol is not exported.
This came up as an ABI diff when switching between gcc and clang for
compiling compiler-rt.
The plan is to fix memcmp interceptor in HWASAN and remove the
unsupported statement at that time.
---------
Co-authored-by: Vitaly Buka <vitalybuka@gmail.com>
This problem was accidentally discovered by the internal symbolizer, but
it's relevant for external one as well, see the test.
If we just disable tagging, there may still be tagged allocations that
have already been freed. After disabling tagging, these tagged
allocations can be released to the user as-is, which would later break
the "invalid-free" check.
We cannot just disable the "invalid-free" check with disabled tagging,
because if we re-enable tagging, the issue still applies to allocations
created when it was disabled.
The fix is to continue tagging with zero even if tagging is disabled.
This makes the "disabled" mode less efficient, but this is not the
primary use case.
Please review them one by one in order, and let me know which are OK.
It's mostly code shuffling.
The goal is to make HWASA collect all needed info the first, and
printout later.
This way we avoid the printing changes HWASAN metadata.
Introduce a new virtual class StackTracePrinter and an implementation
FormattedStackTracePrinter in preparation of enabling symbolizer markup
for linux.
This change allows us to implement other behaviour under the same api
for StackTracePrinter, for example, MarkupStackTracePrinter.
Reason for revert: A missing header file for the
sanitizer_symbolizer_markup.cpp files.
This was not caught in local builds or pre-merge checks given that to
trigger the error, the code
has to be compiled for Fuchsia.
For this reland I've build for the fuchsia targets as well as linux.