Skip to content

Commit

Permalink
xfrm: Refuse to insert 32 bit userspace socket policies on 64 bit sys…
Browse files Browse the repository at this point in the history
…tems

We don't have a compat layer for xfrm, so userspace and kernel
structures have different sizes in this case. This results in
a broken configuration, so refuse to configure socket policies
when trying to insert from 32 bit userspace as we do it already
with policies inserted via netlink.

Reported-and-tested-by: [email protected]
Signed-off-by: Steffen Klassert <[email protected]>
  • Loading branch information
klassert committed Feb 2, 2018
1 parent 743ffff commit 19d7df6
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions net/xfrm/xfrm_state.c
Original file line number Diff line number Diff line change
Expand Up @@ -2056,6 +2056,11 @@ int xfrm_user_policy(struct sock *sk, int optname, u8 __user *optval, int optlen
struct xfrm_mgr *km;
struct xfrm_policy *pol = NULL;

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

if (!optval && !optlen) {
xfrm_sk_policy_insert(sk, XFRM_POLICY_IN, NULL);
xfrm_sk_policy_insert(sk, XFRM_POLICY_OUT, NULL);
Expand Down

0 comments on commit 19d7df6

Please sign in to comment.