Skip to content
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

Memory poisoning failure for allocations on a device #634

Open
PatKamin opened this issue Jul 24, 2024 · 1 comment
Open

Memory poisoning failure for allocations on a device #634

PatKamin opened this issue Jul 24, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@PatKamin
Copy link
Contributor

Environment Information

  • UMF version (hash commit or a tag): main
  • compiler, libraries, and other related tools version(s): clang-15, possibly other compilers

Please provide a reproduction of the bug:

  • Build Unified Runtime with L0 and ASan enabled
  • Run fuzztest which allocates memory on a GPU device

How often bug is revealed:

always
(always, often, rare)

Actual behavior:

AddressSanitizer: CHECK failed: asan_mapping.h:359 "((AddrIsInMem(p))) != (0)" (0x0, 0x0)
#0 0x55c51330ce81 in __asan::CheckUnwind() asan_rtl.cpp.o
#1 0x55c513325814 in __sanitizer::CheckFailed(char const*, int, char const*, unsigned long long, unsigned long long) (unified-runtime/build/bin/fuzztest-base+0x165814) (BuildId: b0932a052df3ffbe6c2d5a2e30dfccfbe77ef111)
#2 0x55c51330590c in __asan::ShadowSegmentEndpoint::ShadowSegmentEndpoint(unsigned long) (unified-runtime/build/bin/fuzztest-base+0x14590c) (BuildId: b0932a052df3ffbe6c2d5a2e30dfccfbe77ef111)
#3 0x55c5133056d8 in __asan_poison_memory_region (unified-runtime/build/bin/fuzztest-base+0x1456d8) (BuildId: b0932a052df3ffbe6c2d5a2e30dfccfbe77ef111)
#4 0x7fa8fa7928b4 in utils_annotate_memory_inaccessible(void*, unsigned long) unified-runtime/build/_deps/unified-memory-framework-src/src/utils/utils_sanitizers.h:162:5
#5 0x7fa8fa78495a in memoryProviderAlloc(umf_memory_provider_t*, unsigned long, unsigned long) unified-runtime/build/_deps/unified-memory-framework-src/src/pool/pool_disjoint.cpp:403:5
#6 0x7fa8fa784228 in Slab::Slab(Bucket&) unified-runtime/build/_deps/unified-memory-framework-src/src/pool/pool_disjoint.cpp:441:14
#7 0x7fa8fa79bb40 in std::__detail::_MakeUniq<Slab>::__single_object std::make_unique<Slab, Bucket&>(Bucket&) /usr/bin/../lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/bits/unique_ptr.h:1065:34
#8 0x7fa8fa78c5a0 in Bucket::getAvailSlab(bool&) unified-runtime/build/_deps/unified-memory-framework-src/src/pool/pool_disjoint.cpp:637:41
#9 0x7fa8fa78ce16 in Bucket::getChunk(bool&) unified-runtime/build/_deps/unified-memory-framework-src/src/pool/pool_disjoint.cpp:660:19
#10 0x7fa8fa7911f9 in DisjointPool::AllocImpl::allocate(unsigned long, unsigned long, bool&) unified-runtime/build/_deps/unified-memory-framework-src/src/pool/pool_disjoint.cpp:889:22
#11 0x7fa8fa79450d in DisjointPool::aligned_malloc(unsigned long, unsigned long) unified-runtime/build/_deps/unified-memory-framework-src/src/pool/pool_disjoint.cpp:1043:22
#12 0x7fa8fa7b9b5c in auto umf_memory_pool_ops_t umf::detail::poolOpsBase<DisjointPool>()::'lambda1'(void*, auto...)::operator()<unsigned long, unsigned long>(void*, auto...) const unified-runtime/build/_deps/unified-memory-framework-src/src/pool/../cpp_helpers.hpp:74:5
#13 0x7fa8fa7b9aec in auto umf_memory_pool_ops_t umf::detail::poolOpsBase<DisjointPool>()::'lambda1'(void*, auto...)::__invoke<unsigned long, unsigned long>(void*, auto...) unified-runtime/build/_deps/unified-memory-framework-src/src/pool/../cpp_helpers.hpp:74:5
#14 0x7fa8fd093921 in umfPoolAlignedMalloc unified-runtime/build/_deps/unified-memory-framework-src/src/memory_pool.c:12
#15 0x7fa8fa44f6b3 in urUSMDeviceAlloc unified-runtime/source/adapters/level_zero/usm.cpp:426:13

Expected behavior:

CHECK passes.

Details

We need a way to determine in Disjoint Pool whether the allocation is made on a host memory or a device memory. In cases of allocations made on a host memory, we can enable memory poison/unpoison.

Additional information about Priority and Help Requested:

Are you willing to submit a pull request with a proposed change? Yes (Yes, No)

Requested priority: High (Showstopper, High, Medium, Low)

@PatKamin PatKamin added the bug Something isn't working label Jul 24, 2024
@PatKamin
Copy link
Contributor Author

One way to enable memory poisoning for host allocations is to introduce a new parameter in DisjointPool params struct:
image
Then set it when creating a Disjoint Pool that will allocate only host memory.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant