From mboxrd@z Thu Jan 1 00:00:00 1970 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 7AF0747784 for ; Fri, 3 May 2024 14:52:57 +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=1714747977; cv=none; b=ftWTHPHBsgWEVSCLy4dfePBhfL5YKnMhqr2jeMbnzmzYiJPCuRaJk5uefOFJ+Ee5x5KrDbzNcE2+eKqdQnUaoovA80Le2gbn2Z8ezOxVqnJoTENHDQsR7zkGK0xGpAGSo7uXfzorlt7N33+1MR+lXTlu404I4NOIkC5cpGoMzq4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714747977; c=relaxed/simple; bh=f3HJzpBxlYix3xX0TFJAz9e/Et04agnG2iyrNXVBWQc=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=Kf6OfNFaM9mJn9yqX6aSyAsaxhErouAl/Uhc2rua3Arpr3q/ekttoIdaO1eOf6dOgtvllnMgJ0CvpIBuPnNGC0mM0hgdWwYvhPJYup59aRqcauQVcyajv5IhuDQ4wW18K6XlXxyh56aGX1LZMQ/ftjhJ31mXNQ5eeSeudD7Uues= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=o/OffkPM; 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="o/OffkPM" Received: by smtp.kernel.org (Postfix) with ESMTPSA id E2539C116B1; Fri, 3 May 2024 14:52:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1714747977; bh=f3HJzpBxlYix3xX0TFJAz9e/Et04agnG2iyrNXVBWQc=; h=From:To:Cc:Subject:Date:Reply-to:From; b=o/OffkPMKk2IMNPO0hTgY0pGBowcuI3rqUMS0/4zp3l0H3vSbimgJTdaLhsU2iA7I 3jimgsW7rL0IWkTpH60/BWSuE6qHsoF6i5uNa2w9ZBG+axVlglZ/URAIHxrtBdVb1H AVK09/pbW2IZSGwkqd4oC6CV/v2HVypqiKRCH2kg= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2022-48675: IB/core: Fix a nested dead lock as part of ODP flow Date: Fri, 3 May 2024 16:52:20 +0200 Message-ID: <2024050319-CVE-2022-48675-6ff4@gregkh> X-Mailer: git-send-email 2.45.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=4040; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=f3HJzpBxlYix3xX0TFJAz9e/Et04agnG2iyrNXVBWQc=; b=owGbwMvMwCRo6H6F97bub03G02pJDGkmv5Q/n1tVEHqOQdqm/ZL5sZxk0wU/V1/9VRBfezhI6 cfkdxuDO2JZGASZGGTFFFm+bOM5ur/ikKKXoe1pmDmsTCBDGLg4BWAiVrsZFhyJjmpxuBHpslxe V/mv8IdArWmXuBjmWf39uE0gVCwjp6BIriR8h4Ep38PfAA== X-Developer-Key: i=gregkh@linuxfoundation.org; a=openpgp; fpr=F4B60CC5BF78C2214A313DCB3147D40DDB2DFB29 Content-Transfer-Encoding: 8bit Description =========== In the Linux kernel, the following vulnerability has been resolved: IB/core: Fix a nested dead lock as part of ODP flow Fix a nested dead lock as part of ODP flow by using mmput_async(). >>From the below call trace [1] can see that calling mmput() once we have the umem_odp->umem_mutex locked as required by ib_umem_odp_map_dma_and_lock() might trigger in the same task the exit_mmap()->__mmu_notifier_release()->mlx5_ib_invalidate_range() which may dead lock when trying to lock the same mutex. Moving to use mmput_async() will solve the problem as the above exit_mmap() flow will be called in other task and will be executed once the lock will be available. [1] [64843.077665] task:kworker/u133:2 state:D stack: 0 pid:80906 ppid: 2 flags:0x00004000 [64843.077672] Workqueue: mlx5_ib_page_fault mlx5_ib_eqe_pf_action [mlx5_ib] [64843.077719] Call Trace: [64843.077722] [64843.077724] __schedule+0x23d/0x590 [64843.077729] schedule+0x4e/0xb0 [64843.077735] schedule_preempt_disabled+0xe/0x10 [64843.077740] __mutex_lock.constprop.0+0x263/0x490 [64843.077747] __mutex_lock_slowpath+0x13/0x20 [64843.077752] mutex_lock+0x34/0x40 [64843.077758] mlx5_ib_invalidate_range+0x48/0x270 [mlx5_ib] [64843.077808] __mmu_notifier_release+0x1a4/0x200 [64843.077816] exit_mmap+0x1bc/0x200 [64843.077822] ? walk_page_range+0x9c/0x120 [64843.077828] ? __cond_resched+0x1a/0x50 [64843.077833] ? mutex_lock+0x13/0x40 [64843.077839] ? uprobe_clear_state+0xac/0x120 [64843.077860] mmput+0x5f/0x140 [64843.077867] ib_umem_odp_map_dma_and_lock+0x21b/0x580 [ib_core] [64843.077931] pagefault_real_mr+0x9a/0x140 [mlx5_ib] [64843.077962] pagefault_mr+0xb4/0x550 [mlx5_ib] [64843.077992] pagefault_single_data_segment.constprop.0+0x2ac/0x560 [mlx5_ib] [64843.078022] mlx5_ib_eqe_pf_action+0x528/0x780 [mlx5_ib] [64843.078051] process_one_work+0x22b/0x3d0 [64843.078059] worker_thread+0x53/0x410 [64843.078065] ? process_one_work+0x3d0/0x3d0 [64843.078073] kthread+0x12a/0x150 [64843.078079] ? set_kthread_struct+0x50/0x50 [64843.078085] ret_from_fork+0x22/0x30 [64843.078093] The Linux kernel CVE team has assigned CVE-2022-48675 to this issue. Affected and fixed versions =========================== Issue introduced in 5.10 with commit 36f30e486dce and fixed in 5.10.143 with commit e8de6cb5755e Issue introduced in 5.10 with commit 36f30e486dce and fixed in 5.15.68 with commit 819110054b14 Issue introduced in 5.10 with commit 36f30e486dce and fixed in 5.19.9 with commit 83c43fd872e3 Issue introduced in 5.10 with commit 36f30e486dce and fixed in 6.0 with commit 85eaeb5058f0 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-48675 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: drivers/infiniband/core/umem_odp.c kernel/fork.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/e8de6cb5755eae7b793d8c00c8696c8667d44a7f https://git.kernel.org/stable/c/819110054b14d7272b4188db997a3d80f75ab785 https://git.kernel.org/stable/c/83c43fd872e32c8071d5582eb7c40f573a8342f3 https://git.kernel.org/stable/c/85eaeb5058f0f04dffb124c97c86b4f18db0b833