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

malloc_usable_size() segfaults under the proxy library based on the jemalloc pool #894

Open
ldorau opened this issue Nov 13, 2024 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@ldorau
Copy link
Contributor

ldorau commented Nov 13, 2024

malloc_usable_size() segfaults under the proxy library based on the jemalloc pool.

When the proxy library is based on the scalable pool malloc_usable_size() works correctly.

Ref: #883

Root cause:

op_malloc_usable_size() in pool_jemalloc calls malloc_usable_size@libumf_proxy instead of malloc_usable_size@jemalloc what causes an infinite recursive loop of function calls and a segfault as a result.

@ldorau ldorau added the bug Something isn't working label Nov 13, 2024
ldorau added a commit to ldorau/unified-memory-framework that referenced this issue Nov 13, 2024
The proxyLib_size_threshold_* tests test the size threshold
of the proxy library. The size threshold is set to 64 bytes
in this test, so all allocations of:
1) size <  64 go through the default system allocator
   and (umfPoolByPtr(ptr_size < 64) == nullptr)
2) size >= 64 go through the proxy lib allocator
   and (umfPoolByPtr(ptr_size >= 64) != nullptr).

Ref: oneapi-src#894

Signed-off-by: Lukasz Dorau <[email protected]>
ldorau added a commit to ldorau/unified-memory-framework that referenced this issue Nov 13, 2024
The proxyLib_size_threshold_* tests test the size threshold
of the proxy library. The size threshold is set to 64 bytes
in this test, so all allocations of:
1) size <  64 go through the default system allocator
   and (umfPoolByPtr(ptr_size < 64) == nullptr)
2) size >= 64 go through the proxy lib allocator
   and (umfPoolByPtr(ptr_size >= 64) != nullptr).

Ref: oneapi-src#894

Signed-off-by: Lukasz Dorau <[email protected]>
ldorau added a commit to ldorau/unified-memory-framework that referenced this issue Nov 13, 2024
The proxyLib_size_threshold_* tests test the size threshold
of the proxy library. The size threshold is set to 64 bytes
in this test, so all allocations of:
1) size <  64 go through the default system allocator
   and (umfPoolByPtr(ptr_size < 64) == nullptr)
2) size >= 64 go through the proxy lib allocator
   and (umfPoolByPtr(ptr_size >= 64) != nullptr).

Ref: oneapi-src#894

Signed-off-by: Lukasz Dorau <[email protected]>
ldorau added a commit to ldorau/unified-memory-framework that referenced this issue Nov 13, 2024
The proxyLib_size_threshold_* tests test the size threshold
of the proxy library. The size threshold is set to 64 bytes
in this test, so all allocations of:
1) size <  64 go through the default system allocator
   and (umfPoolByPtr(ptr_size < 64) == nullptr)
2) size >= 64 go through the proxy lib allocator
   and (umfPoolByPtr(ptr_size >= 64) != nullptr).

Ref: oneapi-src#894

Signed-off-by: Lukasz Dorau <[email protected]>
ldorau added a commit to ldorau/unified-memory-framework that referenced this issue Nov 13, 2024
The proxyLib_size_threshold_* tests test the size threshold
of the proxy library. The size threshold is set to 64 bytes
in this test, so all allocations of:
1) size <  64 go through the default system allocator
   and (umfPoolByPtr(ptr_size < 64) == nullptr)
2) size >= 64 go through the proxy lib allocator
   and (umfPoolByPtr(ptr_size >= 64) != nullptr).

Ref: oneapi-src#894

Signed-off-by: Lukasz Dorau <[email protected]>
ldorau added a commit to ldorau/unified-memory-framework that referenced this issue Nov 13, 2024
The proxyLib_size_threshold_* tests test the size threshold
of the proxy library. The size threshold is set to 64 bytes
in this test, so all allocations of:
1) size <  64 go through the default system allocator
   and (umfPoolByPtr(ptr_size < 64) == nullptr)
2) size >= 64 go through the proxy lib allocator
   and (umfPoolByPtr(ptr_size >= 64) != nullptr).

Ref: oneapi-src#894

