-
Notifications
You must be signed in to change notification settings - Fork 994
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
"CHECK failed: sanitizer_allocator_primary32.h:292" when running on RISC-V 64 systems using SV48 #1707
Comments
Hi, Indeed ASAN was ported to RISC-V when Sv39 was the default addressing mode, and changes to run it in Sv48/Sv57 must be made. |
Mark. Currently, the mainline Linux kernel from v6.6-6.8rc3 uses sv39 for mmap by default. Although the commit message says it uses sv48 by default, it's a bug and I have submitted patches to solve it. However, if the ASAN only works on sv39, it will be a regression for ASAN if it uses sv48 by default. I will keep an eye on this. |
The issue address-sanitizer check failure arises when attempting to run a testcase compiled with AddressSanitizer on RISC-V 64 systems using the SV48 and SV57 virtual address scheme. This error occurs due to the lack of support for SV48 and SV57 in ASAN, which was originally designed for SV39 in Riscv64 architecture. This patch disables SV48 and SV57 support in QEMU and modifying the kernel to use SV39 by default. Upstream-Status: Backport [google/sanitizers#1707] (From OE-Core rev: b4dd7156da47c6abd0dff52ac8c4a29d91a03f5a) Signed-off-by: Deepthi Hemraj <Deepthi.Hemraj@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
The issue address-sanitizer check failure arises when attempting to run a testcase compiled with AddressSanitizer on RISC-V 64 systems using the SV48 and SV57 virtual address scheme. This error occurs due to the lack of support for SV48 and SV57 in ASAN, which was originally designed for SV39 in Riscv64 architecture. This patch disables SV48 and SV57 support in QEMU and modifying the kernel to use SV39 by default. Upstream-Status: Backport [google/sanitizers#1707] Signed-off-by: Deepthi Hemraj <Deepthi.Hemraj@windriver.com>
Linux ubuntu 6.5.0-9-generic #9.1-Ubuntu
qemu-system-riscv64 -machine virt
On any RISC-V 64 Linux systems using SV48 virtual address scheme (for example, with sufficiently recent versions of QEMU and Linux kernel), build and run any C program with ASAN enabled, for example:
This results in the following error when running
./a.out
:Note that in the error message, the first argument value
0x7fff842
resembles the upper half of a 47-bit virtual memory address in the target program, while the second argument value0x40000
resembles the upper limit of a 38-bit address space. This clearly indicates lack of support for 48-bit virtual address space (aka. SV48) on RISC-V (i.e. only the plain-old SV39 is supported).As a temporary workaround for this problem, I had to manually disable SV48 support in QEMU by modifying
qemu/target/riscv/csr.c
and recompilingqemu-system-riscv64
:This would solve my problem and make programs compiled with ASAN work as expected.
The text was updated successfully, but these errors were encountered: