intel / intel/confidential-computing.sgx.sdk

Thread Local Storage (thread_local) implementation missing __cxa_thread_atexit

Open
#19 2 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
C++
Stars
2
Forks
3
PR merge metrics
No merged PRs in 30d

Description

The following code causes link error within an enclave:

int g = 0;
struct MyStruct {
~MyStruct() { ++g; }
};
thread_local MyStruct s;

Enclave/Enclave.o: In function __tls_init:
Enclave.cpp: undefined reference to `__cxa_thread_atexit'

The compiler emits the call to __cxa_thread_atexit is called with pointers to the destructor as well as the object so that the destructor can be called on the object when the thread exits.

Contributor guide

Open the contributing guide

Research direction

Start from the enclave TLS initialization entry point (__tls_init) and the missing __cxa_thread_atexit symbol described in the linker error. Trace how thread-local destructors are handled in the SGX enclave runtime, then validate the behavior with the provided MyStruct example and its expected destructor call at thread exit.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
security
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.