[strongSwan-dev] Using Strongswan 32 binaries on under 64 bit kernel

Martin Willi martin at strongswan.org
Wed Oct 22 17:31:08 CEST 2014


Hi Tugrul,

> > https://wiki.strongswan.org/issues/352

> The ticket mentions about a specially designed xfrm.h to be replaced
> when running 32bit host on 64bit kernel.

The problem is that one of the structures in xfrm.h does not use the
same binary layout when compiled under 32bit and 64bit. This in the end
breaks the ABI, as the kernel expects a 64bit layout, but receives a
32bit layout from userspace.

The offending struct seems to be xfrm_usersa_info:
  32-bit: sizeof(struct xfrm_usersa_info): 220 bytes
  64-bit: sizeof(struct xfrm_usersa_info): 224 bytes

Fortunately the offset of all members seem to be equal, so it is more
about these extra 4 bytes that must be handled.

A clean fix would actually introduce a compatibility fix in the 64-bit
kernel, where it takes these differences into account when it talks to a
32-bit process, parsing requests or building responses accordingly.

Alternatively you could detect a 64-bit kernel in 32-bit strongSwan
builds, and then add four extra bytes to the xfrm_usersa_info struct.

Regards
Martin



More information about the Dev mailing list