xcir / libvmod-parsereq

This project is deprecated

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

segfault on x86

comotion opened this issue · comments

Hey,
I've tested your module on a 32-bit machine with varnish 3.0.3 and I'm getting segfaults in init:

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0xb775bb40 (LWP 6418)]
vmodreq_free (c=0x7fffffff) at vmod_parsereq.c:23
23 CHECK_OBJ_NOTNULL(c, VMOD_REQUEST_MAGIC);
(gdb) where
#0 vmodreq_free (c=0x7fffffff) at vmod_parsereq.c:23
#1 vmod_Hook_unset_deliver (sp=0xa8314004) at vmod_parsereq.c:428
#2 0x08084023 in VCL_deliver_method (sp=0xa8314004) at ../../include/vcl_returns.h:62
#3 0x0805ef63 in cnt_prepresp (sp=0xa8314004) at cache_center.c:221
#4 0x080602da in CNT_Session (sp=0xa8314004) at steps.h:44
#5 0x0807dcb3 in wrk_thread_real (qp=0xb7602580, shm_workspace=, sess_workspace=16384, nhttp=64, http_space=604, siov=128)

at cache_pool.c:186

#6 0x0807e33e in wrk_thread (priv=0xb7602580) at cache_pool.c:235
#7 0x0056ed4c in start_thread () from /lib/i386-linux-gnu/libpthread.so.0
#8 0x00a18f4e in clone () from /lib/i386-linux-gnu/libc.so.6

Sorry, I forgot a test and support for 32-bit.
I'll fix it.

I'm building a 32-bit environment, now. ;-)

This issue was fix.
Thank you!

hey, why the usage of vcl.use will cause a segfault on a vcl with the vmod loaded ? thanks in advance

Parsereq module interrupt to vcl action by hook.
(ref: http://blog.xcir.net/index.php/2012/05/how-to-hook-vcl-function-at-vmod/ )
Parsereq holding original vcl action function pointer.(hook-chain)
But, vcl.use/discard is not raise event.(vcl_init/fini/and other)
Can't fix hook-chain.
Therefore, get a segfault.

thank you for your reply, i used the vmld in my vps, and unfortunately i vcl.use a lot, so sometimes i got this stack trace:

i think that, it is caused by the bellowing code,

when vcl.use, the varnish will produce a new vcl, whose deliver_func != vmod_Hook_unset_deliver, so hook_done is set to zero, at the same time, if a session who hold an old vcl instance came to the if (hook_done == 1), it will fall into the code snippet of setting hooks, thus double hook and vmld_Hook_unset_deliver will eventually call itself

i think this issue can be mitigated by protecting hook_done by some lock, and carefully check the hook function ?

On Sep 22, 2013, at 10:12 PM, Shohei Tanaka notifications@github.com wrote:

Parsereq module interrupt to vcl action by hook.
(ref: http://blog.xcir.net/index.php/2012/05/how-to-hook-vcl-function-at-vmod/ )
Parsereq holding original vcl action function pointer.(hook-chain)
But, vcl.use/discard is not raise event.(vcl_init/fini/and other)
Can't fix hook-chain.
Therefore, get a segfault.


Reply to this email directly or view it on GitHub.