Signed-off-by: Lukasz Dorau <[email protected]>
ldorau added a commit to ldorau/unified-memory-framework that referenced this issue Nov 13, 2024
The proxyLib_size_threshold_* tests test the size threshold
of the proxy library. The size threshold is set to 64 bytes
in this test, so all allocations of:
1) size <  64 go through the default system allocator
   and (umfPoolByPtr(ptr_size < 64) == nullptr)
2) size >= 64 go through the proxy lib allocator
   and (umfPoolByPtr(ptr_size >= 64) != nullptr).

Ref: oneapi-src#894

Signed-off-by: Lukasz Dorau <[email protected]>
ldorau added a commit to ldorau/unified-memory-framework that referenced this issue Nov 13, 2024
The proxyLib_size_threshold_* tests test the size threshold
of the proxy library. The size threshold is set to 64 bytes
in this test, so all allocations of:
1) size <  64 go through the default system allocator
   and (umfPoolByPtr(ptr_size < 64) == nullptr)
2) size >= 64 go through the proxy lib allocator
   and (umfPoolByPtr(ptr_size >= 64) != nullptr).

Ref: oneapi-src#894

Signed-off-by: Lukasz Dorau <[email protected]>
ldorau added a commit to ldorau/unified-memory-framework that referenced this issue Nov 13, 2024
The proxyLib_size_threshold_* tests test the size threshold
of the proxy library. The size threshold is set to 64 bytes
in this test, so all allocations of:
1) size <  64 go through the default system allocator
   and (umfPoolByPtr(ptr_size < 64) == nullptr)
2) size >= 64 go through the proxy lib allocator
   and (umfPoolByPtr(ptr_size >= 64) != nullptr).

Ref: oneapi-src#894

Signed-off-by: Lukasz Dorau <[email protected]>
ldorau added a commit to ldorau/unified-memory-framework that referenced this issue Nov 13, 2024
The proxyLib_size_threshold_* tests test the size threshold
of the proxy library. The size threshold is set to 64 bytes
in this test, so all allocations of:
1) size <  64 go through the default system allocator
   and (umfPoolByPtr(ptr_size < 64) == nullptr)
2) size >= 64 go through the proxy lib allocator
   and (umfPoolByPtr(ptr_size >= 64) != nullptr).

Ref: oneapi-src#894

Signed-off-by: Lukasz Dorau <[email protected]>
ldorau added a commit to ldorau/unified-memory-framework that referenced this issue Nov 13, 2024
The proxyLib_size_threshold_* tests test the size threshold
of the proxy library. The size threshold is set to 64 bytes
in this test, so all allocations of:
1) size <  64 go through the default system allocator
   and (umfPoolByPtr(ptr_size < 64) == nullptr)
2) size >= 64 go through the proxy lib allocator
   and (umfPoolByPtr(ptr_size >= 64) != nullptr).

Ref: oneapi-src#894

Signed-off-by: Lukasz Dorau <[email protected]>
ldorau added a commit to ldorau/unified-memory-framework that referenced this issue Nov 13, 2024
The proxyLib_size_threshold_* tests test the size threshold
of the proxy library. The size threshold is set to 64 bytes
in this test, so all allocations of:
1) size <  64 go through the default system allocator
   and (umfPoolByPtr(ptr_size < 64) == nullptr)
2) size >= 64 go through the proxy lib allocator
   and (umfPoolByPtr(ptr_size >= 64) != nullptr).

Ref: oneapi-src#894

Signed-off-by: Lukasz Dorau <[email protected]>
ldorau added a commit to ldorau/unified-memory-framework that referenced this issue Nov 14, 2024
The proxyLib_size_threshold_* tests test the size threshold
of the proxy library. The size threshold is set to 64 bytes
in this test, so all allocations of:
1) size <  64 go through the default system allocator
   and (umfPoolByPtr(ptr_size < 64) == nullptr)
2) size >= 64 go through the proxy lib allocator
   and (umfPoolByPtr(ptr_size >= 64) != nullptr).

Ref: oneapi-src#894

Signed-off-by: Lukasz Dorau <[email protected]>
ldorau added a commit to ldorau/unified-memory-framework that referenced this issue Nov 14, 2024
The proxyLib_size_threshold_* tests test the size threshold
of the proxy library. The size threshold is set to 64 bytes
in this test, so all allocations of:
1) size <  64 go through the default system allocator
   and (umfPoolByPtr(ptr_size < 64) == nullptr)
