Hi

Am 23.04.2018 um 22:51 schrieb PiBa-NL:
> Below script makes haproxy perform a coredump when a function that
> doesnt loop forever is put into register_task.. is it possible to add
> some safety checks around such calls.?.
> 
> The coredump does not seem to contain any useful info when read by gdb..
> unkown functions at unkown addresses...

I can confirm the segmentation fault. Here's the valgrind result:

> [info] 113/133904 (6759) : Stopping task
> ==6759== Invalid read of size 8
> ==6759==    at 0x5B60AA9: lua_sethook (in 
> /usr/lib/x86_64-linux-gnu/liblua5.3.so.0.0.0)
> ==6759==    by 0x430264: hlua_ctx_resume (hlua.c:1009)
> ==6759==    by 0x43BB68: hlua_process_task (hlua.c:5525)
> ==6759==    by 0x4FED0A: process_runnable_tasks (task.c:231)
> ==6759==    by 0x4B2256: run_poll_loop (haproxy.c:2397)
> ==6759==    by 0x4B2256: run_thread_poll_loop (haproxy.c:2459)
> ==6759==    by 0x41A7E4: main (haproxy.c:3049)
> ==6759==  Address 0x20 is not stack'd, malloc'd or (recently) free'd
> ==6759== 
> ==6759== 
> ==6759== Process terminating with default action of signal 11 (SIGSEGV)
> ==6759==  Access not within mapped region at address 0x20
> ==6759==    at 0x5B60AA9: lua_sethook (in 
> /usr/lib/x86_64-linux-gnu/liblua5.3.so.0.0.0)
> ==6759==    by 0x430264: hlua_ctx_resume (hlua.c:1009)
> ==6759==    by 0x43BB68: hlua_process_task (hlua.c:5525)
> ==6759==    by 0x4FED0A: process_runnable_tasks (task.c:231)
> ==6759==    by 0x4B2256: run_poll_loop (haproxy.c:2397)
> ==6759==    by 0x4B2256: run_thread_poll_loop (haproxy.c:2459)
> ==6759==    by 0x41A7E4: main (haproxy.c:3049)
> ==6759==  If you believe this happened as a result of a stack
> ==6759==  overflow in your program's main thread (unlikely but
> ==6759==  possible), you can try to increase the size of the
> ==6759==  main thread stack using the --main-stacksize= flag.
> ==6759==  The main thread stack size used in this run was 8388608.
> ==6759== 
> ==6759== HEAP SUMMARY:
> ==6759==     in use at exit: 612,495 bytes in 2,461 blocks
> ==6759==   total heap usage: 2,843 allocs, 382 frees, 805,543 bytes allocated
> ==6759== 
> ==6759== LEAK SUMMARY:
> ==6759==    definitely lost: 0 bytes in 0 blocks
> ==6759==    indirectly lost: 0 bytes in 0 blocks
> ==6759==      possibly lost: 111,561 bytes in 1,394 blocks
> ==6759==    still reachable: 500,934 bytes in 1,067 blocks
> ==6759==         suppressed: 0 bytes in 0 blocks
> ==6759== Rerun with --leak-check=full to see details of leaked memory
> ==6759== 
> ==6759== For counts of detected and suppressed errors, rerun with: -v
> ==6759== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0)
> fish: “valgrind ./haproxy -d -f ./hapr…” terminated by signal SIGSEGV 
> (Address boundary error)

Build options:

> Build options :
>   TARGET  = linux2628
>   CPU     = generic
>   CC      = gcc
>   CFLAGS  = -O2 -g -fno-strict-aliasing -Wdeclaration-after-statement -fwrapv 
> -fno-strict-overflow -Wno-unused-label
>   OPTIONS = USE_GETADDRINFO=1 USE_ZLIB=1 USE_REGPARM=1 USE_OPENSSL=1 
> USE_LUA=1 USE_SYSTEMD=1 USE_PCRE=1 USE_PCRE_JIT=1 USE_NS=1

Best regards
Tim Düsterhus

Reply via email to