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 07FAE194124 for ; Thu, 1 May 2025 14:17:23 +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=1746109043; cv=none; b=h9IGgW0T3CVwtj3eDD5ys68A4ClgPcOvZPfSqzCpMShKKuUCtNKt0/XsAmS0vOBaR1Y3UKTRmY9ig1FU3DuP1x0BawMZnX2aQqvvkO8TuD7TqLY1fhY8HT4gzvygwZSlBDy6gPpeEsUDvOLBg8ADDrrBiBE7A1C/NOzmzgeUiv8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1746109043; c=relaxed/simple; bh=PodvfiG2tHnnov4t7T00u6OJrQh+6bzVTSCSGyXMGyE=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=qhPxaI7firQnHyId8EXn1hkd3B1KO+SUf+yuSCPtgWJIA7hY7oSdms7LwJgzsykfu+mfsdGbAo+7ZBhcOei6b6SV9i5EjL6Z+U8eIgjbIvf32Dp8NMNxOaO6luHy5etNhUrAGpRV/k6vc1y59preVSS/lpa5+xbLz6+b4+GtdKc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=nmMEqkOQ; 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="nmMEqkOQ" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6B403C4CEE3; Thu, 1 May 2025 14:17:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1746109042; bh=PodvfiG2tHnnov4t7T00u6OJrQh+6bzVTSCSGyXMGyE=; h=From:To:Cc:Subject:Date:Reply-to:From; b=nmMEqkOQhvYcarXA6BEj4nYq3Ji0oF3pFSElF+wT3xf3zCGv4dCpH9uQIO4d/bBbk 3Ce/DLKFTZHXdZK5A7dNfqCIxZDuOB4E1+F1u6QxG0u8xkyRWXZZk/7TiYHzQzBvB6 0suMoo5FvoYpRi1SyyNBorZHCzdzVejCeNFMqJyM= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2022-49891: tracing: kprobe: Fix memory leak in test_gen_kprobe/kretprobe_cmd() Date: Thu, 1 May 2025 16:11:21 +0200 Message-ID: <2025050158-CVE-2022-49891-67cc@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=3198; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=tE4b3y4xmQiPSAF+qpGNZjIryW+hD9fQyGtHxfJvq6g=; b=owGbwMvMwCRo6H6F97bub03G02pJDBnCDdsEpk/c361jafLtsePjjW3ZV6w1Qvkz85Ls5E4k3 ciq75/dEcvCIMjEICumyPJlG8/R/RWHFL0MbU/DzGFlAhnCwMUpABNZepphnmLDjVu73FvZ5iZ9 m57sLOT/cjmjH8OCZaYFpxSXtieFOspOF+44LSXRd/sxAA== 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: tracing: kprobe: Fix memory leak in test_gen_kprobe/kretprobe_cmd() test_gen_kprobe_cmd() only free buf in fail path, hence buf will leak when there is no failure. Move kfree(buf) from fail path to common path to prevent the memleak. The same reason and solution in test_gen_kretprobe_cmd(). unreferenced object 0xffff888143b14000 (size 2048): comm "insmod", pid 52490, jiffies 4301890980 (age 40.553s) hex dump (first 32 bytes): 70 3a 6b 70 72 6f 62 65 73 2f 67 65 6e 5f 6b 70 p:kprobes/gen_kp 72 6f 62 65 5f 74 65 73 74 20 64 6f 5f 73 79 73 robe_test do_sys backtrace: [<000000006d7b836b>] kmalloc_trace+0x27/0xa0 [<0000000009528b5b>] 0xffffffffa059006f [<000000008408b580>] do_one_initcall+0x87/0x2a0 [<00000000c4980a7e>] do_init_module+0xdf/0x320 [<00000000d775aad0>] load_module+0x3006/0x3390 [<00000000e9a74b80>] __do_sys_finit_module+0x113/0x1b0 [<000000003726480d>] do_syscall_64+0x35/0x80 [<000000003441e93b>] entry_SYSCALL_64_after_hwframe+0x46/0xb0 The Linux kernel CVE team has assigned CVE-2022-49891 to this issue. Affected and fixed versions =========================== Issue introduced in 5.6 with commit 64836248dda20c8e7427b493f7e06d9bf8f58850 and fixed in 5.10.154 with commit bef08acbe560a926b4cee9cc46404cc98ae5703b Issue introduced in 5.6 with commit 64836248dda20c8e7427b493f7e06d9bf8f58850 and fixed in 5.15.78 with commit d1b6a8e3414aeaa0985139180c145d2d0fbd2a49 Issue introduced in 5.6 with commit 64836248dda20c8e7427b493f7e06d9bf8f58850 and fixed in 6.0.8 with commit 71aeb8d01a8c7ab5cf7da3f81b35206f56ce6bca Issue introduced in 5.6 with commit 64836248dda20c8e7427b493f7e06d9bf8f58850 and fixed in 6.1 with commit 66f0919c953ef7b55e5ab94389a013da2ce80a2c 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-49891 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: kernel/trace/kprobe_event_gen_test.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/bef08acbe560a926b4cee9cc46404cc98ae5703b https://git.kernel.org/stable/c/d1b6a8e3414aeaa0985139180c145d2d0fbd2a49 https://git.kernel.org/stable/c/71aeb8d01a8c7ab5cf7da3f81b35206f56ce6bca https://git.kernel.org/stable/c/66f0919c953ef7b55e5ab94389a013da2ce80a2c