<div dir="ltr">Hi libreswan,<br><br>We're running libreswan 3.29 on Ubuntu with Linux kernel 4.15 and had a segfault due to a null pointer dereference in the ikev2.c code. Can you work with me to determine what caused it?<br><br>We saw this in the logs just before the crash:<br><br>    EXPECTATION FAILED: child state #533502 missing parent state #533497 (in get_ike_sa() at state.c:461)<br><br>I ran gdb against the crash dump, here's the output:<br><br>GNU gdb (Ubuntu 8.1-0ubuntu3.1) 8.1.0.20180409-git<br>Copyright (C) 2018 Free Software Foundation, Inc.<br>License GPLv3+: GNU GPL version 3 or later <<a href="http://gnu.org/licenses/gpl.html">http://gnu.org/licenses/gpl.html</a>><br>This is free software: you are free to change and redistribute it.<br>There is NO WARRANTY, to the extent permitted by law.  Type "show copying"<br>and "show warranty" for details.<br>This GDB was configured as "x86_64-linux-gnu".<br>Type "show configuration" for configuration details.<br>For bug reporting instructions, please see:<br><<a href="http://www.gnu.org/software/gdb/bugs/">http://www.gnu.org/software/gdb/bugs/</a>>.<br>Find the GDB manual and other documentation resources online at:<br><<a href="http://www.gnu.org/software/gdb/documentation/">http://www.gnu.org/software/gdb/documentation/</a>>.<br>For help, type "help".<br>Type "apropos word" to search for commands related to "word"...<br>Reading symbols from /usr/lib/ipsec/pluto...Reading symbols from /usr/lib/debug/.build-id/07/90d482ffd48ee4a7e01a43395d54c7df1747e1.debug...done.<br>done.<br>[New LWP 4703]<br>[New LWP 4713]<br>[New LWP 4708]<br>[New LWP 4714]<br>[New LWP 4707]<br>[New LWP 4712]<br>[New LWP 4711]<br>[New LWP 4715]<br>[New LWP 4709]<br>[New LWP 4716]<br>[New LWP 4710]<br>[New LWP 4720]<br>[New LWP 4717]<br>[New LWP 4718]<br>[New LWP 4719]<br>[New LWP 4721]<br>[Thread debugging using libthread_db enabled]<br>Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".<br>Core was generated by `/usr/lib/ipsec/pluto --leak-detective --config /etc/ipsec.conf --nofork'.<br>Program terminated with signal SIGSEGV, Segmentation fault.<br>#0  0x000055b4c756dfe5 in ikev2_process_packet (mdp=mdp@entry=0x7fffa7286f00) at ./programs/pluto/ikev2.c:1736<br><br>warning: Source file is more recent than executable.<br>1736                     if (md->hdr.isa_msgid > ike->sa.st_v2_msgids.initiator.sent) {<br>[Current thread is 1 (Thread 0x7f4ad6e80900 (LWP 4703))]<br>(gdb) where<br>#0  0x000055b4c756dfe5 in ikev2_process_packet (mdp=mdp@entry=0x7fffa7286f00) at ./programs/pluto/ikev2.c:1736<br>#1  0x000055b4c7592428 in process_packet (mdp=mdp@entry=0x7fffa7286f00) at ./programs/pluto/demux.c:387<br>#2  0x000055b4c759263f in process_md (mdp=mdp@entry=0x7fffa7286f00) at ./programs/pluto/demux.c:442<br>#3  0x000055b4c7592ba6 in comm_handle (ifp=<optimized out>) at ./programs/pluto/demux.c:483<br>#4  comm_handle_cb (fd=<optimized out>, event=<optimized out>, arg=<optimized out>) at ./programs/pluto/demux.c:492<br>#5  0x00007f4ad49d88f8 in ?? () from /usr/lib/x86_64-linux-gnu/libevent-2.1.so.6<br>#6  0x00007f4ad49d933f in event_base_loop () from /usr/lib/x86_64-linux-gnu/libevent-2.1.so.6<br>#7  0x000055b4c754ece4 in call_server () at ./programs/pluto/server.c:1378<br>#8  0x000055b4c750c973 in main (argc=<optimized out>, argv=<optimized out>) at ./programs/pluto/plutomain.c:1789<br><br># I BELIEVE THE FOLLOWING SHOWS THAT THE ike VAR CONTAINS A NULL POINTER.<br># And as you know, dereferencing a null pointer is one of the possible causes of segfaults.<br>(gdb) p md<br>$1 = (struct msg_digest *) 0x55b4c8390758<br>(gdb) p ike<br>$2 = (struct ike_sa *) 0x0<br>(gdb) p st->st_serialno<br>$6 = 533502<br><br><br><br>I verified that st->st_serialno contains the expected value of 533502 (which was mentioned in the log output).<br><br>What else should I check?<div><br></div><div>Thanks in advance.</div></div>