2) size >= 64 go through the proxy lib allocator
   and (umfPoolByPtr(ptr_size >= 64) != nullptr).

Ref: oneapi-src#894

Signed-off-by: Lukasz Dorau <[email protected]>
ldorau added a commit to ldorau/unified-memory-framework that referenced this issue Nov 14, 2024
The proxyLib_size_threshold_* tests test the size threshold
of the proxy library. The size threshold is set to 64 bytes
in this test, so all allocations of:
1) size <  64 go through the default system allocator
   and (umfPoolByPtr(ptr_size < 64) == nullptr)
2) size >= 64 go through the proxy lib allocator
   and (umfPoolByPtr(ptr_size >= 64) != nullptr).

Ref: oneapi-src#894

Signed-off-by: Lukasz Dorau <[email protected]>
ldorau added a commit to ldorau/unified-memory-framework that referenced this issue Nov 14, 2024
The proxyLib_size_threshold_* tests test the size threshold
of the proxy library. The size threshold is set to 64 bytes
in this test, so all allocations of:
1) size <  64 go through the default system allocator
   and (umfPoolByPtr(ptr_size < 64) == nullptr)
2) size >= 64 go through the proxy lib allocator
   and (umfPoolByPtr(ptr_size >= 64) != nullptr).

Ref: oneapi-src#894

Signed-off-by: Lukasz Dorau <[email protected]>
ldorau added a commit to ldorau/unified-memory-framework that referenced this issue Nov 14, 2024
The proxyLib_size_threshold_* tests test the size threshold
of the proxy library (Linux only yet). The size threshold
is set to 64 bytes in this test, so all allocations of:
1) size <  64 go through the default system allocator
   and (umfPoolByPtr(ptr_size < 64) == nullptr)
2) size >= 64 go through the proxy lib allocator
   and (umfPoolByPtr(ptr_size >= 64) != nullptr).

Ref: oneapi-src#894

Signed-off-by: Lukasz Dorau <[email protected]>
ldorau added a commit to ldorau/unified-memory-framework that referenced this issue Nov 14, 2024
The proxyLib_size_threshold_* tests test the size threshold
of the proxy library (Linux only yet). The size threshold
is set to 64 bytes in this test, so all allocations of:
1) size <  64 go through the default system allocator
   and (umfPoolByPtr(ptr_size < 64) == nullptr)
2) size >= 64 go through the proxy lib allocator
   and (umfPoolByPtr(ptr_size >= 64) != nullptr).

Ref: oneapi-src#894

Signed-off-by: Lukasz Dorau <[email protected]>
ldorau added a commit to ldorau/unified-memory-framework that referenced this issue Nov 14, 2024
The proxyLib_size_threshold_* tests test the size threshold
of the proxy library (Linux only yet). The size threshold
is set to 64 bytes in this test, so all allocations of:
1) size <  64 go through the default system allocator
   and (umfPoolByPtr(ptr_size < 64) == nullptr)
2) size >= 64 go through the proxy lib allocator
   and (umfPoolByPtr(ptr_size >= 64) != nullptr).

Ref: oneapi-src#894

Signed-off-by: Lukasz Dorau <[email protected]>
ldorau added a commit to ldorau/unified-memory-framework that referenced this issue Nov 14, 2024
The proxyLib_size_threshold_* tests test the size threshold
of the proxy library (Linux only yet). The size threshold
is set to 64 bytes in this test, so all allocations of:
1) size <  64 go through the default system allocator
   and (umfPoolByPtr(ptr_size < 64) == nullptr)
2) size >= 64 go through the proxy lib allocator
   and (umfPoolByPtr(ptr_size >= 64) != nullptr).

Ref: oneapi-src#894

Signed-off-by: Lukasz Dorau <[email protected]>
ldorau added a commit to ldorau/unified-memory-framework that referenced this issue Nov 14, 2024
The proxyLib_size_threshold_* tests test the size threshold
of the proxy library (Linux only yet). The size threshold
is set to 64 bytes in this test, so all allocations of:
1) size <  64 go through the default system allocator
   and (umfPoolByPtr(ptr_size < 64) == nullptr)
2) size >= 64 go through the proxy lib allocator
   and (umfPoolByPtr(ptr_size >= 64) != nullptr).

