]> git.baikalelectronics.ru Git - kernel.git/commitdiff
s390/vdso: map vdso above stack
authorSven Schnelle <svens@linux.ibm.com>
Wed, 6 Apr 2022 06:44:49 +0000 (08:44 +0200)
committerHeiko Carstens <hca@linux.ibm.com>
Mon, 25 Apr 2022 11:54:14 +0000 (13:54 +0200)
In the current code vdso is mapped below the stack. This is
problematic when programs mapped to the top of the address space
are allocating a lot of memory, because the heap will clash with
the vdso. To avoid this map the vdso above the stack and move
STACK_TOP so that it all fits into three level paging.

Signed-off-by: Sven Schnelle <svens@linux.ibm.com>
Reviewed-by: Heiko Carstens <hca@linux.ibm.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
arch/s390/include/asm/processor.h
arch/s390/kernel/vdso.c

index a3ab8cbcc5e49c259c98379c2b9d89ee28e7f3a4..add764a2be8cadf2ef8cae76af13ed3dc276aede 100644 (file)
@@ -95,9 +95,10 @@ unsigned long vdso_size(void);
                                        (_REGION3_SIZE >> 1) : (_REGION2_SIZE >> 1))
 #define TASK_SIZE_MAX          (-PAGE_SIZE)
 
-#define STACK_TOP              (test_thread_flag(TIF_31BIT) ? \
-                                       _REGION3_SIZE : _REGION2_SIZE)
-#define STACK_TOP_MAX          _REGION2_SIZE
+#define VDSO_BASE              (STACK_TOP + PAGE_SIZE)
+#define VDSO_LIMIT             (test_thread_flag(TIF_31BIT) ? _REGION3_SIZE : _REGION2_SIZE)
+#define STACK_TOP              (VDSO_LIMIT - vdso_size() - PAGE_SIZE)
+#define STACK_TOP_MAX          (_REGION2_SIZE - vdso_size() - PAGE_SIZE)
 
 #define HAVE_ARCH_PICK_MMAP_LAYOUT
 
index 22cb727d58217e588ba97d0bb703bc0ff53b1835..7ba84a88ea2a0dfac400fef1c085fe48f4b5854f 100644 (file)
@@ -221,7 +221,7 @@ unsigned long vdso_size(void)
 
 int arch_setup_additional_pages(struct linux_binprm *bprm, int uses_interp)
 {
-       return map_vdso(0, vdso_size());
+       return map_vdso(VDSO_BASE, vdso_size());
 }
 
 static struct page ** __init vdso_setup_pages(void *start, void *end)