From mboxrd@z Thu Jan 1 00:00:00 1970 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 805A1146A97 for ; Tue, 21 May 2024 15:39:59 +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=1716305999; cv=none; b=XkdxZ0INatkFUQv+KDao4kMn9gQu2gdNElcEEbfH25jWruvm43O0TBNI0/O1WHW2h4XR0Q4sn5TKFSoXIukpZpkKV6ciEO94/vVLzP/0K7NeKbxRmPUq3KyjsAxrdElJHWv7ClQU1HKT/atqbfUlSN9zC1+jBIVbPPZr1BTW9aE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716305999; c=relaxed/simple; bh=ZCBu7DzM9MM9GoBpz5C+TcPfE5YOf447vWE3Uk3L5+8=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=IkHT09RWKMpjiAvWiioBvpn8sMMemNsXffQ4r680yeY8nCssGavhTP0hh9tnMPF8x3/V3x2Z+a129F87WCZ2wUcGNrbXaz36PFnTbCzqGQEJFmD2Q78M6DIt5sB2yioTNrLufa5G8soWMupJDdpqFOJY4PrNAr/ZiJ9nqVM8Hrw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=j36AjLuu; 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="j36AjLuu" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 00834C2BD11; Tue, 21 May 2024 15:39:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1716305999; bh=ZCBu7DzM9MM9GoBpz5C+TcPfE5YOf447vWE3Uk3L5+8=; h=From:To:Cc:Subject:Date:Reply-to:From; b=j36AjLuuV1LM+HSXdpkr5Jj+jN92S2RTBYRXmOzqd+XVByLDD00j482xGubiKiU7S 6JdmQMTENwV5urDREHW1ZH+SrUpPRpthEndDg36VNwlFRdaJZi70XDJatTsF3eO/9z zwqDRDtcwviILgi+qyLehsRcYuK0q1nJ2HCIwCPc= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2023-52839: drivers: perf: Do not broadcast to other cpus when starting a counter Date: Tue, 21 May 2024 17:32:15 +0200 Message-ID: <2024052111-CVE-2023-52839-e3d4@gregkh> X-Mailer: git-send-email 2.45.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=4792; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=ZCBu7DzM9MM9GoBpz5C+TcPfE5YOf447vWE3Uk3L5+8=; b=kA0DAAIRMUfUDdst+ykByyZiAGZMvj+jv2/Ygqn140s3wAzh3O5OQeU/NAVXtwas+a3pyOyu4 4hdBAARAgAdFiEE9LYMxb94wiFKMT3LMUfUDdst+ykFAmZMvj8ACgkQMUfUDdst+ylG6wCgwfFO hwTwfx98x6qXoWO1pde94q8An0ZG5Jby0y7Emc5iG+TfDy1ahiFb 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: drivers: perf: Do not broadcast to other cpus when starting a counter This command: $ perf record -e cycles:k -e instructions:k -c 10000 -m 64M dd if=/dev/zero of=/dev/null count=1000 gives rise to this kernel warning: [ 444.364395] WARNING: CPU: 0 PID: 104 at kernel/smp.c:775 smp_call_function_many_cond+0x42c/0x436 [ 444.364515] Modules linked in: [ 444.364657] CPU: 0 PID: 104 Comm: perf-exec Not tainted 6.6.0-rc6-00051-g391df82e8ec3-dirty #73 [ 444.364771] Hardware name: riscv-virtio,qemu (DT) [ 444.364868] epc : smp_call_function_many_cond+0x42c/0x436 [ 444.364917] ra : on_each_cpu_cond_mask+0x20/0x32 [ 444.364948] epc : ffffffff8009f9e0 ra : ffffffff8009fa5a sp : ff20000000003800 [ 444.364966] gp : ffffffff81500aa0 tp : ff60000002b83000 t0 : ff200000000038c0 [ 444.364982] t1 : ffffffff815021f0 t2 : 000000000000001f s0 : ff200000000038b0 [ 444.364998] s1 : ff60000002c54d98 a0 : ff60000002a73940 a1 : 0000000000000000 [ 444.365013] a2 : 0000000000000000 a3 : 0000000000000003 a4 : 0000000000000100 [ 444.365029] a5 : 0000000000010100 a6 : 0000000000f00000 a7 : 0000000000000000 [ 444.365044] s2 : 0000000000000000 s3 : ffffffffffffffff s4 : ff60000002c54d98 [ 444.365060] s5 : ffffffff81539610 s6 : ffffffff80c20c48 s7 : 0000000000000000 [ 444.365075] s8 : 0000000000000000 s9 : 0000000000000001 s10: 0000000000000001 [ 444.365090] s11: ffffffff80099394 t3 : 0000000000000003 t4 : 00000000eac0c6e6 [ 444.365104] t5 : 0000000400000000 t6 : ff60000002e010d0 [ 444.365120] status: 0000000200000100 badaddr: 0000000000000000 cause: 0000000000000003 [ 444.365226] [] smp_call_function_many_cond+0x42c/0x436 [ 444.365295] [] on_each_cpu_cond_mask+0x20/0x32 [ 444.365311] [] pmu_sbi_ctr_start+0x7a/0xaa [ 444.365327] [] riscv_pmu_start+0x48/0x66 [ 444.365339] [] perf_adjust_freq_unthr_context+0x196/0x1ac [ 444.365356] [] perf_event_task_tick+0x78/0x8c [ 444.365368] [] scheduler_tick+0xe6/0x25e [ 444.365383] [] update_process_times+0x80/0x96 [ 444.365398] [] tick_sched_handle+0x26/0x52 [ 444.365410] [] tick_sched_timer+0x50/0x98 [ 444.365422] [] __hrtimer_run_queues+0x126/0x18a [ 444.365433] [] hrtimer_interrupt+0xce/0x1da [ 444.365444] [] riscv_timer_interrupt+0x30/0x3a [ 444.365457] [] handle_percpu_devid_irq+0x80/0x114 [ 444.365470] [] generic_handle_domain_irq+0x1c/0x2a [ 444.365483] [] riscv_intc_irq+0x2e/0x46 [ 444.365497] [] handle_riscv_irq+0x4a/0x74 [ 444.365521] [] do_irq+0x7c/0x7e [ 444.365796] ---[ end trace 0000000000000000 ]--- That's because the fix in commit 3fec323339a4 ("drivers: perf: Fix panic in riscv SBI mmap support") was wrong since there is no need to broadcast to other cpus when starting a counter, that's only needed in mmap when the counters could have already been started on other cpus, so simply remove this broadcast. The Linux kernel CVE team has assigned CVE-2023-52839 to this issue. Affected and fixed versions =========================== Issue introduced in 6.6 with commit 3fec323339a4 and fixed in 6.6.2 with commit 85be1a73fd29 Issue introduced in 6.6 with commit 3fec323339a4 and fixed in 6.7 with commit 61e3d993c8bd 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-52839 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: drivers/perf/riscv_pmu_sbi.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/85be1a73fd298ed3fd060dfce97caef5f9928c57 https://git.kernel.org/stable/c/61e3d993c8bd3e80f8f1363ed5e04f88ab531b72