Ref: oneapi-src#894

Signed-off-by: Lukasz Dorau <[email protected]>
ldorau added a commit to ldorau/unified-memory-framework that referenced this issue Nov 14, 2024
The proxyLib_size_threshold_* tests test the size threshold
of the proxy library (Linux only yet). The size threshold
is set to 64 bytes in this test, so all allocations of:
1) size <  64 go through the default system allocator
   and (umfPoolByPtr(ptr_size < 64) == nullptr)
2) size >= 64 go through the proxy lib allocator
   and (umfPoolByPtr(ptr_size >= 64) != nullptr).

Ref: oneapi-src#894

Signed-off-by: Lukasz Dorau <[email protected]>
ldorau added a commit to ldorau/unified-memory-framework that referenced this issue Nov 14, 2024
The proxyLib_size_threshold_* tests test the size threshold
of the proxy library (Linux only yet). The size threshold
is set to 64 bytes in this test, so all allocations of:
1) size <  64 go through the default system allocator
   and (umfPoolByPtr(ptr_size < 64) == nullptr)
2) size >= 64 go through the proxy lib allocator
   and (umfPoolByPtr(ptr_size >= 64) != nullptr).

Ref: oneapi-src#894

Signed-off-by: Lukasz Dorau <[email protected]>
ldorau added a commit to ldorau/unified-memory-framework that referenced this issue Nov 14, 2024
The proxyLib_size_threshold_* tests test the size threshold
of the proxy library (Linux only yet). The size threshold
is set to 64 bytes in this test, so all allocations of:
1) size <  64 go through the default system allocator
   and (umfPoolByPtr(ptr_size < 64) == nullptr)
2) size >= 64 go through the proxy lib allocator
   and (umfPoolByPtr(ptr_size >= 64) != nullptr).

Ref: oneapi-src#894

Signed-off-by: Lukasz Dorau <[email protected]>
@ldorau ldorau changed the title malloc_usable_size() segfaults under the proxy library based on the jemalloc pool with the size threshold enabled malloc_usable_size() segfaults under the proxy library based on the jemalloc pool Nov 14, 2024
ldorau added a commit to ldorau/unified-memory-framework that referenced this issue Nov 14, 2024
This WA for the issue:
oneapi-src#894
It protects us from a recursion in malloc_usable_size()
when the JEMALLOC proxy_lib_pool is used.

TODO: remove this WA when the issue is fixed.

Signed-off-by: Lukasz Dorau <[email protected]>
ldorau added a commit to ldorau/unified-memory-framework that referenced this issue Nov 14, 2024
The proxyLib_size_threshold_* tests test the size threshold
of the proxy library (Linux only yet). The size threshold
is set to 64 bytes in this test, so all allocations of:
1) size <  64 go through the default system allocator
   and (umfPoolByPtr(ptr_size < 64) == nullptr)
2) size >= 64 go through the proxy lib allocator
   and (umfPoolByPtr(ptr_size >= 64) != nullptr).

Ref: oneapi-src#894

Signed-off-by: Lukasz Dorau <[email protected]>
ldorau added a commit to ldorau/unified-memory-framework that referenced this issue Nov 15, 2024
This WA for the issue:
oneapi-src#894
It protects us from a recursion in malloc_usable_size()
when the JEMALLOC proxy_lib_pool is used.

TODO: remove this WA when the issue is fixed.

Signed-off-by: Lukasz Dorau <[email protected]>
ldorau added a commit to ldorau/unified-memory-framework that referenced this issue Nov 15, 2024
The proxyLib_size_threshold_* tests test the size threshold
of the proxy library (Linux only yet). The size threshold
is set to 64 bytes in this test, so all allocations of:
1) size <  64 go through the default system allocator
   and (umfPoolByPtr(ptr_size < 64) == nullptr)
2) size >= 64 go through the proxy lib allocator
   and (umfPoolByPtr(ptr_size >= 64) != nullptr).

Ref: oneapi-src#894

Signed-off-by: Lukasz Dorau <[email protected]>
ldorau added a commit to ldorau/unified-memory-framework that referenced this issue Nov 18, 2024
This WA for the issue:
oneapi-src#894
It protects us from a recursion in malloc_usable_size()
when the JEMALLOC proxy_lib_pool is used.

