Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:87260 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 58593 invoked from network); 24 Jul 2015 07:17:33 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 24 Jul 2015 07:17:33 -0000 Authentication-Results: pb1.pair.com header.from=pierre.php@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=pierre.php@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.192.45 as permitted sender) X-PHP-List-Original-Sender: pierre.php@gmail.com X-Host-Fingerprint: 209.85.192.45 mail-qg0-f45.google.com Received: from [209.85.192.45] ([209.85.192.45:33379] helo=mail-qg0-f45.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 3C/00-57278-B86E1B55 for ; Fri, 24 Jul 2015 03:17:31 -0400 Received: by qged69 with SMTP id d69so7088556qge.0 for ; Fri, 24 Jul 2015 00:17:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=tkXlm69u+pjSIesIB0faeC6BphPu20ZGfTBovt3/s38=; b=cu1pWDId8clW6FnaanHgJrVpbSEsk9Ek4/XccrDjPNFTGDh8t4ue+pDNbqv40mBi7X UL3WOMvMmqWdRvH0MreKgGfAcaU73ZxTvgo+HvaZwVKKQsayY4tlNAOL1jgkmurU7Sp3 PcoWCtMB/eBfexcA8t4QvpFfISai+NiwSa/aGCEP8ddLEFtLALLkjNVfU0xOOGhUf9rN rV9KkhMJd0SI7P8aVyl8z3oB14AdZG9iEBVqvGyitsij4reYG4kFxS5TT9M32xZdT9nG DqXtEqt678UZrC3rqhMZtpEZf21GcJ9KrhJgnq97Ggd86pUzFxKZ1iDVqeMiwehE4w1+ 6pOQ== MIME-Version: 1.0 X-Received: by 10.140.40.38 with SMTP id w35mr18397020qgw.96.1437722248394; Fri, 24 Jul 2015 00:17:28 -0700 (PDT) Received: by 10.96.151.5 with HTTP; Fri, 24 Jul 2015 00:17:28 -0700 (PDT) Received: by 10.96.151.5 with HTTP; Fri, 24 Jul 2015 00:17:28 -0700 (PDT) In-Reply-To: <55B136BE.8010006@gmx.de> References: <55B0CADD.8000807@gmx.de> <55B136BE.8010006@gmx.de> Date: Fri, 24 Jul 2015 14:17:28 +0700 Message-ID: To: Christoph Becker Cc: PHP internals Content-Type: multipart/alternative; boundary=001a11c11776e6bf69051b99cbfc Subject: Re: [PHP-DEV] PCRE JIT stack size limit From: pierre.php@gmail.com (Pierre Joye) --001a11c11776e6bf69051b99cbfc Content-Type: text/plain; charset=UTF-8 On Jul 23, 2015 9:47 PM, "Christoph Becker" wrote: > > Hi Pierre, > > Pierre Joye wrote: > > > Hi Christoph, > > > > There are ways to dymacally increase the stack. Apache's modphp can use the > > apache config. Fpm, fcgi or cli can change it on windows (afair it is in > > the doc). It is possible too on Linux with ulimit. > > > > An alternative (not a big fan) would be to use setrlimit with an ini > > setting. > > Ah, I should have explained better that libpcre's JIT support is > implemented as own virtual machine, and libpcre has functions to use a > custom stack which is allocated on the heap. If these functions are not > used (as it's now in ext/pcre) a fixed 32K on the machine stack are used.[1] > > Anyhow, it is not possible to change the stack (size) during a call to > pcre_exec() (unless, maybe, libpcre would be modified), and it is not > possible (to my knowledge) to calculate the required stack size in > advance. The required stack size depends on pattern and subject. > > So basically, we have to call pcre_exec(), and if it fails due to > limited stack size, we either fail as well, or we try again. In the > latter case we could either use a bigger stack or do without JIT. In > the former case we should at least give users a setting to choose the > desired stack size, which is quite comparable to pcre.backtrack_limit > and pcre.recursion_limit. > > Therefore I tend to prefer a new ini setting (say, pcre.jitstack_limit). > That would mean, however, to add yet another ini setting, of which > there are already so many. > > [1] Only to be sure, ou mean it is a different issue than the common one (dozen of bugs for pcre about it)? Solved by increasing the stack size of the process or binary? Also an ini setting may not be portable. That's something to double check :) Cheers, Pierre > -- > Christoph M. Becker --001a11c11776e6bf69051b99cbfc--