[PATCH] D68794: libhwasan initialisation include kernel syscall ABI relaxation
Evgenii Stepanov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Oct 11 15:00:30 PDT 2019
eugenis added a comment.
In D68794#1705862 <https://reviews.llvm.org/D68794#1705862>, @mmalcomson wrote:
> Run `prctl` syscall for Android, but ignore EINVAL failures.
>
> NOTE: I don't believe this distinguishes between running on a kernel with with the tagged address ABI unconditional or running on a newer kernel or on a kernel with `sysctl abi.tagged_addr_disabled=1`
> (https://android.googlesource.com/kernel/common/+/690c4ca8a5715644370384672f24d95b042db74a/Documentation/arm64/tagged-address-abi.rst)
This is a good point. It appears that PR_GET_TAGGED_ADDR_CTRL works even when abi.tagged_addr_disabled=1, we can use it to tell these two cases apart, but there is not a lot we could do with that information.
A real test would be invoking a random syscall with a tagged pointer, ex. uname(). I don't think we need to go that far, but leaving it up to you.
================
Comment at: compiler-rt/lib/hwasan/hwasan.cpp:357
+ InitPrctl();
+
----------------
Please move it to InitInstrumentation to handle __hwasan_init_static, too.
================
Comment at: compiler-rt/lib/hwasan/hwasan_linux.cpp:157
+#define PR_TAGGED_ADDR_ENABLE (1UL << 0)
+ if (prctl(PR_SET_TAGGED_ADDR_CTRL, PR_TAGGED_ADDR_ENABLE, 0, 0, 0) == -1
+ || ! prctl(PR_GET_TAGGED_ADDR_CTRL, 0, 0, 0, 0)) {
----------------
This needs to be internal_prctl because prctl implementation in libc can be built with hwasan.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D68794/new/
https://reviews.llvm.org/D68794
More information about the llvm-commits
mailing list