fix: use pthread_self() in thread callbacks instead of parent-stored handle#844
Open
aki1770-del wants to merge 1 commit into
Open
fix: use pthread_self() in thread callbacks instead of parent-stored handle#844aki1770-del wants to merge 1 commit into
aki1770-del wants to merge 1 commit into
Conversation
…handle pthread_setname_np is called with a handle stored by the parent thread before pthread_create returns, causing a race where the handle is zero/uninitialized at callback entry. On musl C this causes a coredump. Replace both sites with pthread_self(). Fixes COVESA#811.
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #811.
Bug
Two thread callbacks in `src/lib/dlt_user.c` call `pthread_setname_np` with a handle stored by the parent thread:
Both handles are written by `pthread_create` in the parent. Because the callback begins executing before `pthread_create` returns, the handle is zero or uninitialized at the point `pthread_setname_np` is called. On musl C (standard in many embedded Linux / Yocto configurations), this causes a coredump.
The callbacks are already running in the target thread — `pthread_self()` is the correct and sufficient call.
Fix
```diff
```
```diff
```
Files: `src/lib/dlt_user.c` — +2/−2
AI-assisted — authored with Claude, reviewed by Komada.