lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <CO1PR11MB49005592783CCBFA2395A968922A9@CO1PR11MB4900.namprd11.prod.outlook.com>
Date:   Thu, 20 Oct 2022 17:14:42 +0000
From:   "Beckius, Mikael" <mikael.beckius@...driver.com>
To:     "steffen.klassert@...unet.com" <steffen.klassert@...unet.com>
CC:     "netdev@...r.kernel.org" <netdev@...r.kernel.org>
Subject: Regarding "xfrm: Add compat layer" when running arm/arm64

Regarding "xfrm: Add compat layer" described in: https://lwn.net/Articles/832081/ I am trying to understand how it is intended to work when running a 32-bit arm user space on top of an arm 64-bit kernel?
 
In the arm case it appears the structures have the same size, and it also appears to be working fine without CONFIG_XFRM_USER_COMPAT if adding the small modification seen below. The patch itself is not import but rather the aim is simply to have xfrm user working on arm/arm64 without custom modifications.
 
Thanks,
Micke

From 15ae02b40d0e1413aaae4fcc3cceafd9b935624c Mon Sep 17 00:00:00 2001 
From: Mikael Beckius <mikael.beckius@...driver.com>
Date: Thu, 31 Mar 2022 08:29:00 +0200
Subject: [PATCH] Allow CONFIG_XFRM_USER to run on arm/arm64 as is

Not sure if there is actually a need for a compat translator
on arm64. The XFRM structs have the same size on arm and
arm64 but there might be more to it even though all the
tests pass.

Signed-off-by: Mikael Beckius <mikael.beckius@...driver.com>
---
 net/xfrm/xfrm_state.c | 2 ++
 net/xfrm/xfrm_user.c  | 2 ++
 2 files changed, 4 insertions(+)

diff --git a/net/xfrm/xfrm_state.c b/net/xfrm/xfrm_state.c
index 91c32a3b6924..628455f6e180 100644
--- a/net/xfrm/xfrm_state.c
+++ b/net/xfrm/xfrm_state.c
@@ -2442,6 +2442,7 @@ int xfrm_user_policy(struct sock *sk, int optname, sockptr_t optval, int optlen)
      if (IS_ERR(data))
            return PTR_ERR(data);
 
+#if IS_ENABLED(CONFIG_COMPAT_FOR_U64_ALIGNMENT)
      if (in_compat_syscall()) {
            struct xfrm_translator *xtr = xfrm_get_translator();
 
@@ -2457,6 +2458,7 @@ int xfrm_user_policy(struct sock *sk, int optname, sockptr_t optval, int optlen)
                  return err;
            }
      }
+#endif
 
      err = -EINVAL;
      rcu_read_lock();
diff --git a/net/xfrm/xfrm_user.c b/net/xfrm/xfrm_user.c
index 2ff017117730..587b9001481a 100644
--- a/net/xfrm/xfrm_user.c
+++ b/net/xfrm/xfrm_user.c
@@ -2877,6 +2877,7 @@ static int xfrm_user_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh,
      if (!netlink_net_capable(skb, CAP_NET_ADMIN))
            return -EPERM;
 
+#if IS_ENABLED(CONFIG_COMPAT_FOR_U64_ALIGNMENT)
      if (in_compat_syscall()) {
            struct xfrm_translator *xtr = xfrm_get_translator();
 
@@ -2891,6 +2892,7 @@ static int xfrm_user_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh,
            if (nlh64)
                  nlh = nlh64;
      }
+#endif
 
      if ((type == (XFRM_MSG_GETSA - XFRM_MSG_BASE) ||
           type == (XFRM_MSG_GETPOLICY - XFRM_MSG_BASE)) &&
-- 
2.28.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