summaryrefslogtreecommitdiffstats
path: root/arch/arm64/kernel/smp.c
diff options
context:
space:
mode:
authorSamuel Holland <samuel.holland@sifive.com>2024-08-14 11:09:53 +0200
committerCatalin Marinas <catalin.marinas@arm.com>2024-08-15 12:04:56 +0200
commitf75c235565f90c4a17b125e47f1c68ef6b8c2bce (patch)
tree919d8adc0e97196c423bb9bfe0bf3c5b00c61d7e /arch/arm64/kernel/smp.c
parentarm64: ACPI: NUMA: initialize all values of acpi_early_node_map to NUMA_NO_NODE (diff)
downloadlinux-f75c235565f90c4a17b125e47f1c68ef6b8c2bce.tar.xz
linux-f75c235565f90c4a17b125e47f1c68ef6b8c2bce.zip
arm64: Fix KASAN random tag seed initialization
Currently, kasan_init_sw_tags() is called before setup_per_cpu_areas(), so per_cpu(prng_state, cpu) accesses the same address regardless of the value of "cpu", and the same seed value gets copied to the percpu area for every CPU. Fix this by moving the call to smp_prepare_boot_cpu(), which is the first architecture hook after setup_per_cpu_areas(). Fixes: 3c9e3aa11094 ("kasan: add tag related helper functions") Fixes: 3f41b6093823 ("kasan: fix random seed generation for tag-based mode") Signed-off-by: Samuel Holland <samuel.holland@sifive.com> Reviewed-by: Andrey Konovalov <andreyknvl@gmail.com> Link: https://lore.kernel.org/r/20240814091005.969756-1-samuel.holland@sifive.com Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Diffstat (limited to 'arch/arm64/kernel/smp.c')
-rw-r--r--arch/arm64/kernel/smp.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/arch/arm64/kernel/smp.c b/arch/arm64/kernel/smp.c
index 5e18fbcee9a2..f01f0fd7b7fe 100644
--- a/arch/arm64/kernel/smp.c
+++ b/arch/arm64/kernel/smp.c
@@ -467,6 +467,8 @@ void __init smp_prepare_boot_cpu(void)
init_gic_priority_masking();
kasan_init_hw_tags();
+ /* Init percpu seeds for random tags after cpus are set up. */
+ kasan_init_sw_tags();
}
/*