Add function for users to set extra TLS needed before calling threading APIs #6
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.
Reason for this PR
When building libcurl with
CURL_DISABLE_VERBOSE_STRINGSset toOFF(verbose strings enabled), all of the internal debugprintfcalls (macro'd to libcurl's internal printf implementation, NOT newlib), to my understanding, have their format strings copied to static memory (which can be TLS?). However when making an HTTP request under a Calico non-main thread, many different crashes occur at different addresses. The only timeaddr2linegave me a proper file:line number, it pointed to here, where the format string is trying to be read. So I theorized that the thread doesn't have enough memory, changed this line to have+ 1024in the expression forneeded_sz, and no crash occurred.Changes
void threadSetPthreadExtraTls(size_t)to allow applications to set any extra TLS needed (will be 8-byte aligned) for the next created POSIX/C/C++ thread.static size_t extraTlsto be able to store the extra size needed from the function above.