Issue #142

kernelpanic on 386 with psk ikev2

Added by Heinz Thölecke over 1 year ago. Updated 17 days ago.

Status:ClosedStart date:09.11.2011
Priority:Normal
Assignee:Tobias Brunner
Category:kernel
Affected version: Resolution:Invalid

Description

Hi,
scenario: ipsec between 2 Linuxmachines.
First one is kernel 3.1 amd64 and iptables, its the router for the intranet.
second one is i386 kernel 3.1 its a roadwarrior laptop.
the connection uses psk ikev2.
i can build the tunnel and everything looks fine until i am sending data (dosen't matter from which side) through the tunnel.
a kernelpanic occurs then.
same issue with kernel 3.0 i386, with kernel 2.6 : general protectionfault.
i have testet version 4.5.2 (from sid) and 4.6.1 (selfcompiled)
when i start a amd64 Linux with 2.6 kernel on the laptop everything works fine.
ps laptop is behind nat-router.

History

#1 Updated by Tobias Brunner over 1 year ago

  • Status changed from New to Feedback

Hello Heinz,

Could you specify a bit clearer which combinations result in a kernel panic and on which host exactly?

And just on a general note, strongSwan works solely in userland, so this is more likely kernel related. Especially since after the tunnel is established strongSwan does not interfere with the actual tunnel traffic. So, a kernel panic on data packets rather indicates some kind of kernel level bug.

Regards,
Tobias

#2 Updated by Heinz Thölecke over 1 year ago

Hello Tobias,
thx for the fast response :-)
The Router with 64 bit Linux has no Problems.
The Roadwarriorlaptop has kernelpanic with 3.0 and 3.1 32 Bit Kernel, with a 64 BIt Kernel everything works fine.
if i use a 2.6 32 BIt kernel i got a general protectionfault on the Laptop.
these symptoms are reproducible with both testet versions of strongswan (4.5.2 and 4.6.1)

best regards
Heinz

#3 Updated by Tobias Brunner over 1 year ago

The Roadwarriorlaptop has kernelpanic with 3.0 and 3.1 32 Bit Kernel, with a 64 BIt Kernel everything works fine.
if i use a 2.6 32 BIt kernel i got a general protectionfault on the Laptop.

So your laptop basically crashes if you use a 32-bit kernel (whatever version). Do you have some more details on the crashes? What is logged in the system logs prior/during the crashes?

these symptoms are reproducible with both testet versions of strongswan (4.5.2 and 4.6.1)

I'm still not convinced that this is actually a strongSwan issue. As I already mentioned, strongSwan works in userland and once the tunnel is up the kernel is responsible for the tunnel traffic.
So perhaps you should ask in one of the kernel mailing lists.

#4 Updated by Tobias Brunner over 1 year ago

Hi Heinz,

I probably ran into the same problem today. In my case it was a 2.6.38 x86 kernel on fairly new hardware. Trying to transmit user data resulted in a kernel panic (general protection fault).
The culprit turned out to be the aesni_intel module. Preventing this module from getting loaded (i.e. blacklisting it in /etc/modprobe.d/) resolved the issue. Using any algorithm other than AES should work around the issue too.

This bug has recently been reported on the linux-crypto mailing list by someone. But no response so far.

Regards,
Tobias

#5 Updated by ITdotSYSNETdotBY V 9 months ago

Hi.
That problem actually still for kernel 3.3 with OpenSuse 12.1.
Versions:

localhost:~ # uname -a
Linux localhost 3.3.0-0-default #1 SMP Fri Mar 30 15:21:05 FET 2012 (028c29f) i686 i686 i386 GNU/Linux

localhost:~ # lsmod|egrep aes
aesni_intel 18236 0
cryptd 15725 1 aesni_intel
aes_i586 16956 1 aesni_intel
localhost:~ # rpm -qa|egrep wan
strongswan-libs0-4.5.3-5.4.1.i586
strongswan-ikev2-4.5.3-5.4.1.i586
strongswan-doc-4.5.3-5.4.1.i586
strongswan-4.5.3-5.4.1.i586
strongswan-nm-4.5.3-5.4.1.i586
strongswan-sqlite-4.5.3-5.4.1.i586
strongswan-mysql-4.5.3-5.4.1.i586
strongswan-ipsec-4.5.3-5.4.1.i586
strongswan-ikev1-4.5.3-5.4.1.i586
localhost:~ #

If I try to ping peer after connection, then my PC gets "Kernal panic" and makes reboot (as after sysrq).

But if I add - blacklist aesni_intel, then I see:

localhost:~ # /etc/init.d/ipsec start
localhost:~ # lsmod|egrep crypt
cryptd 15725 1 serpent_sse2_i586
crypto_null 12782 0
localhost:~ #

I don't see aes modules ...
ping is working, But whether work ipsec?????

#6 Updated by ITdotSYSNETdotBY V 9 months ago

Hi. Seem I found a relative answer:
From: http://www.kernel.org/pub/linux/kernel/v3.0/ChangeLog-3.4.3

Date: Wed May 30 01:43:08 2012 +0200

crypto: aesni-intel - fix unaligned cbc decrypt for x86-32
commit 7c8d51848a88aafdb68f42b6b650c83485ea2f84 upstream.
The 32 bit variant of cbc(aes) decrypt is using instructions requiring
128 bit aligned memory locations but fails to ensure this constraint in
the code. Fix this by loading the data into intermediate registers with
load unaligned instructions.
This fixes reported general protection faults related to aesni.
References: https://bugzilla.kernel.org/show_bug.cgi?id=43223
Reported-by: Daniel <>
Signed-off-by: Mathias Krause <>
Signed-off-by: Herbert Xu <>
Signed-off-by: Greg Kroah-Hartman <>

Possibly, strongswan don't makes encryp with kernel before version 3.4 ...?

#7 Updated by Tobias Brunner 9 months ago

  • Status changed from Feedback to Resolved
  • Assignee set to Tobias Brunner
  • Affected version deleted (4.6.0)
  • Resolution set to Invalid

As you saw this is a bug in the Linux kernel that has recently been fixed. Thus, I'm closing this issue now.

localhost:~ # /etc/init.d/ipsec start
localhost:~ # lsmod|egrep crypt
cryptd 15725 1 serpent_sse2_i586
crypto_null 12782 0
localhost:~ #

I don't see aes modules ...

Only starting the daemon does not load the modules for individual encryption algorithms (unless you configured auto=start). These modules are loaded on demand by the kernel. Check lsmod again after you successfully established a VPN tunnel.

#8 Updated by Tobias Brunner 9 months ago

  • Category set to kernel

#9 Updated by Tobias Brunner 9 months ago

  • Status changed from Resolved to Closed

#10 Updated by Andreas Steffen 17 days ago

  • Tracker changed from Bug to Issue

Also available in: Atom PDF