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 53E9B2DFA26 for ; Wed, 1 Oct 2025 11:54:01 +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=1759319641; cv=none; b=pcHbHCK5E1DdIUyYooE6fnQJdvq3rCbkQG21Hi3ODgPZqBqQkaUf72UJXyi+KzRsbNYnv+Ecj4t9tFGM+2kEEOU3yndBtNKgmAlcUaQ3gdLYG2lStn3eL6cvpTI/ntJkvT+/tj+ZOIF/lf+OIKp56QeAwvlAsOvSWgl2vq655tk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1759319641; c=relaxed/simple; bh=Yx82O7nAQZkEz5rhEZfmoXAHlFeyLh6PjoyTCZtoCKk=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=Kh5MTiOU3DuBtYn4Us1q1wnipGdSqIq4SLFXhD12qj59HPOXWZsOwZCk9HfeYnVkEJgZCfpIV0nLNqwIOM+fLpcgCv/0noABRR0TGqX7W2I8WBC3aAPhDtKRjwpGGbL+kwKG3vRFDK5o7LLWKxN8PybJW12XE3eGob2LxCu+SYk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=r9YKDCFr; 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="r9YKDCFr" Received: by smtp.kernel.org (Postfix) with ESMTPSA id B87BCC116C6; Wed, 1 Oct 2025 11:54:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1759319641; bh=Yx82O7nAQZkEz5rhEZfmoXAHlFeyLh6PjoyTCZtoCKk=; h=From:To:Cc:Subject:Date:Reply-to:From; b=r9YKDCFrmoyc6g9YwYTmn9iU3P9HTCsr3hWvrmnP1qqu1bbTHj/fEidBX72AELyO7 m88cnnbc2m17jAIFFmkTRrnQFowuXeq/D3rdabQwxs1q068Cy6Ikn7ZAxOErj3iXPb OrLgR9ujBwziAmMA3Vbtep6vq1tOmAXbk7ZgYiAI= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2023-53478: tracing/synthetic: Fix races on freeing last_cmd Date: Wed, 1 Oct 2025 13:42:48 +0200 Message-ID: <2025100112-CVE-2023-53478-3da0@gregkh> X-Mailer: git-send-email 2.51.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=5236; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=8VlyFmuHY2s/UGezr3fX5eBoEr2DJDr+9qp0GR+UtEM=; b=owGbwMvMwCRo6H6F97bub03G02pJDBl3hac0meaET1p0PCTxz9RwgSsz7p2tCny5LNLtYnyI4 DKLmsdzOmJZGASZGGTFFFm+bOM5ur/ikKKXoe1pmDmsTCBDGLg4BWAi+0oZ5tkntX6tuVypK3tP w5VFYe6sWTInXjDMU0/MX3tA72HxpW3uSls32k4zY1rZBQA= 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/synthetic: Fix races on freeing last_cmd Currently, the "last_cmd" variable can be accessed by multiple processes asynchronously when multiple users manipulate synthetic_events node at the same time, it could lead to use-after-free or double-free. This patch add "lastcmd_mutex" to prevent "last_cmd" from being accessed asynchronously. ================================================================ It's easy to reproduce in the KASAN environment by running the two scripts below in different shells. script 1: while : do echo -n -e '\x88' > /sys/kernel/tracing/synthetic_events done script 2: while : do echo -n -e '\xb0' > /sys/kernel/tracing/synthetic_events done ================================================================ double-free scenario: process A process B ------------------- --------------- 1.kstrdup last_cmd 2.free last_cmd 3.free last_cmd(double-free) ================================================================ use-after-free scenario: process A process B ------------------- --------------- 1.kstrdup last_cmd 2.free last_cmd 3.tracing_log_err(use-after-free) ================================================================ Appendix 1. KASAN report double-free: BUG: KASAN: double-free in kfree+0xdc/0x1d4 Free of addr ***** by task sh/4879 Call trace: ... kfree+0xdc/0x1d4 create_or_delete_synth_event+0x60/0x1e8 trace_parse_run_command+0x2bc/0x4b8 synth_events_write+0x20/0x30 vfs_write+0x200/0x830 ... Allocated by task 4879: ... kstrdup+0x5c/0x98 create_or_delete_synth_event+0x6c/0x1e8 trace_parse_run_command+0x2bc/0x4b8 synth_events_write+0x20/0x30 vfs_write+0x200/0x830 ... Freed by task 5464: ... kfree+0xdc/0x1d4 create_or_delete_synth_event+0x60/0x1e8 trace_parse_run_command+0x2bc/0x4b8 synth_events_write+0x20/0x30 vfs_write+0x200/0x830 ... ================================================================ Appendix 2. KASAN report use-after-free: BUG: KASAN: use-after-free in strlen+0x5c/0x7c Read of size 1 at addr ***** by task sh/5483 sh: CPU: 7 PID: 5483 Comm: sh ... __asan_report_load1_noabort+0x34/0x44 strlen+0x5c/0x7c tracing_log_err+0x60/0x444 create_or_delete_synth_event+0xc4/0x204 trace_parse_run_command+0x2bc/0x4b8 synth_events_write+0x20/0x30 vfs_write+0x200/0x830 ... Allocated by task 5483: ... kstrdup+0x5c/0x98 create_or_delete_synth_event+0x80/0x204 trace_parse_run_command+0x2bc/0x4b8 synth_events_write+0x20/0x30 vfs_write+0x200/0x830 ... Freed by task 5480: ... kfree+0xdc/0x1d4 create_or_delete_synth_event+0x74/0x204 trace_parse_run_command+0x2bc/0x4b8 synth_events_write+0x20/0x30 vfs_write+0x200/0x830 ... The Linux kernel CVE team has assigned CVE-2023-53478 to this issue. Affected and fixed versions =========================== Issue introduced in 5.18 with commit 27c888da9867725784bad3d6455d6e53b425fa2b and fixed in 6.1.24 with commit 9fe183f659a2704255e5d84f6ae308c234a113ec Issue introduced in 5.18 with commit 27c888da9867725784bad3d6455d6e53b425fa2b and fixed in 6.2.11 with commit 8826d9e7bd51e7656f78baa4472e8e2f5e7069f0 Issue introduced in 5.18 with commit 27c888da9867725784bad3d6455d6e53b425fa2b and fixed in 6.3 with commit 4ccf11c4e8a8e051499d53a12f502196c97a758e 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-2023-53478 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_events_synth.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/9fe183f659a2704255e5d84f6ae308c234a113ec https://git.kernel.org/stable/c/8826d9e7bd51e7656f78baa4472e8e2f5e7069f0 https://git.kernel.org/stable/c/4ccf11c4e8a8e051499d53a12f502196c97a758e