]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
6.12-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 3 Jul 2026 07:26:18 +0000 (09:26 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 3 Jul 2026 07:26:18 +0000 (09:26 +0200)
added patches:
riscv-mm-extract-helper-mark_new_valid_map.patch

queue-6.12/riscv-mm-extract-helper-mark_new_valid_map.patch [new file with mode: 0644]
queue-6.12/series

diff --git a/queue-6.12/riscv-mm-extract-helper-mark_new_valid_map.patch b/queue-6.12/riscv-mm-extract-helper-mark_new_valid_map.patch
new file mode 100644 (file)
index 0000000..68ecc43
--- /dev/null
@@ -0,0 +1,61 @@
+From 9ee25d0a70ff4494b4e1d266b962d0a574ef318a Mon Sep 17 00:00:00 2001
+From: Vivian Wang <wangruikang@iscas.ac.cn>
+Date: Tue, 3 Mar 2026 13:29:45 +0800
+Subject: riscv: mm: Extract helper mark_new_valid_map()
+
+From: Vivian Wang <wangruikang@iscas.ac.cn>
+
+commit 9ee25d0a70ff4494b4e1d266b962d0a574ef318a upstream.
+
+In preparation of a future patch using the same mechanism for
+non-vmalloc addresses, extract the mark_new_valid_map() helper from
+flush_cache_vmap().
+
+No functional change intended.
+
+Cc: stable@vger.kernel.org
+Signed-off-by: Vivian Wang <wangruikang@iscas.ac.cn>
+Link: https://patch.msgid.link/20260303-handle-kfence-protect-spurious-fault-v2-1-f80d8354d79d@iscas.ac.cn
+Signed-off-by: Paul Walmsley <pjw@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ arch/riscv/include/asm/cacheflush.h |   25 ++++++++++++++-----------
+ 1 file changed, 14 insertions(+), 11 deletions(-)
+
+--- a/arch/riscv/include/asm/cacheflush.h
++++ b/arch/riscv/include/asm/cacheflush.h
+@@ -43,20 +43,23 @@ do {                                                       \
+ #ifdef CONFIG_64BIT
+ extern u64 new_vmalloc[NR_CPUS / sizeof(u64) + 1];
+ extern char _end[];
++static inline void mark_new_valid_map(void)
++{
++      int i;
++
++      /*
++       * We don't care if concurrently a cpu resets this value since
++       * the only place this can happen is in handle_exception() where
++       * an sfence.vma is emitted.
++       */
++      for (i = 0; i < ARRAY_SIZE(new_vmalloc); ++i)
++              new_vmalloc[i] = -1ULL;
++}
+ #define flush_cache_vmap flush_cache_vmap
+ static inline void flush_cache_vmap(unsigned long start, unsigned long end)
+ {
+-      if (is_vmalloc_or_module_addr((void *)start)) {
+-              int i;
+-
+-              /*
+-               * We don't care if concurrently a cpu resets this value since
+-               * the only place this can happen is in handle_exception() where
+-               * an sfence.vma is emitted.
+-               */
+-              for (i = 0; i < ARRAY_SIZE(new_vmalloc); ++i)
+-                      new_vmalloc[i] = -1ULL;
+-      }
++      if (is_vmalloc_or_module_addr((void *)start))
++              mark_new_valid_map();
+ }
+ #define flush_cache_vmap_early(start, end)    local_flush_tlb_kernel_range(start, end)
+ #endif
index 3f1b986de280de0cd2c2fc191df9cc2e83c38312..675dbeb790d316e0b91609e1f1bff2274f0cacdb 100644 (file)
@@ -176,6 +176,7 @@ mips-smp-report-dying-cpu-to-rcu-in-stop_this_cpu.patch
 kvm-x86-hyper-v-bound-the-bank-index-when-querying-sparse-banks.patch
 kvm-svm-fix-page-overflow-in-sev_dbg_crypt-for-encrypt-path.patch
 power-reset-linkstation-poweroff-fix-use-after-free-in-the-linkstation_poweroff_init.patch
+riscv-mm-extract-helper-mark_new_valid_map.patch
 riscv-kfence-call-mark_new_valid_map-for-kfence_unprotect.patch
 fbdev-fix-fb_new_modelist-to-prevent-null-ptr-deref-in-fb_videomode_to_var.patch
 fbdev-modedb-fix-a-possible-uaf-in-fb_find_mode.patch