intel / intel/confidential-computing.sgx.sdk
Is dlrealloc thread-safe in DEBUG mode?
- Dominant language
- C++
- Stars
- 2
- Forks
- 3
- PR merge metrics
- No merged PRs in 30d
Description
https://github.com/intel/linux-sgx/blob/4bb545cde056010293d0388bfa3a19882aa2ec4c/sdk/tlibc/stdlib/malloc.c#L5278
It seems that the `do_check_inuse_chunk` function is not thread-safe, so functions such as `dlmalloc` call `do_check_inuse_chunk` before releasing the lock. However, `dlrealloc` calls `do_check_inuse_chunk` without a lock.
Specifically, when I have an enclave code that call `realloc` repeatedly, the assert in do_check_inuse_chunk(Line 3311) fails, causing SIGILL
Contributor guide
Research direction
Start in sdk/tlibc/stdlib/malloc.c around dlrealloc, do_check_inuse_chunk, and the referenced assertion at line 3311. Compare dlrealloc's locking with the paths used by dlmalloc and reproduce the failure with repeated realloc calls in enclave code. Done means the assertion no longer fails during the reported workload and the thread-safety behavior is documented by the relevant tests or reproduction.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c
- Domain
- operating-systems
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100