knotd crashes when adding zone through knotc
It was discovered that when adding a zone to Knot through knotc conf-* commands the server can reliably be crashed if the statistics module is loaded specifically as a global-module in the knot.conf. This was confirmed in Knot 2.5.3 and Knot 2.5.5.
Backtrace:
#0 0x00007ffff61321d7 in raise () from /lib64/libc.so.6 #1 0x00007ffff61338c8 in abort () from /lib64/libc.so.6 #2 0x00007ffff6171f07 in __libc_message () from /lib64/libc.so.6 #3 0x00007ffff6179503 in _int_free () from /lib64/libc.so.6 #4 0x000000000040ad6b in conf_update (conf=<optimized out>, flags=(CONF_UPD_FNOFREE | CONF_UPD_FMODULES)) at knot/conf/base.c:356 #5 0x0000000000418605 in server_reload (server=0x7fffffffe420) at knot/server/server.c:647 #6 0x000000000042042c in ctl_conf_txn (args=0x7fffffffe140, cmd=<optimized out>) at knot/ctl/commands.c:1481 #7 0x0000000000412caf in ctl_process (ctl=ctl@entry=0x7fffca77f010, server=server@entry=0x7fffffffe420) at knot/ctl/process.c:96 #8 0x00000000004095d7 in event_loop (socket=0x0, server=0x7fffffffe420) at utils/knotd/main.c:283 #9 main (argc=<optimized out>, argv=<optimized out>) at utils/knotd/main.c:597
The crash is within the WALK_LIST_FREE macro. Adding a null check to the list items before freeing did not help.