Bug 1313816

Summary: pluto crashes with --ctlbase option
Product: Red Hat Enterprise Linux 6 Reporter: Jaroslav Aster <jaster>
Component: libreswanAssignee: Paul Wouters <pwouters>
Status: CLOSED WONTFIX QA Contact: BaseOS QE Security Team <qe-baseos-security>
Severity: medium Docs Contact:
Priority: medium    
Version: 6.9CC: omoris
Target Milestone: rc   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1313821 (view as bug list) Environment:
Last Closed: 2017-09-06 03:32:22 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
Abrt logs. none

Description Jaroslav Aster 2016-03-02 12:04:22 UTC
Created attachment 1132281 [details]
Abrt logs.

Description of problem:

Pluto crashes with --ctlbase option. It appears only on x86_64.

Version-Release number of selected component (if applicable):


How reproducible:

mostly, but not 100%

Steps to Reproduce:

# yum install -y libreswan

# rm -rf /etc/ipsec.d/*.db /etc/ipsec.d/pkcs11.txt

# mkdir /tmp/pluto

# ipsec initnss
Initializing NSS database
See 'man pluto' if you want to protect the NSS database with a password

# ipsec pluto --ctlbase /tmp/pluto

# dmesg | grep pluto | grep segfault
pluto[11944]: segfault at 0 ip 00007f79c6069d36 sp 00007fff2379fdf0 error 4 in pluto[7f79c6002000+10a000]

Actual results:

Pluto crashes.

Expected results:

Pluto does not crash.

Additional info:

Comment 1 Jaroslav Aster 2016-03-02 12:08:27 UTC
Version libreswan-3.15-5.1.el6.x86_64.

Comment 2 Paul Wouters 2016-03-04 21:57:24 UTC
I think you are crashing based on no kernel stack being loaded (and sometimes it got loaded for you). Since you are not running ipsec _stackmanager that handles that before pluto starts.

I confirmed on 3.15:

(gdb) bt
#0  0x00007ffff7f5ce46 in init_kernel () at /usr/src/debug/libreswan-3.15/programs/pluto/kernel.c:2420
#1  0x00007ffff7f2a18f in main (argc=<value optimized out>, argv=<value optimized out>)
    at /usr/src/debug/libreswan-3.15/programs/pluto/plutomain.c:1581
(gdb) f 0
#0  0x00007ffff7f5ce46 in init_kernel () at /usr/src/debug/libreswan-3.15/programs/pluto/kernel.c:2420
2420		ev_fd = pluto_event_new(*kernel_ops->async_fdp, EV_READ | EV_PERSIST,
(gdb) p kernel_ops
$1 = (const struct kernel_ops *) 0x7ffff8200740


I tried to reproduce it with no kernel stack on 3.16, which nicely terminates telling you no kernel stack was found. So this will get fixed in the next rebase.

It is a minor bug, because nornal ike daemon start ensures the kernel stack is loaded.

if you are using this kind of starting for testing, before starting pluto add: ipsec _stackmanager start

Comment 3 Paul Wouters 2016-03-04 21:59:36 UTC
also, if you want to run with the nss db in /tmp/pluto, you need to run ipsec initnss --ctlbase /tmp/pluto

Comment 4 Paul Wouters 2016-08-24 02:24:08 UTC
We will pull this in if/when we upgrade to 3.16 or higher. Since triggering this requires two errors (not using proper initsystem and not using a proper initialed nss)

Comment 6 Paul Wouters 2017-09-06 03:32:22 UTC
This bug is fixed in rhel7. This bug does not qualify for a fix in rhel6