Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:22504 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 51039 invoked by uid 1010); 17 Mar 2006 13:33:08 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 51024 invoked from network); 17 Mar 2006 13:33:07 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 17 Mar 2006 13:33:07 -0000 X-Host-Fingerprint: 64.233.166.177 pproxy.gmail.com Linux 2.4/2.6 Received: from ([64.233.166.177:24291] helo=pproxy.gmail.com) by pb1.pair.com (ecelerity 2.0 beta r(6323M)) with SMTP id 8F/35-55982-39ABA144 for ; Fri, 17 Mar 2006 08:33:07 -0500 Received: by pproxy.gmail.com with SMTP id b36so1083726pyb for ; Fri, 17 Mar 2006 05:33:05 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=BDLnKTpgOGKFrSG+XXrSRi3ekFaBp1j8GLHWsujsAuUOjZx4LpzGtBxfA46NjaIKK5ZI1Po+R8uFPfxlZvsbcXznH5UQcKMLh2DswtevG+2riOmzy8Ud0cGb6MULwgD3dDw5LzB9OVX1rapuU4G/cM+Jg/KtA+dHHFUgcwjE8g4= Received: by 10.35.18.4 with SMTP id v4mr516132pyi; Fri, 17 Mar 2006 05:33:05 -0800 (PST) Received: by 10.35.41.17 with HTTP; Fri, 17 Mar 2006 05:33:05 -0800 (PST) Message-ID: <4e89b4260603170533p529a7bcdh92bd0653ad493c01@mail.gmail.com> Date: Fri, 17 Mar 2006 08:33:05 -0500 To: "Rob Richards" Cc: "Dmitry Stogov" , internals@lists.php.net In-Reply-To: <441AA4FB.9000209@ctindustries.net> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <000001c649b6$8668abc0$6e02a8c0@thinkpad> <441AA4FB.9000209@ctindustries.net> Subject: Re: [PHP-DEV] Problem with ext/libxml RINIT/RSHUTDOWN From: kingwez@gmail.com ("Wez Furlong") Sounds like a nasty situation. I don't think it's possible to sanely restore the handlers at rshutdown in a threaded build without screwing up the other threads that are currently executing. My suggestion is to not restore the handlers for threaded builds, and if there is a library sharing/abuse issue, then treat it as an installation/configuration problem for the person deploying it (eg: don't do that!). There's not much you can do about that without rewriting libxml2 to not use globals for the callbacks. :-/ --Wez. On 3/17/06, Rob Richards wrote: > Dmitry Stogov wrote: > > Hi Wez, > > > > I found a bad code in ext/libxml. > > > > On each request startup/shutdown it changing some libxml callbacks. > > At first this slowdown each request, at second multi-threaded PHP may f= ail, > > because different threads may set/clean the same callbacks in the same = time. > > > > May be it is possible to setup these callbacks forever in MINIT/MSHUTDO= WN, > > set some flag (somthing like LIBXML(in_request)) in RINIT/RSHUTDOWN, an= d > > check it in callbacks. > > > Which ones in particular? > Each of the callbacks being utilized are thread safe. > The reason why they need to be set per request is in order to play nice > with any other modules that might be loaded and use libxml2. > > for example: prior to how the current callbacks are implemented it was > possible to blow away PHP stream usage by any of the xml extensions > using mod_perl and its xsl module (could do this whether or not PHP was > running threaded). > There are also many other ways to screw with the libxml2 globals and > effect PHP extensions based on libxml2 as well using other modules so > the only way to protect them is on each request. In short putting them > into the MINIT/MSHUTDOWN will open security holes. > > Rob >