oneapi-src / oneapi-src/unified-memory-framework

Memory poisoning failure for allocations on a device

Open
#634 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
C
Stars
98
Forks
48
Avg merge
3d 20h
Merged PRs (30d)
6

Description

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)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the ASan stack in src/pool/pool_disjoint.cpp and src/utils/utils_sanitizers.h, then reproduce it by building Unified Runtime with Level Zero and ASan and running fuzztest. Determine how the Disjoint Pool distinguishes host from device allocations; done means host memory can be poisoned while device allocations no longer trigger the ASan CHECK.

Written by the indexing model from the issue text.

Assessment

Tech stack
c, cpp
Domain
backend, testing-qa
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.