TODO: remove this WA when the issue is fixed.

Signed-off-by: Lukasz Dorau <[email protected]>
ldorau added a commit to ldorau/unified-memory-framework that referenced this issue Nov 18, 2024
The proxyLib_size_threshold_* tests test the size threshold
of the proxy library (Linux only yet). The size threshold
is set to 64 bytes in this test, so all allocations of:
1) size <  64 go through the default system allocator
   and (umfPoolByPtr(ptr_size < 64) == nullptr)
2) size >= 64 go through the proxy lib allocator
   and (umfPoolByPtr(ptr_size >= 64) != nullptr).

Ref: oneapi-src#894

Signed-off-by: Lukasz Dorau <[email protected]>
ldorau added a commit to ldorau/unified-memory-framework that referenced this issue Nov 18, 2024
This WA for the issue:
oneapi-src#894
It protects us from a recursion in malloc_usable_size()
when the JEMALLOC proxy_lib_pool is used.

TODO: remove this WA when the issue is fixed.

Signed-off-by: Lukasz Dorau <[email protected]>
ldorau added a commit to ldorau/unified-memory-framework that referenced this issue Nov 18, 2024
The proxyLib_size_threshold_* tests test the size threshold
of the proxy library (Linux only yet). The size threshold
is set to 64 bytes in this test, so all allocations of:
1) size <  64 go through the default system allocator
   and (umfPoolByPtr(ptr_size < 64) == nullptr)
2) size >= 64 go through the proxy lib allocator
   and (umfPoolByPtr(ptr_size >= 64) != nullptr).

Ref: oneapi-src#894

Signed-off-by: Lukasz Dorau <[email protected]>
ldorau added a commit to ldorau/unified-memory-framework that referenced this issue Nov 19, 2024
This WA for the issue:
oneapi-src#894
It protects us from a recursion in malloc_usable_size()
when the JEMALLOC proxy_lib_pool is used.

TODO: remove this WA when the issue is fixed.

Signed-off-by: Lukasz Dorau <[email protected]>
ldorau added a commit to ldorau/unified-memory-framework that referenced this issue Nov 19, 2024
The proxyLib_size_threshold_* tests test the size threshold
of the proxy library (Linux only yet). The size threshold
is set to 64 bytes in this test, so all allocations of:
1) size <  64 go through the default system allocator
   and (umfPoolByPtr(ptr_size < 64) == nullptr)
2) size >= 64 go through the proxy lib allocator
   and (umfPoolByPtr(ptr_size >= 64) != nullptr).

Ref: oneapi-src#894

Signed-off-by: Lukasz Dorau <[email protected]>
ldorau added a commit to ldorau/unified-memory-framework that referenced this issue Nov 19, 2024
This WA for the issue:
oneapi-src#894
It protects us from a recursion in malloc_usable_size()
when the JEMALLOC proxy_lib_pool is used.

TODO: remove this WA when the issue is fixed.

Signed-off-by: Lukasz Dorau <[email protected]>
ldorau added a commit to ldorau/unified-memory-framework that referenced this issue Nov 19, 2024
The proxyLib_size_threshold_* tests test the size threshold
of the proxy library (Linux only yet). The size threshold
is set to 64 bytes in this test, so all allocations of:
1) size <  64 go through the default system allocator
   and (umfPoolByPtr(ptr_size < 64) == nullptr)
2) size >= 64 go through the proxy lib allocator
   and (umfPoolByPtr(ptr_size >= 64) != nullptr).

Ref: oneapi-src#894

Signed-off-by: Lukasz Dorau <[email protected]>
@ldorau ldorau self-assigned this Nov 19, 2024
ldorau added a commit to ldorau/unified-memory-framework that referenced this issue Nov 20, 2024
Do not link with the jemalloc library explicitly,
but load it dynamically (using dlopen()).

Ref: oneapi-src#891
Ref: oneapi-src#894

Signed-off-by: Lukasz Dorau <[email protected]>
ldorau added a commit to ldorau/unified-memory-framework that referenced this issue Nov 21, 2024
Do not link with the jemalloc library explicitly,
but load it dynamically (using dlopen()).

Ref: oneapi-src#891
Ref: oneapi-src#894

Signed-off-by: Lukasz Dorau <[email protected]>
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