Copilot commented on code in PR #13661:
URL: https://github.com/apache/trafficserver/pull/13661#discussion_r3983934830


##########
src/tsutil/Regex.cc:
##########
@@ -499,6 +514,8 @@ Regex::exec(std::string_view subject, RegexMatches 
&matches, uint32_t flags, Reg
   bool const     full_match  = (flags & RE_FULL_MATCH) != 0;
   uint32_t const pcre2_flags = flags & ~RE_FULL_MATCH;
 
+  arm_jit_stack_cleanup();

Review Comment:
   `arm_jit_stack_cleanup()` still initializes a TLS object with a non-trivial 
destructor, which registers it through `__cxa_thread_atexit` and can take the 
loader lock. This call is unconditional and now also runs for caller-supplied 
contexts; moving it before `pcre2_match` only avoids initialization from 
PCRE2's callback, not the case where `Regex::exec()` itself is entered while a 
plugin is under the loader lock. The existing `src/tscore/Diags.cc:339-346` 
comment documents this lock-order hazard for `Regex::exec`; use a cleanup 
mechanism whose first-use path does not register a C++ TLS destructor, or 
otherwise initialize it before loader-sensitive code.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to