forked from torvalds/linux
-
Notifications
You must be signed in to change notification settings - Fork 136
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
lkl: fix syscall tls handling issue when used w/ dlmopen
This is problematic when an application uses TLS on thread 0, and LKL is loaded via dlmopen. when lkl_syscall is called, it tries to get pthread_key but there are existing key/data, then lkl_syscall uses the existing one and it's not task_struct so, crashed. The root cause is that __pthread_keys is a global symbol and isolated via namespace created by dlmopen, while pthread_getspecific looks at the storage of the thread, which are not isolated via dlmopen. There are a discussion which I found. - pthread_key_create, pthread_setspecific are incompatible with dlmopen https://sourceware.org/bugzilla/show_bug.cgi?id=24776 A work around is to avoid using pthread_key API when LKL is loaded via dlmopen(3) and replace TLS function upon the initialization. We only fixed for posix host environment as dlmopen(3) is only usable on Linux implementation (AFAIK). Signed-off-by: Hajime Tazaki <[email protected]>
- Loading branch information
Showing
3 changed files
with
102 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters