Skip to contentSkip to conversation

rxrpc: Do not return client slots for service calls

PATCH Superseded Andrew Stellman 2 participants 2 messages Dec 2 – Dec 3

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 rxrpc: Do not return client slots for service calls

From: Andrew Stellman <[email protected]>

rxrpc_put_call_slot() calls up() on the client call limiter for every released call, but only client calls take a slot, in rxrpc_new_client_call(). Closing a socket on which a userspace service has precharged calls with RXRPC_CHARGE_ACCEPT releases those service calls and raises the limiter's count above 1000.

Skip the limiter release for service calls. Service calls no longer change the limiter count.

Fixes b7a7d6740803 ("rxrpc: Impose a maximum number of client calls")

---
Tested on mainline 19cc08c1a6a6 in arm64 QEMU with KASAN, with test-only logging of the limiter count: 1000 to 1003 before the fix, 1000 after.

Found with Quality Playbook
(https://github.com/andrewstellman/quality-playbook) running Claude Opus 5.5; the fix was drafted with OpenAI GPT-6 (Codex).

A reproducer is available on request.

 net/rxrpc/call_object.c | 2 ++
 1 file changed, 2 insertions(+)
net/rxrpc/call_object.c +2 -0
index 817ed9acb91e..11d4e37dbb21 100644
@@ -281,6 +281,8 @@ static void rxrpc_put_call_slot(struct rxrpc_call *call)
 {
 	struct semaphore *limiter = &rxrpc_call_limiter;
 
+	if (test_bit(RXRPC_CALL_IS_SERVICE, &call->flags))
+		return;
 	if (test_bit(RXRPC_CALL_KERNEL, &call->flags))
 		limiter = &rxrpc_kernel_call_limiter;
 	up(limiter);
Signature · 1 line
2.53.0
#1 lore raw
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider.

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider.

Critical: 0 · High: 0 · Medium: 1 · Low: 0

If you believe none of the issues are legitimate, please reply to each issue of Medium severity or higher and explain why the AI is wrong. If any of them are legitimate and you plan to respin, please let patchwork know by including "pw-bot: cr" as a separate line at the end of your reply (one such reply per series is enough).

- [Medium] The commit message describes a much narrower bug than the one the code fixes.

--

rxrpc: Do not return client slots for service calls

With this commit, rxrpc_put_call_slot() returns early for calls that have RXRPC_CALL_IS_SERVICE set. Releasing a service call then no longer calls up() on the client call limiter. Only client calls take a slot, in rxrpc_new_client_call().

Quoted 5 lines

rxrpc_put_call_slot() calls up() on the client call limiter for every released call, but only client calls take a slot, in rxrpc_new_client_call(). Closing a socket on which a userspace service has precharged calls with RXRPC_CHARGE_ACCEPT releases those service calls and raises the limiter's count above 1000.

[Severity: Medium]
Is this description narrower than what the code change actually fixes?

The only caller of rxrpc_put_call_slot() is rxrpc_release_call(). Every service call reaches it when released, not just the precharged calls discarded at socket close.

A userspace service call that completes normally is released in rxrpc_recvmsg():

net/rxrpc/recvmsg.c:rxrpc_recvmsg() {
    ...
	if (!(flags & MSG_PEEK))
		rxrpc_release_call(rx, call);
    ...
}

In-kernel service calls (AFS cache manager, rxperf) are released in rxrpc_kernel_shutdown_call():

net/rxrpc/af_rxrpc.c:rxrpc_kernel_shutdown_call() {
    ...
	if (!test_bit(RXRPC_CALL_RELEASED, &call->flags)) {
		rxrpc_release_call(rxrpc_sk(sock->sk), call);
    ...
}

rxrpc_service_prealloc_one() creates service calls with only RXRPC_CALL_IS_SERVICE set. RXRPC_CALL_KERNEL is set only in rxrpc_alloc_client_call().

So before this patch, kernel service calls also did up(&rxrpc_call_limiter) on the userspace limiter, not rxrpc_kernel_call_limiter.

If so, every incoming call served by any rxrpc service added a permanent slot to the global userspace client call limiter. A remote peer could then wear down the 1000 call cap just by making calls.

Could the commit message mention the normal completion paths? It could also note that remote traffic can trigger this, and that kernel service calls raised the userspace limiter.

Signature · 1 line
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261202181321.74079-1-bugs%40stellman-greene.com