llvm-project/compiler-rt/test
Matthew Malcomson c1653b8cc7 Hwasan InitPrctl check for error using internal_iserror
When adding this function in https://reviews.llvm.org/D68794 I did not
notice that internal_prctl has the API of the syscall to prctl rather
than the API of the glibc (posix) wrapper.

This means that the error return value is not necessarily -1 and that
errno is not set by the call.

For InitPrctl this means that the checks do not catch running on a
kernel *without* the required ABI (not caught since I only tested this
function correctly enables the ABI when it exists).
This commit updates the two calls which check for an error condition to
use internal_iserror. That function sets a provided integer to an
equivalent errno value and returns a boolean to indicate success or not.

Tested by running on a kernel that has this ABI and on one that does
not. Verified that running on the kernel without this ABI the current
code prints the provided error message and does not attempt to run the
program. Verified that running on the kernel with this ABI the current
code does not print an error message and turns on the ABI.
This done on an x86 kernel (where the ABI does not exist), an AArch64
kernel without this ABI, and an AArch64 kernel with this ABI.

In order to keep running the testsuite on kernels that do not provide
this new ABI we add another option to the HWASAN_OPTIONS environment
variable, this option determines whether the library kills the process
if it fails to enable the relaxed syscall ABI or not.
This new flag is `fail_without_syscall_abi`.
The check-hwasan testsuite results do not change with this patch on
either x86, AArch64 without a kernel supporting this ABI, and AArch64
with a kernel supporting this ABI.

Differential Revision: https://reviews.llvm.org/D96964
2021-02-19 16:30:56 +00:00
..
BlocksRuntime Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
asan [sanitizers][Windows] Implement __sanitizer_purge_allocator for Win64 2021-02-12 09:49:04 -08:00
builtins [compiler-rt] Implement __atomic_is_lock_free 2021-01-08 12:48:22 +00:00
cfi [android] Fix some tests for AOSP-master devices. 2021-01-05 12:54:09 -08:00
crt These compiler-rt tests should be UNSUPPORTED instead of XFAIL. 2020-10-23 20:57:18 +04:00
dfsan [dfsan] Add thread registration 2021-02-05 17:38:59 +00:00
fuzzer [Fuzzer][Test] Use %python substitution for trace-malloc-unbalanced.test 2021-02-17 15:00:46 +00:00
gwp_asan [GWP-ASan] Split the unwinder into segv/non-segv. 2020-07-21 08:25:37 -07:00
hwasan Hwasan InitPrctl check for error using internal_iserror 2021-02-19 16:30:56 +00:00
interception [compiler-rt] Rename lit.*.cfg.* -> lit.*.cfg.py.* 2019-06-27 20:56:04 +00:00
lsan [sanitizer] [arm] Disable some LSAN tests for arm-linux-gnueabihf 2021-02-15 09:35:02 -03:00
memprof [NFC,memprof] Update test after D96319 2021-02-11 16:36:16 -08:00
msan [test] Fix unused FileCheck prefixes in compiler-rt 2021-02-01 22:32:13 -08:00
profile Revert "[InstrProfiling] Use !associated metadata for counters, data and values" 2021-02-03 19:14:34 -05:00
safestack compiler-rt: Remove .cc from all lit config files 2019-08-05 19:25:35 +00:00
sanitizer_common [android] Fix testing adb call 2021-02-18 17:24:07 -08:00
scudo [scudo][standalone] Restore GWP-ASan flag parsing 2021-01-27 12:35:34 -08:00
shadowcallstack compiler-rt: Remove .cc from all lit config files 2019-08-05 19:25:35 +00:00
tsan tsan: fix mmap_lots test 2021-02-17 19:03:17 +01:00
ubsan [Sanitizer] Fix sanitizer tests without reducing optimization levels 2021-02-11 15:22:20 -08:00
ubsan_minimal [test] Fix unused FileCheck prefixes in compiler-rt 2021-02-01 22:32:13 -08:00
xray Fix xray fdr mode to allow multiple flushes 2021-02-10 12:57:24 +11:00
.clang-format [compiler-rt] Use "ColumnLimit: 0" instead of "clang-format off" in tests 2018-12-01 01:24:29 +00:00
.clang-tidy [NFC][compiler-rt] Refine .clang-tidy checks 2020-09-05 15:42:15 -07:00
CMakeLists.txt Revert "[InstrProfiling] Use !associated metadata for counters, data and values" 2021-02-03 19:14:34 -05:00
lit.common.cfg.py [compiler-rt][test] Suppress stderr of ldd output 2021-01-01 14:09:13 -08:00
lit.common.configured.in [sanitizer] Fix Android API level parsing on arm 2020-11-14 01:54:45 -08:00