From 4caf37e83b6b59d32e612226909b492e64def2ee Mon Sep 17 00:00:00 2001 From: "Zhao, Maosu" Date: Mon, 12 Oct 2026 08:53:36 +0200 Subject: [PATCH 1/2] [DeviceASAN] Accept lower Shared USM addresses on PVC Linux can return valid Shared USM addresses below 0x700000000000. The PVC allocator assertion rejects these addresses even though ASan supports the full lower 47-bit range. --- .../AddressSanitizer/misaligned/misalign-long.cpp | 3 +++ .../sanitizer/sanitizer_common/sanitizer_allocator.cpp | 9 ++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/sycl/test-e2e/AddressSanitizer/misaligned/misalign-long.cpp b/sycl/test-e2e/AddressSanitizer/misaligned/misalign-long.cpp index 288feb18fe60c..105a8d2aaa350 100644 --- a/sycl/test-e2e/AddressSanitizer/misaligned/misalign-long.cpp +++ b/sycl/test-e2e/AddressSanitizer/misaligned/misalign-long.cpp @@ -5,6 +5,9 @@ // RUN: %{run} not --crash %t2.out 2>&1 | FileCheck %s // RUN: %{build} %device_asan_flags -O2 -g -o %t3.out // RUN: %{run} not --crash %t3.out 2>&1 | FileCheck %s +// An unlimited stack selects Linux's legacy mmap layout, allowing Shared USM +// addresses below the usual PVC range starting at 0x700000000000. +// RUN: %if gpu %{ %{run} not --crash sh -c 'ulimit -s unlimited && exec "$@"' sh %t3.out 2>&1 | FileCheck %s %} #include #include #include diff --git a/unified-runtime/source/loader/layers/sanitizer/sanitizer_common/sanitizer_allocator.cpp b/unified-runtime/source/loader/layers/sanitizer/sanitizer_common/sanitizer_allocator.cpp index 075558dab320d..9a3421ad64f7d 100644 --- a/unified-runtime/source/loader/layers/sanitizer/sanitizer_common/sanitizer_allocator.cpp +++ b/unified-runtime/source/loader/layers/sanitizer/sanitizer_common/sanitizer_allocator.cpp @@ -33,7 +33,14 @@ void validateSharedUSM([[maybe_unused]] uptr Allocated, [[maybe_unused]] DeviceType DeviceType) { switch (DeviceType) { case DeviceType::GPU_PVC: - assert((Allocated >> 44) == 0x7); + // FIXME: ASan supports all lower 47-bit addresses, including Shared USM + // placed below 0x700000000000 by Linux. MSan/TSan discard more address + // bits, so relaxing their checks could alias shadow memory. They can still + // hit this assertion until their shadow mappings support the wider range. + if (getContext()->enabledType == SanitizerType::AddressSanitizer) + assert((Allocated >> 47) == 0); + else + assert((Allocated >> 44) == 0x7); break; default: break; From fd9ed0678ba2efbceb72901c6eda4ba468a9b33f Mon Sep 17 00:00:00 2001 From: "Zhao, Maosu" Date: Tue, 20 Oct 2026 08:16:20 +0200 Subject: [PATCH 2/2] resolve comment --- sycl/test-e2e/AddressSanitizer/misaligned/misalign-long.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sycl/test-e2e/AddressSanitizer/misaligned/misalign-long.cpp b/sycl/test-e2e/AddressSanitizer/misaligned/misalign-long.cpp index 105a8d2aaa350..9be29ab2bef4a 100644 --- a/sycl/test-e2e/AddressSanitizer/misaligned/misalign-long.cpp +++ b/sycl/test-e2e/AddressSanitizer/misaligned/misalign-long.cpp @@ -7,7 +7,7 @@ // RUN: %{run} not --crash %t3.out 2>&1 | FileCheck %s // An unlimited stack selects Linux's legacy mmap layout, allowing Shared USM // addresses below the usual PVC range starting at 0x700000000000. -// RUN: %if gpu %{ %{run} not --crash sh -c 'ulimit -s unlimited && exec "$@"' sh %t3.out 2>&1 | FileCheck %s %} +// RUN: %if arch-intel_gpu_pvc %{ %{run} not --crash sh -c 'ulimit -s unlimited && exec "$@"' sh %t3.out 2>&1 | FileCheck %s %} #include #include #include