[ANNOUNCE] auth request module

agentzh agentzh at gmail.com
Thu Mar 11 13:05:51 MSK 2010


On Mon, Mar 1, 2010 at 4:45 PM, Valery Kholodkov >> It's mostly an
issue in the ngx_eval, not your excellent
>> ngx_auth_request ;)
>
> What kind of issue is it?
>

ngx_eval cannot be used in subrequests. Consider the following example:

    location /foo {
        add_before_body /bah;
        #echo_location_async /bah;
        echo done;
    }
    location /bah {
        eval $foo {
            proxy_pass $scheme://127.0.0.1:$server_port/baz;
        }
        echo [$foo];
    }
    location /baz {
        echo baz;
    }

Accessing /bah gives the correct output (using the git HEAD of your repos):

    [baz]

But accessing /foo results in a segfault. Here's the gdb output:

Program received signal SIGSEGV, Segmentation fault.
memcpy () at ../sysdeps/i386/i686/memcpy.S:100
100	../sysdeps/i386/i686/memcpy.S: No such file or directory.
	in ../sysdeps/i386/i686/memcpy.S
Current language:  auto
The current source language is "auto; currently asm".
(gdb) bt
#0  memcpy () at ../sysdeps/i386/i686/memcpy.S:100
#1  0x0804fb6e in ngx_vslprintf (buf=0x3ffffafa <Address 0x3ffffafa
out of bounds>,
    last=0xbffff3ac "\005", fmt=0x80aaa1c "V?%V\"", args=0xbffff3e4 "")
    at /usr/include/bits/string3.h:52
#2  0x0804be81 in ngx_log_error_core (level=805306387, log=0x80c6258,
err=527676,
    fmt=0x64000000 <Address 0x64000000 out of bounds>) at src/core/ngx_log.c:119
#3  0x88000075 in ?? ()
Backtrace stopped: previous frame inner to this frame (corrupt stack?)

By using ngx_echo module's echo_location_async to issue the subrequest
gives identical segfault :)

I haven't tracked deep into the source but at least the lines starting
from ngx_http_eval_module.c:141 don't like subrequests' contexts.

Sorry for the delay. I was in Hangzhou for other business in the last
few weeks :P

Cheers,
-agentzh



More information about the nginx mailing list