|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2013-12-02 14:01 UTC] mike@php.net
[2013-12-02 14:01 UTC] mike@php.net
-Status: Open
+Status: Closed
[2013-12-02 16:51 UTC] ab@php.net
[2014-01-17 21:59 UTC] bwoebi@php.net
[2014-02-06 08:43 UTC] bwoebi@php.net
[2016-07-20 11:41 UTC] davey@php.net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Oct 27 12:00:02 2025 UTC |
Description: ------------ ThreadSanitizer has detected a data race in php_xsl.c. The function xsltSetGenericErrorFunc is not thread safe, yet it can be accessed concurrently by separate threads from the request INIT & SHUTDOWN handlers in the xslt extension. /* {{{ PHP_RINIT_FUNCTION */ PHP_RINIT_FUNCTION(xsl) { xsltSetGenericErrorFunc(NULL, php_libxml_error_handler); return SUCCESS; } /* }}} */ /* {{{ PHP_RSHUTDOWN_FUNCTION */ PHP_RSHUTDOWN_FUNCTION(xsl) { xsltSetGenericErrorFunc(NULL, NULL); return SUCCESS; } xsltSetGenericErrorFunc uses two global variables to record state, with no protection against concurrent access. from xsltutils.c xmlGenericErrorFunc xsltGenericError = xsltGenericErrorDefaultFunc; void *xsltGenericErrorContext = NULL; /** * xsltSetGenericErrorFunc: * @ctx: the new error handling context * @handler: the new handler function * * Function to reset the handler and the error context for out of * context error messages. * This simply means that @handler will be called for subsequent * error messages while not parsing nor validating. And @ctx will * be passed as first argument to @handler * One can simply force messages to be emitted to another FILE * than * stderr by setting @ctx to this file handle and @handler to NULL. */ void xsltSetGenericErrorFunc(void *ctx, xmlGenericErrorFunc handler) { xsltGenericErrorContext = ctx; if (handler != NULL) xsltGenericError = handler; else xsltGenericError = xsltGenericErrorDefaultFunc; } Calling xsltSetGenericErrorFunc from the module initializer should solve this problem. Test script: --------------- build PHP with --enable-maintainer-zts. Execute concurrent requests.