[RISC-V] Add support for AddressSanitizer on RISC-V GCC

Jim Wilson jimw@sifive.com
Tue Aug 25 19:39:11 GMT 2020


On Wed, Aug 19, 2020 at 1:02 AM Joshua via Gcc-patches
<gcc-patches@gcc.gnu.org> wrote:
>         * config/riscv/riscv.c (asan_shadow_offset): Implement the offset of asan shadow memory for risc-v.
>         (asan_shadow_offset): new macro definition.

When I try the patch, I get asan errors complaining about memory mappings.

==9422==Shadow memory range interleaves with an existing memory
mapping. ASan cannot proceed correctly. ABORTING.
==9422==ASan shadow was supposed to be located in the
[0x00007fff7000-0x10007fff7fff] range.

I haven't gotten it working yet, but I haven't tried debugging it yet
either.  How exactly are you testing it?  It fails for me using a 4.15
kernel on hardware, and on a user mode qemu.  I haven't tried booting
a 5.x kernel in qemu, that would take some time to set up.  Likewise
using a 5.x kernel on hardware would take some time to set up.

Jim


More information about the Gcc-patches mailing list