Created attachment 6720 [details]
Function make_request() in sysdeps/unix/sysv/linux/check_pf.c uses alloca() to allocate memory for the temporary linked list of local addresses. If the host has many addresses (originally observed with more than 7000 addresses and 256 KB stack size limit), this can cause stack overflow.
Attached is a fix proposal which is a bit more complicated than necessary but I wanted to avoid
(1) calling malloc() in the most common case when there are just a few
(2) allocating many small blocks if there are many addresses
(3) allocating too much memory on stack
Thus the patch allocates a small block for 16 addresses on stack; if this is not enough (usually it is), linked list of blocks for 64 addresses is allocated as needed (suitable values of 16 and 64 are open to discussion).
Could you please post the patch on libc-alpha AT sourceware DOT org? It can then be reviewed and pushed into git. Please go through the following wiki document for guidelines for posting the patch:
Michal, the patch needs comments and adoption for GNU coding style, especially spaces before parents.
Could you improve your patch, please?
Alternative patch was proposed at BZ #16002
*** This bug has been marked as a duplicate of bug 16002 ***