* [PATCH net 0/2] rxrpc: Miscellaneous fixes
@ 2025-07-07 10:24 David Howells
2025-07-07 10:24 ` [PATCH net 1/2] rxrpc: Fix over large frame size warning David Howells
` (2 more replies)
0 siblings, 3 replies; 10+ messages in thread
From: David Howells @ 2025-07-07 10:24 UTC (permalink / raw)
To: netdev
Cc: David Howells, Marc Dionne, Jakub Kicinski, David S. Miller,
Eric Dumazet, Paolo Abeni, linux-afs, linux-kernel
Here are some miscellaneous fixes for rxrpc:
(1) Fix a warning about over-large frame size in rxrpc_send_response().
(2) Fix assertion failure due to preallocation collision.
David
The patches can be found here also:
http://git.kernel.org/cgit/linux/kernel/git/dhowells/linux-fs.git/log/?h=rxrpc-fixes
David Howells (2):
rxrpc: Fix over large frame size warning
rxrpc: Fix bug due to prealloc collision
net/rxrpc/ar-internal.h | 15 +++++++++------
net/rxrpc/call_accept.c | 2 ++
net/rxrpc/output.c | 5 ++++-
3 files changed, 15 insertions(+), 7 deletions(-)
^ permalink raw reply [flat|nested] 10+ messages in thread* [PATCH net 1/2] rxrpc: Fix over large frame size warning
2025-07-07 10:24 [PATCH net 0/2] rxrpc: Miscellaneous fixes David Howells
@ 2025-07-07 10:24 ` David Howells
2025-07-07 10:24 ` [PATCH net 2/2] rxrpc: Fix bug due to prealloc collision David Howells
2025-07-08 20:20 ` [PATCH net 0/2] rxrpc: Miscellaneous fixes patchwork-bot+netdevbpf
2 siblings, 0 replies; 10+ messages in thread
From: David Howells @ 2025-07-07 10:24 UTC (permalink / raw)
To: netdev
Cc: David Howells, Marc Dionne, Jakub Kicinski, David S. Miller,
Eric Dumazet, Paolo Abeni, linux-afs, linux-kernel,
kernel test robot, Simon Horman
Under some circumstances, the compiler will emit the following warning for
rxrpc_send_response():
net/rxrpc/output.c: In function 'rxrpc_send_response':
net/rxrpc/output.c:974:1: warning: the frame size of 1160 bytes is larger than 1024 bytes
This occurs because the local variables include a 16-element scatterlist
array and a 16-element bio_vec array. It's probably not actually a problem
as this function is only called by the rxrpc I/O thread function in a
kernel thread and there won't be much on the stack before it.
Fix this by overlaying the bio_vec array over the kvec array in the
rxrpc_local struct. There is one of these per I/O thread and the kvec
array is intended for pointing at bits of a packet to be transmitted,
typically a DATA or an ACK packet. As packets for a local endpoint are
only transmitted by its specific I/O thread, there can be no race, and so
overlaying this bit of memory should be no problem.
Fixes: 5800b1cf3fd8 ("rxrpc: Allow CHALLENGEs to the passed to the app for a RESPONSE")
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202506240423.E942yKJP-lkp@intel.com/
Signed-off-by: David Howells <dhowells@redhat.com>
cc: Marc Dionne <marc.dionne@auristor.com>
cc: "David S. Miller" <davem@davemloft.net>
cc: Eric Dumazet <edumazet@google.com>
cc: Jakub Kicinski <kuba@kernel.org>
cc: Paolo Abeni <pabeni@redhat.com>
cc: Simon Horman <horms@kernel.org>
cc: linux-afs@lists.infradead.org
cc: netdev@vger.kernel.org
---
net/rxrpc/ar-internal.h | 15 +++++++++------
net/rxrpc/output.c | 5 ++++-
2 files changed, 13 insertions(+), 7 deletions(-)
diff --git a/net/rxrpc/ar-internal.h b/net/rxrpc/ar-internal.h
index 5bd3922c310d..376e33dce8c1 100644
--- a/net/rxrpc/ar-internal.h
+++ b/net/rxrpc/ar-internal.h
@@ -361,12 +361,15 @@ struct rxrpc_local {
struct list_head new_client_calls; /* Newly created client calls need connection */
spinlock_t client_call_lock; /* Lock for ->new_client_calls */
struct sockaddr_rxrpc srx; /* local address */
- /* Provide a kvec table sufficiently large to manage either a DATA
- * packet with a maximum set of jumbo subpackets or a PING ACK padded
- * out to 64K with zeropages for PMTUD.
- */
- struct kvec kvec[1 + RXRPC_MAX_NR_JUMBO > 3 + 16 ?
- 1 + RXRPC_MAX_NR_JUMBO : 3 + 16];
+ union {
+ /* Provide a kvec table sufficiently large to manage either a
+ * DATA packet with a maximum set of jumbo subpackets or a PING
+ * ACK padded out to 64K with zeropages for PMTUD.
+ */
+ struct kvec kvec[1 + RXRPC_MAX_NR_JUMBO > 3 + 16 ?
+ 1 + RXRPC_MAX_NR_JUMBO : 3 + 16];
+ struct bio_vec bvec[3 + 16];
+ };
};
/*
diff --git a/net/rxrpc/output.c b/net/rxrpc/output.c
index 0af19bcdc80a..ef7b3096c95e 100644
--- a/net/rxrpc/output.c
+++ b/net/rxrpc/output.c
@@ -924,7 +924,7 @@ void rxrpc_send_response(struct rxrpc_connection *conn, struct sk_buff *response
{
struct rxrpc_skb_priv *sp = rxrpc_skb(response);
struct scatterlist sg[16];
- struct bio_vec bvec[16];
+ struct bio_vec *bvec = conn->local->bvec;
struct msghdr msg;
size_t len = sp->resp.len;
__be32 wserial;
@@ -938,6 +938,9 @@ void rxrpc_send_response(struct rxrpc_connection *conn, struct sk_buff *response
if (ret < 0)
goto fail;
nr_sg = ret;
+ ret = -EIO;
+ if (WARN_ON_ONCE(nr_sg > ARRAY_SIZE(conn->local->bvec)))
+ goto fail;
for (int i = 0; i < nr_sg; i++)
bvec_set_page(&bvec[i], sg_page(&sg[i]), sg[i].length, sg[i].offset);
^ permalink raw reply related [flat|nested] 10+ messages in thread* [PATCH net 2/2] rxrpc: Fix bug due to prealloc collision
2025-07-07 10:24 [PATCH net 0/2] rxrpc: Miscellaneous fixes David Howells
2025-07-07 10:24 ` [PATCH net 1/2] rxrpc: Fix over large frame size warning David Howells
@ 2025-07-07 10:24 ` David Howells
2025-07-08 19:03 ` Jakub Kicinski
2025-07-08 19:57 ` David Howells
2025-07-08 20:20 ` [PATCH net 0/2] rxrpc: Miscellaneous fixes patchwork-bot+netdevbpf
2 siblings, 2 replies; 10+ messages in thread
From: David Howells @ 2025-07-07 10:24 UTC (permalink / raw)
To: netdev
Cc: David Howells, Marc Dionne, Jakub Kicinski, David S. Miller,
Eric Dumazet, Paolo Abeni, linux-afs, linux-kernel,
Junvyyang, Tencent Zhuque Lab, Simon Horman
When userspace is using AF_RXRPC to provide a server, it has to preallocate
incoming calls and assign to them call IDs that will be used to thread
related recvmsg() and sendmsg() together. The preallocated call IDs will
automatically be attached to calls as they come in until the pool is empty.
To the kernel, the call IDs are just arbitrary numbers, but userspace can
use the call ID to hold a pointer to prepared structs. In any case, the
user isn't permitted to create two calls with the same call ID (call IDs
become available again when the call ends) and EBADSLT should result from
sendmsg() if an attempt is made to preallocate a call with an in-use call
ID.
However, the cleanup in the error handling will trigger both assertions in
rxrpc_cleanup_call() because the call isn't marked complete and isn't
marked as having been released.
Fix this by setting the call state in rxrpc_service_prealloc_one() and then
marking it as being released before calling the cleanup function.
Fixes: 00e907127e6f ("rxrpc: Preallocate peers, conns and calls for incoming service requests")
Reported-by: Junvyyang, Tencent Zhuque Lab <zhuque@tencent.com>
Signed-off-by: David Howells <dhowells@redhat.com>
cc: LePremierHomme kwqcheii@proton.me
cc: Marc Dionne <marc.dionne@auristor.com>
cc: Jakub Kicinski <kuba@kernel.org>
cc: Paolo Abeni <pabeni@redhat.com>
cc: "David S. Miller" <davem@davemloft.net>
cc: Eric Dumazet <edumazet@google.com>
cc: Simon Horman <horms@kernel.org>
cc: linux-afs@lists.infradead.org
cc: netdev@vger.kernel.org
---
net/rxrpc/call_accept.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/net/rxrpc/call_accept.c b/net/rxrpc/call_accept.c
index a4b363b47cca..32af666547f8 100644
--- a/net/rxrpc/call_accept.c
+++ b/net/rxrpc/call_accept.c
@@ -149,6 +149,8 @@ static int rxrpc_service_prealloc_one(struct rxrpc_sock *rx,
id_in_use:
write_unlock(&rx->call_lock);
+ rxrpc_prefail_call(call, RXRPC_CALL_LOCAL_ERROR, -EBADSLT);
+ __set_bit(RXRPC_CALL_RELEASED, &call->flags);
rxrpc_cleanup_call(call);
_leave(" = -EBADSLT");
return -EBADSLT;
^ permalink raw reply related [flat|nested] 10+ messages in thread* Re: [PATCH net 2/2] rxrpc: Fix bug due to prealloc collision
2025-07-07 10:24 ` [PATCH net 2/2] rxrpc: Fix bug due to prealloc collision David Howells
@ 2025-07-08 19:03 ` Jakub Kicinski
2025-07-08 19:57 ` David Howells
1 sibling, 0 replies; 10+ messages in thread
From: Jakub Kicinski @ 2025-07-08 19:03 UTC (permalink / raw)
To: David Howells
Cc: netdev, Marc Dionne, David S. Miller, Eric Dumazet, Paolo Abeni,
linux-afs, linux-kernel, Junvyyang, Tencent Zhuque Lab,
Simon Horman
On Mon, 7 Jul 2025 11:24:34 +0100 David Howells wrote:
> + rxrpc_prefail_call(call, RXRPC_CALL_LOCAL_ERROR, -EBADSLT);
> + __set_bit(RXRPC_CALL_RELEASED, &call->flags);
is the __set_bit() needed / intentional here?
Looks like rxrpc_prefail_call() does:
WARN_ON_ONCE(__test_and_set_bit(RXRPC_CALL_RELEASED, &call->flags));
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH net 2/2] rxrpc: Fix bug due to prealloc collision
2025-07-07 10:24 ` [PATCH net 2/2] rxrpc: Fix bug due to prealloc collision David Howells
2025-07-08 19:03 ` Jakub Kicinski
@ 2025-07-08 19:57 ` David Howells
1 sibling, 0 replies; 10+ messages in thread
From: David Howells @ 2025-07-08 19:57 UTC (permalink / raw)
To: Jakub Kicinski
Cc: dhowells, netdev, Marc Dionne, David S. Miller, Eric Dumazet,
Paolo Abeni, linux-afs, linux-kernel,
Junvyyang, Tencent Zhuque Lab, Simon Horman
Jakub Kicinski <kuba@kernel.org> wrote:
> On Mon, 7 Jul 2025 11:24:34 +0100 David Howells wrote:
> > + rxrpc_prefail_call(call, RXRPC_CALL_LOCAL_ERROR, -EBADSLT);
> > + __set_bit(RXRPC_CALL_RELEASED, &call->flags);
>
> is the __set_bit() needed / intentional here?
> Looks like rxrpc_prefail_call() does:
>
> WARN_ON_ONCE(__test_and_set_bit(RXRPC_CALL_RELEASED, &call->flags));
Actually, it shouldn't be. I added that first, then realised that wasn't
sufficient.
I also realised there should be a third patch I failed to restack onto the git
branch.
Can you take the first patch and I'll alter this and repost this patch and add
the lost one? Or should I just repost all three?
David
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH net 0/2] rxrpc: Miscellaneous fixes
2025-07-07 10:24 [PATCH net 0/2] rxrpc: Miscellaneous fixes David Howells
2025-07-07 10:24 ` [PATCH net 1/2] rxrpc: Fix over large frame size warning David Howells
2025-07-07 10:24 ` [PATCH net 2/2] rxrpc: Fix bug due to prealloc collision David Howells
@ 2025-07-08 20:20 ` patchwork-bot+netdevbpf
2 siblings, 0 replies; 10+ messages in thread
From: patchwork-bot+netdevbpf @ 2025-07-08 20:20 UTC (permalink / raw)
To: David Howells
Cc: netdev, marc.dionne, kuba, davem, edumazet, pabeni, linux-afs,
linux-kernel
Hello:
This series was applied to netdev/net.git (main)
by Jakub Kicinski <kuba@kernel.org>:
On Mon, 7 Jul 2025 11:24:32 +0100 you wrote:
> Here are some miscellaneous fixes for rxrpc:
>
> (1) Fix a warning about over-large frame size in rxrpc_send_response().
>
> (2) Fix assertion failure due to preallocation collision.
>
> David
>
> [...]
Here is the summary with links:
- [net,1/2] rxrpc: Fix over large frame size warning
https://git.kernel.org/netdev/net/c/31ec70afaaad
- [net,2/2] rxrpc: Fix bug due to prealloc collision
(no matching commit)
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH net 0/2] rxrpc: Miscellaneous fixes
@ 2025-02-03 11:03 David Howells
2025-02-04 14:40 ` patchwork-bot+netdevbpf
0 siblings, 1 reply; 10+ messages in thread
From: David Howells @ 2025-02-03 11:03 UTC (permalink / raw)
To: netdev
Cc: David Howells, Marc Dionne, Jakub Kicinski, David S. Miller,
Eric Dumazet, Paolo Abeni, linux-afs, linux-kernel
Here some miscellaneous fixes for AF_RXRPC:
(1) Fix the state of a call to not treat the challenge-response cycle as
part of an incoming call's state set. The problem is that it makes
handling received of the final packet in the receive phase difficult
as that wants to change the call state - but security negotiations may
not yet be complete.
(2) Fix the queuing of connections seeking attention from offloaded ops
such as challenge/response. The problem was that the attention link
always seemed to be busy because it was never initialised from NULL.
This further masked two further bugs, also fixed in the patch.
David
---
The patches can be found here also:
http://git.kernel.org/cgit/linux/kernel/git/dhowells/linux-fs.git/log/?h=rxrpc-fixes
David Howells (2):
rxrpc: Fix call state set to not include the SERVER_SECURING state
rxrpc: Fix the rxrpc_connection attend queue handling
include/trace/events/rxrpc.h | 1 +
net/rxrpc/ar-internal.h | 2 +-
net/rxrpc/call_object.c | 6 ++----
net/rxrpc/conn_event.c | 21 +++++++++++----------
net/rxrpc/conn_object.c | 1 +
net/rxrpc/input.c | 4 ++--
net/rxrpc/sendmsg.c | 2 +-
7 files changed, 19 insertions(+), 18 deletions(-)
^ permalink raw reply [flat|nested] 10+ messages in thread* Re: [PATCH net 0/2] rxrpc: Miscellaneous fixes
2025-02-03 11:03 David Howells
@ 2025-02-04 14:40 ` patchwork-bot+netdevbpf
0 siblings, 0 replies; 10+ messages in thread
From: patchwork-bot+netdevbpf @ 2025-02-04 14:40 UTC (permalink / raw)
To: David Howells
Cc: netdev, marc.dionne, kuba, davem, edumazet, pabeni, linux-afs,
linux-kernel
Hello:
This series was applied to netdev/net.git (main)
by Paolo Abeni <pabeni@redhat.com>:
On Mon, 3 Feb 2025 11:03:02 +0000 you wrote:
> Here some miscellaneous fixes for AF_RXRPC:
>
> (1) Fix the state of a call to not treat the challenge-response cycle as
> part of an incoming call's state set. The problem is that it makes
> handling received of the final packet in the receive phase difficult
> as that wants to change the call state - but security negotiations may
> not yet be complete.
>
> [...]
Here is the summary with links:
- [net,1/2] rxrpc: Fix call state set to not include the SERVER_SECURING state
(no matching commit)
- [net,2/2] rxrpc: Fix the rxrpc_connection attend queue handling
https://git.kernel.org/netdev/net/c/4241a702e0d0
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH net 0/2] rxrpc: Miscellaneous fixes
@ 2024-10-01 13:26 David Howells
2024-10-03 23:40 ` patchwork-bot+netdevbpf
0 siblings, 1 reply; 10+ messages in thread
From: David Howells @ 2024-10-01 13:26 UTC (permalink / raw)
To: netdev
Cc: David Howells, Marc Dionne, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, linux-afs, linux-kernel
Here some miscellaneous fixes for AF_RXRPC:
(1) Fix a race in the I/O thread vs UDP socket setup.
(2) Fix an uninitialised variable.
David
---
The patches can be found here also:
http://git.kernel.org/cgit/linux/kernel/git/dhowells/linux-fs.git/log/?h=rxrpc-fixes
David Howells (2):
rxrpc: Fix a race between socket set up and I/O thread creation
rxrpc: Fix uninitialised variable in rxrpc_send_data()
net/rxrpc/ar-internal.h | 2 +-
net/rxrpc/io_thread.c | 10 ++++++++--
net/rxrpc/local_object.c | 2 +-
net/rxrpc/sendmsg.c | 10 +++++-----
4 files changed, 15 insertions(+), 9 deletions(-)
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH net 0/2] rxrpc: Miscellaneous fixes
2024-10-01 13:26 David Howells
@ 2024-10-03 23:40 ` patchwork-bot+netdevbpf
0 siblings, 0 replies; 10+ messages in thread
From: patchwork-bot+netdevbpf @ 2024-10-03 23:40 UTC (permalink / raw)
To: David Howells
Cc: netdev, marc.dionne, davem, edumazet, kuba, pabeni, linux-afs,
linux-kernel
Hello:
This series was applied to netdev/net.git (main)
by Jakub Kicinski <kuba@kernel.org>:
On Tue, 1 Oct 2024 14:26:57 +0100 you wrote:
> Here some miscellaneous fixes for AF_RXRPC:
>
> (1) Fix a race in the I/O thread vs UDP socket setup.
>
> (2) Fix an uninitialised variable.
>
> David
>
> [...]
Here is the summary with links:
- [net,1/2] rxrpc: Fix a race between socket set up and I/O thread creation
https://git.kernel.org/netdev/net/c/bc212465326e
- [net,2/2] rxrpc: Fix uninitialised variable in rxrpc_send_data()
https://git.kernel.org/netdev/net/c/7a310f8d7dfe
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2025-07-08 20:19 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-07 10:24 [PATCH net 0/2] rxrpc: Miscellaneous fixes David Howells
2025-07-07 10:24 ` [PATCH net 1/2] rxrpc: Fix over large frame size warning David Howells
2025-07-07 10:24 ` [PATCH net 2/2] rxrpc: Fix bug due to prealloc collision David Howells
2025-07-08 19:03 ` Jakub Kicinski
2025-07-08 19:57 ` David Howells
2025-07-08 20:20 ` [PATCH net 0/2] rxrpc: Miscellaneous fixes patchwork-bot+netdevbpf
-- strict thread matches above, loose matches on Subject: below --
2025-02-03 11:03 David Howells
2025-02-04 14:40 ` patchwork-bot+netdevbpf
2024-10-01 13:26 David Howells
2024-10-03 23:40 ` patchwork-bot+netdevbpf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).