* [PATCH] LoongArch: Show CPU vulnerabilites correctly
@ 2026-04-09 12:23 Huacai Chen
2026-04-10 22:25 ` kernel test robot
2026-04-11 0:31 ` kernel test robot
0 siblings, 2 replies; 3+ messages in thread
From: Huacai Chen @ 2026-04-09 12:23 UTC (permalink / raw)
To: Huacai Chen
Cc: loongarch, Xuefeng Li, Guo Ren, Xuerui Wang, Jiaxun Yang,
linux-kernel, Huacai Chen, stable
Most LoongArch processors are vulnerable to Spectre-V1 Proof-of-Concept
(PoC). And the generic mechanism, __user pointer sanitization, can be
used as a mitigation. This means to use array_index_nospec() to prevent
out of boundry access in syscall and other critical paths.
Implement the arch-specific cpu_show_spectre_v1() to show CPU Spectre-V1
vulnerabilites correctly.
Cc: stable@vger.kernel.org
Link: https://cc-sw.com/chinese-loongarch-architecture-evaluation-part-3-of-3/
Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
---
arch/loongarch/kernel/cpu-probe.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/arch/loongarch/kernel/cpu-probe.c b/arch/loongarch/kernel/cpu-probe.c
index 8654a1eff834..c8947c798195 100644
--- a/arch/loongarch/kernel/cpu-probe.c
+++ b/arch/loongarch/kernel/cpu-probe.c
@@ -402,3 +402,9 @@ void cpu_probe(void)
cpu_report();
}
+
+ssize_t cpu_show_spectre_v1(struct device *dev,
+ struct device_attribute *attr, char *buf)
+{
+ return sysfs_emit(buf, "Mitigation: __user pointer sanitization\n");
+}
--
2.52.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] LoongArch: Show CPU vulnerabilites correctly
2026-04-09 12:23 [PATCH] LoongArch: Show CPU vulnerabilites correctly Huacai Chen
@ 2026-04-10 22:25 ` kernel test robot
2026-04-11 0:31 ` kernel test robot
1 sibling, 0 replies; 3+ messages in thread
From: kernel test robot @ 2026-04-10 22:25 UTC (permalink / raw)
To: Huacai Chen, Huacai Chen
Cc: llvm, oe-kbuild-all, loongarch, Xuefeng Li, Guo Ren, Xuerui Wang,
Jiaxun Yang, linux-kernel, stable
Hi Huacai,
kernel test robot noticed the following build warnings:
[auto build test WARNING on linus/master]
[also build test WARNING on v7.0-rc7 next-20260410]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Huacai-Chen/LoongArch-Show-CPU-vulnerabilites-correctly/20260411-011556
base: linus/master
patch link: https://lore.kernel.org/r/20260409122348.2438400-1-chenhuacai%40loongson.cn
patch subject: [PATCH] LoongArch: Show CPU vulnerabilites correctly
config: loongarch-allnoconfig (https://download.01.org/0day-ci/archive/20260411/202604110604.ckBnAnTg-lkp@intel.com/config)
compiler: clang version 23.0.0git (https://github.com/llvm/llvm-project ae825cb8cea7f3ac8e5e4096f22713845cf5e501)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260411/202604110604.ckBnAnTg-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202604110604.ckBnAnTg-lkp@intel.com/
All warnings (new ones prefixed by >>):
>> arch/loongarch/kernel/cpu-probe.c:407:15: warning: declaration of 'struct device_attribute' will not be visible outside of this function [-Wvisibility]
407 | struct device_attribute *attr, char *buf)
| ^
>> arch/loongarch/kernel/cpu-probe.c:406:9: warning: no previous prototype for function 'cpu_show_spectre_v1' [-Wmissing-prototypes]
406 | ssize_t cpu_show_spectre_v1(struct device *dev,
| ^
arch/loongarch/kernel/cpu-probe.c:406:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
406 | ssize_t cpu_show_spectre_v1(struct device *dev,
| ^
| static
2 warnings generated.
vim +407 arch/loongarch/kernel/cpu-probe.c
405
> 406 ssize_t cpu_show_spectre_v1(struct device *dev,
> 407 struct device_attribute *attr, char *buf)
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] LoongArch: Show CPU vulnerabilites correctly
2026-04-09 12:23 [PATCH] LoongArch: Show CPU vulnerabilites correctly Huacai Chen
2026-04-10 22:25 ` kernel test robot
@ 2026-04-11 0:31 ` kernel test robot
1 sibling, 0 replies; 3+ messages in thread
From: kernel test robot @ 2026-04-11 0:31 UTC (permalink / raw)
To: Huacai Chen, Huacai Chen
Cc: oe-kbuild-all, loongarch, Xuefeng Li, Guo Ren, Xuerui Wang,
Jiaxun Yang, linux-kernel, stable
Hi Huacai,
kernel test robot noticed the following build warnings:
[auto build test WARNING on linus/master]
[also build test WARNING on v7.0-rc7 next-20260410]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Huacai-Chen/LoongArch-Show-CPU-vulnerabilites-correctly/20260411-011556
base: linus/master
patch link: https://lore.kernel.org/r/20260409122348.2438400-1-chenhuacai%40loongson.cn
patch subject: [PATCH] LoongArch: Show CPU vulnerabilites correctly
config: loongarch-randconfig-001-20260411 (https://download.01.org/0day-ci/archive/20260411/202604110810.YFUm5KE1-lkp@intel.com/config)
compiler: loongarch64-linux-gcc (GCC) 14.3.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260411/202604110810.YFUm5KE1-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202604110810.YFUm5KE1-lkp@intel.com/
All warnings (new ones prefixed by >>):
>> arch/loongarch/kernel/cpu-probe.c:407:36: warning: 'struct device_attribute' declared inside parameter list will not be visible outside of this definition or declaration
407 | struct device_attribute *attr, char *buf)
| ^~~~~~~~~~~~~~~~
>> arch/loongarch/kernel/cpu-probe.c:406:9: warning: no previous prototype for 'cpu_show_spectre_v1' [-Wmissing-prototypes]
406 | ssize_t cpu_show_spectre_v1(struct device *dev,
| ^~~~~~~~~~~~~~~~~~~
vim +407 arch/loongarch/kernel/cpu-probe.c
405
> 406 ssize_t cpu_show_spectre_v1(struct device *dev,
> 407 struct device_attribute *attr, char *buf)
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-04-11 0:31 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-09 12:23 [PATCH] LoongArch: Show CPU vulnerabilites correctly Huacai Chen
2026-04-10 22:25 ` kernel test robot
2026-04-11 0:31 ` kernel test robot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox