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>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID:
 <DM4PR21MB353644BF43244D3509267741CEBB2@DM4PR21MB3536.namprd21.prod.outlook.com>
Date: Sat, 10 Aug 2024 13:53:20 +0000
From: Long Li <longli@...rosoft.com>
To: Haiyang Zhang <haiyangz@...rosoft.com>, "linux-hyperv@...r.kernel.org"
	<linux-hyperv@...r.kernel.org>, "netdev@...r.kernel.org"
	<netdev@...r.kernel.org>
CC: Dexuan Cui <decui@...rosoft.com>, "stephen@...workplumber.org"
	<stephen@...workplumber.org>, KY Srinivasan <kys@...rosoft.com>, Paul
 Rosswurm <paulros@...rosoft.com>, "olaf@...fle.de" <olaf@...fle.de>,
	"vkuznets@...hat.com" <vkuznets@...hat.com>, "davem@...emloft.net"
	<davem@...emloft.net>, "wei.liu@...nel.org" <wei.liu@...nel.org>,
	"edumazet@...gle.com" <edumazet@...gle.com>, "kuba@...nel.org"
	<kuba@...nel.org>, "pabeni@...hat.com" <pabeni@...hat.com>, "leon@...nel.org"
	<leon@...nel.org>, "ssengar@...ux.microsoft.com"
	<ssengar@...ux.microsoft.com>, "linux-rdma@...r.kernel.org"
	<linux-rdma@...r.kernel.org>, "daniel@...earbox.net" <daniel@...earbox.net>,
	"john.fastabend@...il.com" <john.fastabend@...il.com>, "bpf@...r.kernel.org"
	<bpf@...r.kernel.org>, "ast@...nel.org" <ast@...nel.org>, "hawk@...nel.org"
	<hawk@...nel.org>, "tglx@...utronix.de" <tglx@...utronix.de>,
	"shradhagupta@...ux.microsoft.com" <shradhagupta@...ux.microsoft.com>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	"stable@...r.kernel.org" <stable@...r.kernel.org>
Subject: RE: [PATCH net] net: mana: Fix RX buf alloc_size alignment and atomic
 op panic

> Subject: [PATCH net] net: mana: Fix RX buf alloc_size alignment and atomic op
> panic
> 
> The MANA driver's RX buffer alloc_size is passed into napi_build_skb() to create
> SKB. skb_shinfo(skb) is located at the end of skb, and its alignment is affected by
> the alloc_size passed into napi_build_skb(). The size needs to be aligned properly
> for better performance and atomic operations.
> Otherwise, on ARM64 CPU, for certain MTU settings like 4000, atomic operations
> may panic on the skb_shinfo(skb)->dataref due to alignment fault.
> 
> To fix this bug, add proper alignment to the alloc_size calculation.
> 
> Sample panic info:
> [  253.298819] Unable to handle kernel paging request at virtual address
> ffff000129ba5cce [  253.300900] Mem abort info:
> [  253.301760]   ESR = 0x0000000096000021
> [  253.302825]   EC = 0x25: DABT (current EL), IL = 32 bits
> [  253.304268]   SET = 0, FnV = 0
> [  253.305172]   EA = 0, S1PTW = 0
> [  253.306103]   FSC = 0x21: alignment fault
> Call trace:
>  __skb_clone+0xfc/0x198
>  skb_clone+0x78/0xe0
>  raw6_local_deliver+0xfc/0x228
>  ip6_protocol_deliver_rcu+0x80/0x500
>  ip6_input_finish+0x48/0x80
>  ip6_input+0x48/0xc0
>  ip6_sublist_rcv_finish+0x50/0x78
>  ip6_sublist_rcv+0x1cc/0x2b8
>  ipv6_list_rcv+0x100/0x150
>  __netif_receive_skb_list_core+0x180/0x220
>  netif_receive_skb_list_internal+0x198/0x2a8
>  __napi_poll+0x138/0x250
>  net_rx_action+0x148/0x330
>  handle_softirqs+0x12c/0x3a0
> 
> Cc: stable@...r.kernel.org
> Fixes: 80f6215b450e ("net: mana: Add support for jumbo frame")
> Signed-off-by: Haiyang Zhang <haiyangz@...rosoft.com>

Reviewed-by: Long Li <longli@...rosoft.com>

> ---
>  drivers/net/ethernet/microsoft/mana/mana_en.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ethernet/microsoft/mana/mana_en.c
> b/drivers/net/ethernet/microsoft/mana/mana_en.c
> index d2f07e179e86..ae717d06e66f 100644
> --- a/drivers/net/ethernet/microsoft/mana/mana_en.c
> +++ b/drivers/net/ethernet/microsoft/mana/mana_en.c
> @@ -599,7 +599,11 @@ static void mana_get_rxbuf_cfg(int mtu, u32 *datasize,
> u32 *alloc_size,
>  	else
>  		*headroom = XDP_PACKET_HEADROOM;
> 
> -	*alloc_size = mtu + MANA_RXBUF_PAD + *headroom;
> +	*alloc_size = SKB_DATA_ALIGN(mtu + MANA_RXBUF_PAD + *headroom);
> +
> +	/* Using page pool in this case, so alloc_size is PAGE_SIZE */
> +	if (*alloc_size < PAGE_SIZE)
> +		*alloc_size = PAGE_SIZE;
> 
>  	*datasize = mtu + ETH_HLEN;
>  }
> --
> 2.34.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