On 11/27/20 11:46 AM, Matthew Malcomson via Gcc-patches wrote:
> Hello,
>
> -----
>
> This test should ensure that we can compile with hwasan, that such a compiled
> binary runs as expected, *and* that we're running on a kernel which implements
> the capability to ignore the top bytes of pointers in syscalls.
>
> It was expected that a basic test of `int main(void) { return 0; }` would
> check
> this, since there is a check called during `__hwasan_init` in libhwasan to
> ensure that the kernel we're running on provides a `prctl` to request the
> relaxed ABI.
>
> Unfortunately, the check in libhwasan has a bug in it, and does not correctly
> fail when the kernel feature is not around. This means that check is not
> automatically provided by the runtime.
>
> The sanitizer runtime will be fixed but would like to install this fix here in
> case fixing the library is not quick enough for the release (and so that
> people
> running the testsuite do not see spurious errors in the meantime).
>
> Tested by running testsuite on an AArch64 machine with and without the
> required
> kernel.
> Observed that the test does indeed fail when the kernel feature is unavailable
> and pass when the feature is available.
>
> Note that this test is directly targetting AArch64 by using `prctl` numbers
> specific to it. That's unfortunate, but once the runtime fix has gone in we
> will be able to remove that requirement.
>
> Ok for trunk?
>
> gcc/testsuite/ChangeLog:
>
> * lib/hwasan-dg.exp (check_effective_target_hwaddress_exec): Fix
> check for correct kernel version.
OK
jeff