Bug #2516

Updated by Victor Julien almost 6 years ago

 1, run suricata in multi tenants mode 
 2, use suricatasc to send a command "register-tenant 2 /etc/suricata/tenant2.yaml" 

 The command does not return, and check the stack using pstack: 
 Thread 2 (Thread 0x7f6e1d3c3700 (LWP 18202)): 
 #0    0x00007f6e2acc451d in __lll_lock_wait () from /lib64/ 
 #1    0x00007f6e2acbfe1b in _L_lock_812 () from /lib64/ 
 #2    0x00007f6e2acbfce8 in pthread_mutex_lock () from /lib64/ 
 #3    0x00000000005ccf7a in DetectEngineThreadCtxInitGlobalKeywords (det_ctx=0x1c641800, det_ctx=0x1c641800) at detect-engine.c:1984 
 #4    ThreadCtxDoInit (de_ctx=de_ctx@entry=0xd15e000, det_ctx=det_ctx@entry=0x1c641800) at detect-engine.c:2260 
 #5    0x00000000005ce14b in DetectEngineThreadCtxInitForReload (tv=tv@entry=0x240cc60, new_de_ctx=new_de_ctx@entry=0xd15e000, mt=mt@entry=1) at detect-engine.c:2374 
 #6    0x00000000005d6746 in DetectEngineReloadThreads (new_de_ctx=new_de_ctx@entry=0xd15e000) at detect-engine.c:1362 
 #7    0x00000000005db208 in DetectEngineMTApply () at detect-engine.c:3530 
 #8    0x0000000000805c07 in UnixSocketRegisterTenant (cmd=<optimized out>, answer=0x6d73f90, data=<optimized out>) at runmode-unix-socket.c:839 
 #9    0x00000000008c8c5e in UnixCommandExecute (client=0x13536a80, command=0x7f6e1d3c1310 "{\"command\": \"register-tenant\", \"arguments\": {\"id\": 2, \"filename\": \"/etc/suricata/tenant2.yaml\"}}", this=0xd039c0 <command>) at unix-manager.c:506 
 #10 UnixCommandRun (client=0x13536a80, this=0xd039c0 <command>) at unix-manager.c:624 
 #11 UnixMain (this=0xd039c0 <command>) at unix-manager.c:675 
 #12 UnixManager (th_v=0x137f6000, thread_data=<optimized out>) at unix-manager.c:1130 
 #13 0x00000000008bf644 in TmThreadsManagement (td=0x137f6000) at tm-threads.c:719 
 #14 0x00007f6e2acbde25 in start_thread () from /lib64/ 
 #15 0x00007f6e2a7e3bad in clone () from /lib64/ 

 master->lock is locked twice in this stack, first    in DetectEngineMTApply and the second in    DetectEngineThreadCtxInitGlobalKeywords