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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20211217073248.GM427717@gauss3.secunet.de>
Date:   Fri, 17 Dec 2021 08:32:48 +0100
From:   Steffen Klassert <steffen.klassert@...unet.com>
To:     Antony Antony <antony.antony@...unet.com>
CC:     Thomas Egerer <thomas.egerer@...unet.com>,
        Herbert Xu <herbert@...dor.apana.org.au>,
        "David S. Miller" <davem@...emloft.net>,
        "Jakub Kicinski" <kuba@...nel.org>, <netdev@...r.kernel.org>
Subject: Re: [PATCH ipsec-next] xfrm: rate limit SA mapping change message to
 user space

On Thu, Dec 16, 2021 at 11:37:06PM +0100, Antony Antony wrote:
> Kernel generates mapping change message, XFRM_MSG_MAPPING,
> when a source port chage is detected on a input state with UDP
> encapsulation. Kernel generates a message per each IPsec packet
> with the new source port. For a high speed flow per packet mapping change
> message can be very excessive, and can overload the user space listener.
> 
> Introduce rate limiting for XFRM_MSG_MAPPING message to the user space.
> 
> The rate limiting is configurable via netlink, when adding a new SA or
> updating it. Use the new attribute XFRMA_MTIMER_THRESH, in seconds.
> 
> Co-developed-by: Thomas Egerer <thomas.egerer@...unet.com>
> Signed-off-by: Thomas Egerer <thomas.egerer@...unet.com>
> Signed-off-by: Antony Antony <antony.antony@...unet.com>
> ---
>  include/net/xfrm.h        |  5 +++++
>  include/uapi/linux/xfrm.h |  1 +
>  net/xfrm/xfrm_state.c     | 23 ++++++++++++++++++++++-
>  net/xfrm/xfrm_user.c      | 12 +++++++++++-
>  4 files changed, 39 insertions(+), 2 deletions(-)

...

>  
>  static void xfrm_smark_init(struct nlattr **attrs, struct xfrm_mark *m)
> @@ -1024,8 +1028,14 @@ static int copy_to_user_state_extra(struct xfrm_state *x,
>  		if (ret)
>  			goto out;
>  	}
> -	if (x->security)
> +	if (x->security) {
>  		ret = copy_sec_ctx(x->security, skb);
> +		if (ret)
> +			goto out;
> +	}
> +	if (x->mapping_maxage)
> +		ret = nla_put_u32(skb, XFRMA_MTIMER_THRESH,
> +				  (x->mapping_maxage / HZ));

I think you need to update xfrm_sa_len() when you add data here.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