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: <aYl2tYaNpdYVU8hN@secunet.com>
Date: Mon, 9 Feb 2026 06:55:01 +0100
From: Steffen Klassert <steffen.klassert@...unet.com>
To: Paolo Abeni <pabeni@...hat.com>
CC: <netdev@...r.kernel.org>, Herbert Xu <herbert@...dor.apana.org.au>, "David
 S. Miller" <davem@...emloft.net>, Eric Dumazet <edumazet@...gle.com>, Jakub
 Kicinski <kuba@...nel.org>, Simon Horman <horms@...nel.org>, Florian Westphal
	<fw@...len.de>
Subject: Re: [PATCH net-next] xfrm: reduce struct sec_path size

On Fri, Feb 06, 2026 at 06:14:36PM +0100, Paolo Abeni wrote:
> The mentioned struct has an hole and uses unnecessary wide type to
> store MAC length and indexes of very small arrays.
> 
> It's also embedded into the skb_extensions, and the latter, due
> to recent CAN changes, may exceeds the 192 bytes mark (3 cachelines
> on x86_64 arch) on some reasonable configurations.
> 
> Reordering and the sec_path fields, shrinking xfrm_offload.orig_mac_len
> to 16 bits and xfrm_offload.{len,olen,verified_cnt} to u8, we can save
> 16 bytes and keep skb_extensions size under control.
> 
> Before:
> 
> struct sec_path {
> 	int                        len;
> 	int                        olen;
> 	int                        verified_cnt;
> 
> 	/* XXX 4 bytes hole, try to pack */$
> 	struct xfrm_state *        xvec[6];
> 	struct xfrm_offload ovec[1];
> 
> 	/* size: 88, cachelines: 2, members: 5 */
> 	/* sum members: 84, holes: 1, sum holes: 4 */
> 	/* last cacheline: 24 bytes */
> };
> 
> After:
> 
> struct sec_path {
> 	struct xfrm_state *        xvec[6];
> 	struct xfrm_offload        ovec[1];
> 	/* typedef u8 -> __u8 */ unsigned char              len;
> 	/* typedef u8 -> __u8 */ unsigned char              olen;
> 	/* typedef u8 -> __u8 */ unsigned char              verified_cnt;
> 
> 	/* size: 72, cachelines: 2, members: 5 */
> 	/* padding: 1 */
> 	/* last cacheline: 8 bytes */
> };
> 
> Signed-off-by: Paolo Abeni <pabeni@...hat.com>

Reviewed-by: Steffen Klassert <steffen.klassert@...unet.com>


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