Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AC90B2877EC for ; Wed, 18 Jun 2025 11:04:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750244690; cv=none; b=PwMETujcV6YBcauLF3lJ9qNfa/JthfrmT762FH2+aB0HXyN7yQggTwni10qv9D6K+BqcfvyBZ4HePLTxCb+Eggyr9Qn3Du9iJ3BUqEzuGd7wmhHwVGFQPmQBjlj5WBz/+0j7SSkiHiTt0WNJwAzJ3ANYVq3dLJvdDl8mhlCAk2Y= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750244690; c=relaxed/simple; bh=njDayLAndD977HidI36d4kHOUcNcnLJ9DfmAZUA94VQ=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=eZkrgmIq4mKfPgK4gCgesJwzlszah9jZm6u0l7/h71eIQo9DyTuISDXoOALeTWXZDnJF2UBzFiCncG1OooW3qyWu6M/xiVm79MlGZubfz2rWHBTZQm4wN92qtKHFzv8xjVoDGHwWgHARY4VvZDPce4AhWSHuEQibpWV7f72DETw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=TBjELxOB; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="TBjELxOB" Received: by smtp.kernel.org (Postfix) with ESMTPSA id B107DC4CEE7; Wed, 18 Jun 2025 11:04:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1750244690; bh=njDayLAndD977HidI36d4kHOUcNcnLJ9DfmAZUA94VQ=; h=From:To:Cc:Subject:Date:Reply-to:From; b=TBjELxOB0pDYA6rWGA0v+NeHXWUmXKwZQS3chJ0HrmTflYo6qbzKc4/Ej76n3cXp9 WUXn5zAs3a1/tNMA2MLNNHtZvw0ZwFSG6MhMfaTERpwLXuGYtBhqxhSHw0sX6ZNTma ASaRhHu3R+tLqEw0UfxWH3Vm/MWdak5Nfx3yY1ck= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2022-49998: rxrpc: Fix locking in rxrpc's sendmsg Date: Wed, 18 Jun 2025 13:01:03 +0200 Message-ID: <2025061827-CVE-2022-49998-d4dd@gregkh> X-Mailer: git-send-email 2.49.0 Precedence: bulk X-Mailing-List: linux-cve-announce@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Reply-to: , X-Developer-Signature: v=1; a=openpgp-sha256; l=4951; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=NNPi1XJEGbwXBHWKNrkfcZMHu5OcciK1FsQyu4BGLzs=; b=owGbwMvMwCRo6H6F97bub03G02pJDBlBc7yVtj40/67zX22V98+WCxP+/NJgZF0TF33//lftr 42Hj9xW6ohlYRBkYpAVU2T5so3n6P6KQ4pehranYeawMoEMYeDiFICJ/NvJsGDivZnHPGUahMO0 vCtuG2/7c2e9sR/DfKdg8V+XNzIWKp+x1mq4tqj80ReHAgA= X-Developer-Key: i=gregkh@linuxfoundation.org; a=openpgp; fpr=F4B60CC5BF78C2214A313DCB3147D40DDB2DFB29 Content-Transfer-Encoding: 8bit From: Greg Kroah-Hartman Description =========== In the Linux kernel, the following vulnerability has been resolved: rxrpc: Fix locking in rxrpc's sendmsg Fix three bugs in the rxrpc's sendmsg implementation: (1) rxrpc_new_client_call() should release the socket lock when returning an error from rxrpc_get_call_slot(). (2) rxrpc_wait_for_tx_window_intr() will return without the call mutex held in the event that we're interrupted by a signal whilst waiting for tx space on the socket or relocking the call mutex afterwards. Fix this by: (a) moving the unlock/lock of the call mutex up to rxrpc_send_data() such that the lock is not held around all of rxrpc_wait_for_tx_window*() and (b) indicating to higher callers whether we're return with the lock dropped. Note that this means recvmsg() will not block on this call whilst we're waiting. (3) After dropping and regaining the call mutex, rxrpc_send_data() needs to go and recheck the state of the tx_pending buffer and the tx_total_len check in case we raced with another sendmsg() on the same call. Thinking on this some more, it might make sense to have different locks for sendmsg() and recvmsg(). There's probably no need to make recvmsg() wait for sendmsg(). It does mean that recvmsg() can return MSG_EOR indicating that a call is dead before a sendmsg() to that call returns - but that can currently happen anyway. Without fix (2), something like the following can be induced: WARNING: bad unlock balance detected! 5.16.0-rc6-syzkaller #0 Not tainted ------------------------------------- syz-executor011/3597 is trying to release lock (&call->user_mutex) at: [] rxrpc_do_sendmsg+0xc13/0x1350 net/rxrpc/sendmsg.c:748 but there are no more locks to release! other info that might help us debug this: no locks held by syz-executor011/3597. ... Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0xcd/0x134 lib/dump_stack.c:106 print_unlock_imbalance_bug include/trace/events/lock.h:58 [inline] __lock_release kernel/locking/lockdep.c:5306 [inline] lock_release.cold+0x49/0x4e kernel/locking/lockdep.c:5657 __mutex_unlock_slowpath+0x99/0x5e0 kernel/locking/mutex.c:900 rxrpc_do_sendmsg+0xc13/0x1350 net/rxrpc/sendmsg.c:748 rxrpc_sendmsg+0x420/0x630 net/rxrpc/af_rxrpc.c:561 sock_sendmsg_nosec net/socket.c:704 [inline] sock_sendmsg+0xcf/0x120 net/socket.c:724 ____sys_sendmsg+0x6e8/0x810 net/socket.c:2409 ___sys_sendmsg+0xf3/0x170 net/socket.c:2463 __sys_sendmsg+0xe5/0x1b0 net/socket.c:2492 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x44/0xae [Thanks to Hawkins Jiawei and Khalid Masum for their attempts to fix this] The Linux kernel CVE team has assigned CVE-2022-49998 to this issue. Affected and fixed versions =========================== Issue introduced in 4.15 with commit bc5e3a546d553e5223851fc199e69040eb70f68b and fixed in 5.10.140 with commit 79e2ca7aa96e80961828ab6312264633b66183cc Issue introduced in 4.15 with commit bc5e3a546d553e5223851fc199e69040eb70f68b and fixed in 5.15.64 with commit 2bc769b8edb158be7379d15f36e23d66cf850053 Issue introduced in 4.15 with commit bc5e3a546d553e5223851fc199e69040eb70f68b and fixed in 5.19.6 with commit 091dc91e119fdd61432347231724f4e861c6b465 Issue introduced in 4.15 with commit bc5e3a546d553e5223851fc199e69040eb70f68b and fixed in 6.0 with commit b0f571ecd7943423c25947439045f0d352ca3dbf Please see https://www.kernel.org for a full list of currently supported kernel versions by the kernel community. Unaffected versions might change over time as fixes are backported to older supported kernel versions. The official CVE entry at https://cve.org/CVERecord/?id=CVE-2022-49998 will be updated if fixes are backported, please check that for the most up to date information about this issue. Affected files ============== The file(s) affected by this issue are: net/rxrpc/call_object.c net/rxrpc/sendmsg.c Mitigation ========== The Linux kernel CVE team recommends that you update to the latest stable kernel version for this, and many other bugfixes. Individual changes are never tested alone, but rather are part of a larger kernel release. Cherry-picking individual commits is not recommended or supported by the Linux kernel community at all. If however, updating to the latest release is impossible, the individual changes to resolve this issue can be found at these commits: https://git.kernel.org/stable/c/79e2ca7aa96e80961828ab6312264633b66183cc https://git.kernel.org/stable/c/2bc769b8edb158be7379d15f36e23d66cf850053 https://git.kernel.org/stable/c/091dc91e119fdd61432347231724f4e861c6b465 https://git.kernel.org/stable/c/b0f571ecd7943423c25947439045f0d352ca3dbf