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 86A34E567 for ; Thu, 1 May 2025 14:12:20 +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=1746108740; cv=none; b=QnTj6vxBDlfsdwFT/yyXTkRiWYmruc1fZIJ4aUJZSI+rJk2AKdMMD37M3XQza1gpzTWb03tZdlpLyR13hp/EUOrjTXh91fRZOtSEQ1kmGo6niphDEuNnIxrNSajWhev398zAsp5Fn4r5kc++luA6wLsfePRdK5Ic/O5qaoJrA0w= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1746108740; c=relaxed/simple; bh=bGOPl2YVL5IgTolnxFhwAhSIKkRirYZ1e70BrUr/Af8=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=C/QNs0aCM0H34LhTqjJQ7gGezW/FfO4ic7u40wJc/u9hDHhP/mkshvIH56kVAi05X0BBYw9/XHoqFp6kd8t1XL21ybRGzJLfyrIeZy++WySx6GedhU2XL7A31tkauu9UCcxwCV6OFT/LpwaAf2+Q6QK89sBHejmUdqGWmjw2rfE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=PhyWT/fi; 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="PhyWT/fi" Received: by smtp.kernel.org (Postfix) with ESMTPSA id E8A95C4CEE3; Thu, 1 May 2025 14:12:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1746108740; bh=bGOPl2YVL5IgTolnxFhwAhSIKkRirYZ1e70BrUr/Af8=; h=From:To:Cc:Subject:Date:Reply-to:From; b=PhyWT/fiUXuEglN36s/7dXthmpG8wQU1xjP6kAHZF4MZcv/PlsUiO3RhgNqIIevkQ F8Xt8TvvW0O/NVhoYR3QhalNzp2UHjKPlJlToWGV1acHAICNKg3pv4hAsZveA7n4Pi H7w79RaVrf+GspP3nxx8XwxfelCZ4spjwE7bHLLs= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2022-49797: tracing: kprobe: Fix potential null-ptr-deref on trace_event_file in kprobe_event_gen_test_exit() Date: Thu, 1 May 2025 16:09:47 +0200 Message-ID: <2025050124-CVE-2022-49797-24aa@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=3949; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=YniGmw5149bWPHSwzN65gRHWBTA9+BLm1ouQUPei6l0=; b=owGbwMvMwCRo6H6F97bub03G02pJDBnCDVPvbGra5Vx6ld/388O7HcZnZu3k/P1g5tvVG2fva drsKbFLpiOWhUGQiUFWTJHlyzaeo/srDil6GdqehpnDygQyhIGLUwAmsucQw4KjTIeZ33X3TV7b c7YyIquYY7VT7BGGeRr2a5lFJ1c96A3+ta57i4KDsKCgJQA= 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 potential null-ptr-deref on trace_event_file in kprobe_event_gen_test_exit() When trace_get_event_file() failed, gen_kretprobe_test will be assigned as the error code. If module kprobe_event_gen_test is removed now, the null pointer dereference will happen in kprobe_event_gen_test_exit(). Check if gen_kprobe_test or gen_kretprobe_test is error code or NULL before dereference them. BUG: kernel NULL pointer dereference, address: 0000000000000012 PGD 0 P4D 0 Oops: 0000 [#1] SMP PTI CPU: 3 PID: 2210 Comm: modprobe Not tainted 6.1.0-rc1-00171-g2159299a3b74-dirty #217 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.15.0-0-g2dd4b9b3f840-prebuilt.qemu.org 04/01/2014 RIP: 0010:kprobe_event_gen_test_exit+0x1c/0xb5 [kprobe_event_gen_test] Code: Unable to access opcode bytes at 0xffffffff9ffffff2. RSP: 0018:ffffc900015bfeb8 EFLAGS: 00010246 RAX: ffffffffffffffea RBX: ffffffffa0002080 RCX: 0000000000000000 RDX: ffffffffa0001054 RSI: ffffffffa0001064 RDI: ffffffffdfc6349c RBP: ffffffffa0000000 R08: 0000000000000004 R09: 00000000001e95c0 R10: 0000000000000000 R11: 0000000000000001 R12: 0000000000000800 R13: ffffffffa0002420 R14: 0000000000000000 R15: 0000000000000000 FS: 00007f56b75be540(0000) GS:ffff88813bc00000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: ffffffff9ffffff2 CR3: 000000010874a006 CR4: 0000000000330ee0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 Call Trace: __x64_sys_delete_module+0x206/0x380 ? lockdep_hardirqs_on_prepare+0xd8/0x190 ? syscall_enter_from_user_mode+0x1c/0x50 do_syscall_64+0x3f/0x90 entry_SYSCALL_64_after_hwframe+0x63/0xcd The Linux kernel CVE team has assigned CVE-2022-49797 to this issue. Affected and fixed versions =========================== Issue introduced in 5.6 with commit 64836248dda20c8e7427b493f7e06d9bf8f58850 and fixed in 5.10.156 with commit bb70fcae4115d24b7e8cee17a6da8b1943f546bb Issue introduced in 5.6 with commit 64836248dda20c8e7427b493f7e06d9bf8f58850 and fixed in 5.15.80 with commit 3a41c0f2a5c3bf72b4c4e9dd4b1025378201e332 Issue introduced in 5.6 with commit 64836248dda20c8e7427b493f7e06d9bf8f58850 and fixed in 6.0.10 with commit fd0efd4f7bfe611a8339ba01bc2ac3c33e79159d Issue introduced in 5.6 with commit 64836248dda20c8e7427b493f7e06d9bf8f58850 and fixed in 6.1 with commit e0d75267f59d7084e0468bd68beeb1bf9c71d7c0 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-49797 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/bb70fcae4115d24b7e8cee17a6da8b1943f546bb https://git.kernel.org/stable/c/3a41c0f2a5c3bf72b4c4e9dd4b1025378201e332 https://git.kernel.org/stable/c/fd0efd4f7bfe611a8339ba01bc2ac3c33e79159d https://git.kernel.org/stable/c/e0d75267f59d7084e0468bd68beeb1bf9c71d7c0