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 6E19B1991D4 for ; Mon, 21 Oct 2024 18:02:19 +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=1729533739; cv=none; b=OAH0G0yxovDW0wEncWbVtQcgy79jLDWKSKjjBI1gWqt5lrq4gU8TcXfh81ker7oNItr6udg2IYCOsdB2uRnsOCbD7HJhe1favdKHZtlT21yCOplNlq+JnQld/io7bKQteW/tdBxt3yiZSQNxYgbpOYqHhBZHposPUTsUq+R9GlU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729533739; c=relaxed/simple; bh=IWOjIHwxNa/DEeG3gF0oIbNOhF0l4y4E0co0A3r1obA=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=uPBFvlwtXcQo90dNp1GcqmduHJ53C+WXzRAOsytC2Wte6R0OoKfruKhltRnRaPOlQNov0XTs6B6f6Amw5Am6J0UdBXVLwU8WBmKvi4OsxHLk9UPFCrkXi73Qfyrz1y/XVIsaIVDDExE04bm9bdbjTjysD+AXcqduWKSlbrZeroA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=rlQeTtfh; 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="rlQeTtfh" Received: by smtp.kernel.org (Postfix) with ESMTPSA id E02FFC4CEEA; Mon, 21 Oct 2024 18:02:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1729533739; bh=IWOjIHwxNa/DEeG3gF0oIbNOhF0l4y4E0co0A3r1obA=; h=From:To:Cc:Subject:Date:Reply-to:From; b=rlQeTtfhORpjytGJp3ft/mXkUfx59aUv1K0R460qlRL3OlhTtYW5ewNtA4HTv43Ml jxNz2WWP8NVVJESo1muz4yLYjROzsCkQ/n/fJSJwinzvlWk9K+OUN6Wta1Btgq/NhP sxztBz7VDKRjsNEqdZu0tTtX0ZH0yk9cM/Ut5hTs= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2024-49866: tracing/timerlat: Fix a race during cpuhp processing Date: Mon, 21 Oct 2024 20:01:14 +0200 Message-ID: <2024102113-CVE-2024-49866-159b@gregkh> X-Mailer: git-send-email 2.47.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=4426; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=IWOjIHwxNa/DEeG3gF0oIbNOhF0l4y4E0co0A3r1obA=; b=owGbwMvMwCRo6H6F97bub03G02pJDOli014233G+cdD0z50ZK+v2CT14cdxI3n7j+QluDG2ir +W7ArPdO2JZGASZGGTFFFm+bOM5ur/ikKKXoe1pmDmsTCBDGLg4BWAigTsZ5od0L08K/jvr1Tn9 qN5nO6s2T1m8Ip1hwflGU729aU5sTve4ZxSJfPZ3fvGIBQA= 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/timerlat: Fix a race during cpuhp processing There is another found exception that the "timerlat/1" thread was scheduled on CPU0, and lead to timer corruption finally: ``` ODEBUG: init active (active state 0) object: ffff888237c2e108 object type: hrtimer hint: timerlat_irq+0x0/0x220 WARNING: CPU: 0 PID: 426 at lib/debugobjects.c:518 debug_print_object+0x7d/0xb0 Modules linked in: CPU: 0 UID: 0 PID: 426 Comm: timerlat/1 Not tainted 6.11.0-rc7+ #45 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.13.0-1ubuntu1.1 04/01/2014 RIP: 0010:debug_print_object+0x7d/0xb0 ... Call Trace: ? __warn+0x7c/0x110 ? debug_print_object+0x7d/0xb0 ? report_bug+0xf1/0x1d0 ? prb_read_valid+0x17/0x20 ? handle_bug+0x3f/0x70 ? exc_invalid_op+0x13/0x60 ? asm_exc_invalid_op+0x16/0x20 ? debug_print_object+0x7d/0xb0 ? debug_print_object+0x7d/0xb0 ? __pfx_timerlat_irq+0x10/0x10 __debug_object_init+0x110/0x150 hrtimer_init+0x1d/0x60 timerlat_main+0xab/0x2d0 ? __pfx_timerlat_main+0x10/0x10 kthread+0xb7/0xe0 ? __pfx_kthread+0x10/0x10 ret_from_fork+0x2d/0x40 ? __pfx_kthread+0x10/0x10 ret_from_fork_asm+0x1a/0x30 ``` After tracing the scheduling event, it was discovered that the migration of the "timerlat/1" thread was performed during thread creation. Further analysis confirmed that it is because the CPU online processing for osnoise is implemented through workers, which is asynchronous with the offline processing. When the worker was scheduled to create a thread, the CPU may has already been removed from the cpu_online_mask during the offline process, resulting in the inability to select the right CPU: T1 | T2 [CPUHP_ONLINE] | cpu_device_down() osnoise_hotplug_workfn() | | cpus_write_lock() | takedown_cpu(1) | cpus_write_unlock() [CPUHP_OFFLINE] | cpus_read_lock() | start_kthread(1) | cpus_read_unlock() | To fix this, skip online processing if the CPU is already offline. The Linux kernel CVE team has assigned CVE-2024-49866 to this issue. Affected and fixed versions =========================== Issue introduced in 5.14 with commit c8895e271f79 and fixed in 5.15.168 with commit 322920b53dc1 Issue introduced in 5.14 with commit c8895e271f79 and fixed in 6.1.113 with commit ce25f33ba89d Issue introduced in 5.14 with commit c8895e271f79 and fixed in 6.6.55 with commit a6e9849063a6 Issue introduced in 5.14 with commit c8895e271f79 and fixed in 6.10.14 with commit a0d9c0cd5856 Issue introduced in 5.14 with commit c8895e271f79 and fixed in 6.11.3 with commit f72b451dc755 Issue introduced in 5.14 with commit c8895e271f79 and fixed in 6.12-rc2 with commit 829e0c9f0855 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-2024-49866 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/322920b53dc11f9c2b33397eb3ae5bc6a175b60d https://git.kernel.org/stable/c/ce25f33ba89d6eefef64157655d318444580fa14 https://git.kernel.org/stable/c/a6e9849063a6c8f4cb2f652a437e44e3ed24356c https://git.kernel.org/stable/c/a0d9c0cd5856191e095cf43a2e141b73945b7716 https://git.kernel.org/stable/c/f72b451dc75578f644a3019c1489e9ae2c14e6c4 https://git.kernel.org/stable/c/829e0c9f0855f26b3ae830d17b24aec103f7e915