public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] x86/vdso: fix incorrect size in munmap during map_vdso failure
@ 2026-05-03 19:16 Guilherme Giacomo Simoes
  2026-05-05 11:39 ` Thomas Weißschuh
  0 siblings, 1 reply; 3+ messages in thread
From: Guilherme Giacomo Simoes @ 2026-05-03 19:16 UTC (permalink / raw)
  To: luto, tglx, mingo, bp, dave.hansen, hpa
  Cc: x86, linux-kernel, Guilherme Giacomo Simoes

In the map_vdso function, if a failure occurs during the installation of
the VVAR mappings, the error path attempts to clean up previously
allocated mappings using do_munmap. However, the cleanup for the VVAR
mapping was incorrectly using image->size (the size of the vDSO text)
instead of the actual size allocated for the VVAR area.

Replace the incorrect image->size parameter with the constant
VDSO_NR_PAGES * PAGE_SIZE in the do_munmap call. Ensure the unmap size
exactly matches the size used during the vdso_install_vvar_mapping()
phase to provide a symmetrical and complete teardown of the memory
region.

Signed-off-by: Guilherme Giacomo Simoes <trintaeoitogc@gmail.com>
---
 arch/x86/entry/vdso/vma.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/entry/vdso/vma.c b/arch/x86/entry/vdso/vma.c
index a6bfcc8243cd..d903bce24f15 100644
--- a/arch/x86/entry/vdso/vma.c
+++ b/arch/x86/entry/vdso/vma.c
@@ -178,7 +178,7 @@ static int map_vdso(const struct vdso_image *image, unsigned long addr)
 	if (IS_ERR(vma)) {
 		ret = PTR_ERR(vma);
 		do_munmap(mm, text_start, image->size, NULL);
-		do_munmap(mm, addr, image->size, NULL);
+		do_munmap(mm, addr, VDSO_NR_PAGES * PAGE_SIZE, NULL);
 		goto up_fail;
 	}
 
-- 
2.52.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-05-05 12:24 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-03 19:16 [PATCH] x86/vdso: fix incorrect size in munmap during map_vdso failure Guilherme Giacomo Simoes
2026-05-05 11:39 ` Thomas Weißschuh
2026-05-05 12:24   ` Guilherme Giacomo Simoes

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox