mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* Re: [PATCH] rxrpc: Initialize sockaddr_rxrpc directly
       [not found] <20241105191156.99327-1-zoo868e@gmail.com>
@ 2024-11-05 19:12 ` syzbot
  0 siblings, 0 replies; 3+ messages in thread
From: syzbot @ 2024-11-05 19:12 UTC (permalink / raw)
  To: zoo868e; +Cc: zoo868e, linux-kernel, syzkaller-bugs

> In rxrpc_lookup_peer_local_rcu(), removed the redundant memset call
> that zeros out the sockaddr_rxrpc structure before setting its fields.
> Instead, initialize the sockaddr_rxrpc structure directly in
> rxrpc_input_error().
>
> This change simplifies the code and ensures that the sockaddr_rxrpc
> structure is properly zero-initialized.
>
> #syz test

This crash does not have a reproducer. I cannot test it.

>
> Signed-off-by: Matt Jan <zoo868e@gmail.com>
> ---
>  net/rxrpc/peer_event.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/net/rxrpc/peer_event.c b/net/rxrpc/peer_event.c
> index 552ba84a255c..c86b432201fd 100644
> --- a/net/rxrpc/peer_event.c
> +++ b/net/rxrpc/peer_event.c
> @@ -33,7 +33,6 @@ static struct rxrpc_peer *rxrpc_lookup_peer_local_rcu(struct rxrpc_local *local,
>  
>  	_enter("");
>  
> -	memset(srx, 0, sizeof(*srx));
>  	srx->transport_type = local->srx.transport_type;
>  	srx->transport_len = local->srx.transport_len;
>  	srx->transport.family = local->srx.transport.family;
> @@ -134,7 +133,7 @@ static void rxrpc_adjust_mtu(struct rxrpc_peer *peer, unsigned int mtu)
>  void rxrpc_input_error(struct rxrpc_local *local, struct sk_buff *skb)
>  {
>  	struct sock_exterr_skb *serr = SKB_EXT_ERR(skb);
> -	struct sockaddr_rxrpc srx;
> +	struct sockaddr_rxrpc srx = {};
>  	struct rxrpc_peer *peer = NULL;
>  
>  	_enter("L=%x", local->debug_id);
> -- 
> 2.25.1
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] rxrpc: Initialize sockaddr_rxrpc directly
  2024-10-24 22:43 [syzbot] [afs?] [net?] KMSAN: uninit-value in rxrpc_lookup_peer_rcu syzbot
  2024-11-05 19:19 ` [PATCH] rxrpc: Initialize sockaddr_rxrpc directly Matt Jan
@ 2024-11-18 15:00 ` David Howells
  1 sibling, 0 replies; 3+ messages in thread
From: David Howells @ 2024-11-18 15:00 UTC (permalink / raw)
  To: Matt Jan
  Cc: dhowells, syzbot+14c04e62ca58315571d1, davem, edumazet, kuba,
	linux-afs, linux-kernel, marc.dionne, netdev, pabeni,
	syzkaller-bugs, skhan

Matt Jan <zoo868e@gmail.com> wrote:

> In rxrpc_lookup_peer_local_rcu(), removed the redundant memset call
> that zeros out the sockaddr_rxrpc structure before setting its fields.
> Instead, initialize the sockaddr_rxrpc structure directly in
> rxrpc_input_error().
> 
> This change simplifies the code and ensures that the sockaddr_rxrpc
> structure is properly zero-initialized.

How does that actually fix the issue?

All the patch does is move the initialisation of srx from
rxrpc_lookup_peer_local_rcu() into its only caller - and nothing samples the
contents of srx between.

Looking at the bug report, the history of the uninitialised location goes back
further, to a network address generated/assembled in the ipv6 stack or from
the transmission side of the rxrpc stack, possibly call->peer->srx.transport.

David


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH] rxrpc: Initialize sockaddr_rxrpc directly
  2024-10-24 22:43 [syzbot] [afs?] [net?] KMSAN: uninit-value in rxrpc_lookup_peer_rcu syzbot
@ 2024-11-05 19:19 ` Matt Jan
  2024-11-18 15:00 ` David Howells
  1 sibling, 0 replies; 3+ messages in thread
From: Matt Jan @ 2024-11-05 19:19 UTC (permalink / raw)
  To: syzbot+14c04e62ca58315571d1
  Cc: davem, dhowells, edumazet, kuba, linux-afs, linux-kernel,
	marc.dionne, netdev, pabeni, syzkaller-bugs, skhan, Matt Jan

In rxrpc_lookup_peer_local_rcu(), removed the redundant memset call
that zeros out the sockaddr_rxrpc structure before setting its fields.
Instead, initialize the sockaddr_rxrpc structure directly in
rxrpc_input_error().

This change simplifies the code and ensures that the sockaddr_rxrpc
structure is properly zero-initialized.

Reported-by: syzbot+14c04e62ca58315571d1@syzkaller.appspotmail.com
Signed-off-by: Matt Jan <zoo868e@gmail.com>
---
 net/rxrpc/peer_event.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/net/rxrpc/peer_event.c b/net/rxrpc/peer_event.c
index 552ba84a255c..c86b432201fd 100644
--- a/net/rxrpc/peer_event.c
+++ b/net/rxrpc/peer_event.c
@@ -33,7 +33,6 @@ static struct rxrpc_peer *rxrpc_lookup_peer_local_rcu(struct rxrpc_local *local,
 
 	_enter("");
 
-	memset(srx, 0, sizeof(*srx));
 	srx->transport_type = local->srx.transport_type;
 	srx->transport_len = local->srx.transport_len;
 	srx->transport.family = local->srx.transport.family;
@@ -134,7 +133,7 @@ static void rxrpc_adjust_mtu(struct rxrpc_peer *peer, unsigned int mtu)
 void rxrpc_input_error(struct rxrpc_local *local, struct sk_buff *skb)
 {
 	struct sock_exterr_skb *serr = SKB_EXT_ERR(skb);
-	struct sockaddr_rxrpc srx;
+	struct sockaddr_rxrpc srx = {};
 	struct rxrpc_peer *peer = NULL;
 
 	_enter("L=%x", local->debug_id);
-- 
2.25.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-11-18 15:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20241105191156.99327-1-zoo868e@gmail.com>
2024-11-05 19:12 ` [PATCH] rxrpc: Initialize sockaddr_rxrpc directly syzbot
2024-10-24 22:43 [syzbot] [afs?] [net?] KMSAN: uninit-value in rxrpc_lookup_peer_rcu syzbot
2024-11-05 19:19 ` [PATCH] rxrpc: Initialize sockaddr_rxrpc directly Matt Jan
2024-11-18 15:00 ` David Howells

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®