]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
MIPS: kernel: Fix random segmentation faults
authorThomas Bogendoerfer <tsbogend@alpha.franken.de>
Thu, 20 Nov 2025 12:10:29 +0000 (13:10 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 1 Dec 2025 10:46:00 +0000 (11:46 +0100)
[ Upstream commit 14b46ba92bf547508b4a49370c99aba76cb53b53 ]

Commit 69896119dc9d ("MIPS: vdso: Switch to generic storage
implementation") switches to a generic vdso storage, which increases
the number of data pages from 1 to 4. But there is only one page
reserved, which causes segementation faults depending where the VDSO
area is randomized to. To fix this use the same size of reservation
and allocation of the VDSO data pages.

Fixes: 69896119dc9d ("MIPS: vdso: Switch to generic storage implementation")
Reviewed-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
Reviewed-by: Huacai Chen <chenhuacai@loongson.cn>
Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
arch/mips/kernel/process.c

index 29191fa1801e2a5d9bcf9e7771d279d2e96e6344..a3101f2268c6c81b38806949d40c50735ccd89b7 100644 (file)
@@ -692,7 +692,7 @@ unsigned long mips_stack_top(void)
        /* Space for the VDSO, data page & GIC user page */
        if (current->thread.abi) {
                top -= PAGE_ALIGN(current->thread.abi->vdso->size);
-               top -= PAGE_SIZE;
+               top -= VDSO_NR_PAGES * PAGE_SIZE;
                top -= mips_gic_present() ? PAGE_SIZE : 0;
 
                /* Space to randomize the VDSO base */