Bug 1313816 - pluto crashes with --ctlbase option
pluto crashes with --ctlbase option
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: libreswan (Show other bugs)
x86_64 Linux
medium Severity medium
: rc
: ---
Assigned To: Paul Wouters
BaseOS QE Security Team
Depends On:
  Show dependency treegraph
Reported: 2016-03-02 07:04 EST by Jaroslav Aster
Modified: 2017-09-05 23:32 EDT (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1313821 (view as bug list)
Last Closed: 2017-09-05 23:32:22 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)
Abrt logs. (1.76 MB, application/x-gzip)
2016-03-02 07:04 EST, Jaroslav Aster
no flags Details

  None (edit)
Description Jaroslav Aster 2016-03-02 07:04:22 EST
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 07:08:27 EST
Version libreswan-3.15-5.1.el6.x86_64.
Comment 2 Paul Wouters 2016-03-04 16:57:24 EST
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 16:59:36 EST
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-23 22:24:08 EDT
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-05 23:32:22 EDT
This bug is fixed in rhel7. This bug does not qualify for a fix in rhel6

Note You need to log in before you can comment on or make changes to this bug.