stack ws workspace for pcre and others #1576

Federico Schwindt fgsch at lodoss.net
Wed Sep 3 17:37:09 CEST 2014


As discussed on irc the space can be allocated and shared among all threads
instead of using the stack.
I've tested it this morning and works fine. In both cases the stack trace
was present.

Without this code if we overflow the stack we just get a coredump.

Regardless of this we should lower the pcre limits for the time being based
on the information in pcrestack.


On Wed, Sep 3, 2014 at 9:13 AM, Poul-Henning Kamp <phk at phk.freebsd.dk>
wrote:

> --------
> In message <
> CAJV_h0ZfT-BwxxLf-ddz1Lb5C+W0SKvFNkKQS79CDMM9ANdnWA at mail.gmail.com>
> , Federico Schwindt writes:
>
> +#ifdef HAVE_SIGALTSTACK
> +       if (cache_param->sigsegv_handler) {
> +               char stackbuf[MINSIGSTKSZ];
> +               stack_t ss;
> +
> +               ss.ss_size = sizeof(stackbuf);
> +               ss.ss_sp = stackbuf;
> +               ss.ss_flags = 0;
> +               (void)sigaltstack(&ss, NULL);
> +       }
> +#endif
>
> This will ad 2-4 KB to all threads.
>
> Also, I'm not convinced about the wisdom of allocating the sigstack
> on the normal stack...
>
> --
> Poul-Henning Kamp       | UNIX since Zilog Zeus 3.20
> phk at FreeBSD.ORG         | TCP/IP since RFC 956
> FreeBSD committer       | BSD since 4.3-tahoe
> Never attribute to malice what can adequately be explained by incompetence.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.varnish-cache.org/lists/pipermail/varnish-dev/attachments/20140903/4d44aed4/attachment.html>


More information about the varnish-dev mailing list