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 63520191F7F for ; Thu, 27 Feb 2025 02:18:49 +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=1740622729; cv=none; b=ENKyhqC0beTtnFgvEZ1QlXmy814No83YLX6ev54mWb+kf6SsmkwJtKdmNklgS72dVfDsYYRF27YeTrYp7BNTakwcllym6H2tuvb4vWxIwOj2WND9Prg8A52NEUCELeCLQMk56Gs+Rgd7FM2coeCg7pGGWF0q3S2ebPSQxhWJuM4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740622729; c=relaxed/simple; bh=m4g9Lu70eVj6FRigzUV9yvPdHds7TYq/J2LcM1iACNk=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=keA72EIrNHm3p0sirwUxFMr5qnLyycvI30TPkUgrY+C3nX4p/N29dVal2czjvmUU82+u/wLR/6Zz94Qo2e5fT3gJC+BJWWkB8K3KgLxdY/7QrPVwVHiIl/9u04xAaZypzWMgdNghilgWg+5s1aa0aDkZz04uvLhNKJyG5xUe8yY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=ic80Q6ke; 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="ic80Q6ke" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 31091C4CED6; Thu, 27 Feb 2025 02:18:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1740622729; bh=m4g9Lu70eVj6FRigzUV9yvPdHds7TYq/J2LcM1iACNk=; h=From:To:Cc:Subject:Date:Reply-to:From; b=ic80Q6keqqf2dlpfMAFIy2OD81M22pZZbRffMuQw9AUmTLzzfD/x8TS//U3yAnBGh eyUEBcO+4b/wSNVDEL5dk/L9mn/ttXtuC7rD/0xz+V3qtCGyH8ps34rn52q6Y78ATT zRtXXcjHKCTXMs0BI0HFGltmy3A4xcmMl3YFBL2Y= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2025-21767: clocksource: Use migrate_disable() to avoid calling get_random_u32() in atomic context Date: Wed, 26 Feb 2025 18:17:23 -0800 Message-ID: <2025022605-CVE-2025-21767-4c7f@gregkh> X-Mailer: git-send-email 2.48.1 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=3908; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=m4g9Lu70eVj6FRigzUV9yvPdHds7TYq/J2LcM1iACNk=; b=owGbwMvMwCRo6H6F97bub03G02pJDOn7TyseSU6+15wWxXIwKcp24Zxoja0X2p47Hra56XF/3 okPvw0vdMSyMAgyMciKKbJ82cZzdH/FIUUvQ9vTMHNYmUCGMHBxCsBEvp1hmB/bpPfRfHdQc5Bu z252nvR1rs8+vGZYsDRu98cbP5s1xHJm9/1Mm+v2dGqkFgA= 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: clocksource: Use migrate_disable() to avoid calling get_random_u32() in atomic context The following bug report happened with a PREEMPT_RT kernel: BUG: sleeping function called from invalid context at kernel/locking/spinlock_rt.c:48 in_atomic(): 1, irqs_disabled(): 0, non_block: 0, pid: 2012, name: kwatchdog preempt_count: 1, expected: 0 RCU nest depth: 0, expected: 0 get_random_u32+0x4f/0x110 clocksource_verify_choose_cpus+0xab/0x1a0 clocksource_verify_percpu.part.0+0x6b/0x330 clocksource_watchdog_kthread+0x193/0x1a0 It is due to the fact that clocksource_verify_choose_cpus() is invoked with preemption disabled. This function invokes get_random_u32() to obtain random numbers for choosing CPUs. The batched_entropy_32 local lock and/or the base_crng.lock spinlock in driver/char/random.c will be acquired during the call. In PREEMPT_RT kernel, they are both sleeping locks and so cannot be acquired in atomic context. Fix this problem by using migrate_disable() to allow smp_processor_id() to be reliably used without introducing atomic context. preempt_disable() is then called after clocksource_verify_choose_cpus() but before the clocksource measurement is being run to avoid introducing unexpected latency. The Linux kernel CVE team has assigned CVE-2025-21767 to this issue. Affected and fixed versions =========================== Issue introduced in 5.14 with commit 7560c02bdffb7c52d1457fa551b9e745d4b9e754 and fixed in 6.1.129 with commit 852805b6cbdb69c298a8fc9fbe79994c95106e04 Issue introduced in 5.14 with commit 7560c02bdffb7c52d1457fa551b9e745d4b9e754 and fixed in 6.6.79 with commit 8783ceeee797d9aa9cfe150690fb9d0bac8cc459 Issue introduced in 5.14 with commit 7560c02bdffb7c52d1457fa551b9e745d4b9e754 and fixed in 6.12.16 with commit cc3d79e7c806cb57d71c28a4a35e7d7fb3265faa Issue introduced in 5.14 with commit 7560c02bdffb7c52d1457fa551b9e745d4b9e754 and fixed in 6.13.4 with commit 0fb534187d2355f6c8f995321e76d1ccd1262ac1 Issue introduced in 5.14 with commit 7560c02bdffb7c52d1457fa551b9e745d4b9e754 and fixed in 6.14-rc2 with commit 6bb05a33337b2c842373857b63de5c9bf1ae2a09 Issue introduced in 5.10.50 with commit d9b40ebd448e437ffbc65f013836f98252279a82 Issue introduced in 5.12.17 with commit 193e14e68e907b2a7a936a7726accbaa4df25a4d Issue introduced in 5.13.2 with commit 155d3c5d24ee13cafa6236b49fc02b240a511d59 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-2025-21767 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/time/clocksource.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/852805b6cbdb69c298a8fc9fbe79994c95106e04 https://git.kernel.org/stable/c/8783ceeee797d9aa9cfe150690fb9d0bac8cc459 https://git.kernel.org/stable/c/cc3d79e7c806cb57d71c28a4a35e7d7fb3265faa https://git.kernel.org/stable/c/0fb534187d2355f6c8f995321e76d1ccd1262ac1 https://git.kernel.org/stable/c/6bb05a33337b2c842373857b63de5c9bf1ae2a09