XFRM_USER_RCV_MSG()是否需要修改以支持在X86_64 VM中安装的Ubuntu 16.04(LTS)上



我正在将IPSEC应用程序从VXWorks迁移到Linux。我是Linux的新手。使用IPSEC的组件是32位应用程序。但是,整个产品在64位环境中运行。

我们在X86_64机器上使用Ubuntu 16.04(LTS(。Linux内核版本为4.9。

64位内核上的32位IPSEC在XFRM.H中的结构填充方面存在兼容性问题。这是一个很容易解决的问题。但是,解决此问题后,我无法安装SAS。XFRM框架正在返回-95 not supported错误。

调试后,我在xfrm_user_rcv_msg()中发现以下支票引起了问题。我评论了仅进行测试的块。在使用此更改重建内核后,32位IPSEC应用程序在64位内核上工作正常。

我想了解此检查背后的原因,以及是否确实有必要将其删除以在64位内核上运行32位IPSEC应用程序。

#ifdef CONFIG_COMPAT 
    if (in_compat_syscall())
        return -EOPNOTSUPP;
#endif 

问候Jayalakshmi

与4.1内核一起添加了此检查,以防止来自32位Userland程序中不兼容的XFRM请求的问题(显然假设它们是针对未修饰的XFRM.H标头构建的(。这是原始提交信息:

commit 74005991b78a0a7a6546004fb37d33a651c613e7
Author: Fan Du <fan.du@intel.com>  Tue Jan 27 10:00:29 2015
Committer:  Steffen Klassert <steffen.klassert@secunet.com>  Tue Mar  3 10:10:16 2015
xfrm: Do not parse 32bits compiled xfrm netlink msg on 64bits host
structure like xfrm_usersa_info or xfrm_userpolicy_info
has different sizeof when compiled as 32bits and 64bits
due to not appending pack attribute in their definition.
This will result in broken SA and SP information when user
trying to configure them through netlink interface.
Inform user land about this situation instead of keeping
silent, the upper test scripts would behave accordingly.
Signed-off-by: Fan Du <fan.du@intel.com>
Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>

最新更新