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 B19EA17CA08 for ; Tue, 16 Jul 2024 12:27: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=1721132877; cv=none; b=k/r6s8VKAZQNY2D99fiFngDnZaIpNEX48f9Nhpf9JZdrACPqQakxFpijzmmh5746zCYc7m1CE0xduttIIApLQBDuYu6XVnIkD/G9StI/BJ2rf2A9fXtYWTeyeC0MApkLuqoQH3U3UcXKE/e//DIfBML8rQU4WZmlQCFcoaUBx6A= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1721132877; c=relaxed/simple; bh=Is77GU789CSDqsI1nK/eqZHPtXAs3eHsP5qQ0TFW2pI=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=q2WzLurKJwwr8wezwAnNgHsZsUiF0kFu1VISlYaEOc26aqx+OcaBk36r7N8cEGnVWAACrWM/hnJlGKAp5eRdU2bBpevOX2m4Yw8kJ5o6toY3whEFlEMUYqS+hPDLrn4bte5mvdnGZR4eozm/K1K37wQ6Tu4Ph58m/1P3cI/GNlI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=Nqu9yhhF; 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="Nqu9yhhF" Received: by smtp.kernel.org (Postfix) with ESMTPSA id CE14CC116B1; Tue, 16 Jul 2024 12:27:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1721132877; bh=Is77GU789CSDqsI1nK/eqZHPtXAs3eHsP5qQ0TFW2pI=; h=From:To:Cc:Subject:Date:Reply-to:From; b=Nqu9yhhFHk5O/Gn/and0Q1eqdR1SPxPL8fcPMfFThJ1GgU+dUc4nThvy0iG5ZGeKe NXA4fOPF0PwgljOzEiesTG72DDputIcpHfxG7zxAkQGjx/7jL0c/Ersx7PKdPbEtK7 keQhTmeEAcg6RTVTbR6Jc5/9Lyod6md6SG9bbmmI= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2022-48848: tracing/osnoise: Do not unregister events twice Date: Tue, 16 Jul 2024 14:27:33 +0200 Message-ID: <2024071624-CVE-2022-48848-3cfb@gregkh> X-Mailer: git-send-email 2.45.2 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=3235; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=Is77GU789CSDqsI1nK/eqZHPtXAs3eHsP5qQ0TFW2pI=; b=owGbwMvMwCRo6H6F97bub03G02pJDGnT0nUcJBf+XBbb4LQrMMIkZens1k/hN3vTH9vaBqkK1 zfqXf3WEcvCIMjEICumyPJlG8/R/RWHFL0MbU/DzGFlAhnCwMUpABPZz88wvzxdhFFmSvdDo++b PvRsUJNwubDrJMP81NWMTxxz5r3nWFjyalIu36fIqFWcAA== 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: tracing/osnoise: Do not unregister events twice Nicolas reported that using: # trace-cmd record -e all -M 10 -p osnoise --poll Resulted in the following kernel warning: ------------[ cut here ]------------ WARNING: CPU: 0 PID: 1217 at kernel/tracepoint.c:404 tracepoint_probe_unregister+0x280/0x370 [...] CPU: 0 PID: 1217 Comm: trace-cmd Not tainted 5.17.0-rc6-next-20220307-nico+ #19 RIP: 0010:tracepoint_probe_unregister+0x280/0x370 [...] CR2: 00007ff919b29497 CR3: 0000000109da4005 CR4: 0000000000170ef0 Call Trace: osnoise_workload_stop+0x36/0x90 tracing_set_tracer+0x108/0x260 tracing_set_trace_write+0x94/0xd0 ? __check_object_size.part.0+0x10a/0x150 ? selinux_file_permission+0x104/0x150 vfs_write+0xb5/0x290 ksys_write+0x5f/0xe0 do_syscall_64+0x3b/0x90 entry_SYSCALL_64_after_hwframe+0x44/0xae RIP: 0033:0x7ff919a18127 [...] ---[ end trace 0000000000000000 ]--- The warning complains about an attempt to unregister an unregistered tracepoint. This happens on trace-cmd because it first stops tracing, and then switches the tracer to nop. Which is equivalent to: # cd /sys/kernel/tracing/ # echo osnoise > current_tracer # echo 0 > tracing_on # echo nop > current_tracer The osnoise tracer stops the workload when no trace instance is actually collecting data. This can be caused both by disabling tracing or disabling the tracer itself. To avoid unregistering events twice, use the existing trace_osnoise_callback_enabled variable to check if the events (and the workload) are actually active before trying to deactivate them. The Linux kernel CVE team has assigned CVE-2022-48848 to this issue. Affected and fixed versions =========================== Issue introduced in 5.16 with commit 2fac8d6486d5 and fixed in 5.16.15 with commit 4e10787d1837 Issue introduced in 5.16 with commit 2fac8d6486d5 and fixed in 5.17 with commit f0cfe17bcc1d 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-48848 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/trace_osnoise.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/4e10787d18379d9b296290c2288097feddef16d4 https://git.kernel.org/stable/c/f0cfe17bcc1dd2f0872966b554a148e888833ee9