[PATCH] parisc: fix inability to allocate stack pages on exec

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi

The patch 8d7071af8907 ("mm: always expand the stack with the mmap write 
lock held") breaks PA-RISC.

The breakage happens if we attempt to pass more arguments to execve than 
what fits into the initial stack page - we get -E2BIG in such a case.

The reason for the breakage is that the commit 8d7071af8907 adds the test 
"if (!(vma->vm_flags & VM_GROWSDOWN)) return -EFAULT;" to the function 
expand_downwards.

expand_downwards is called from get_arg_page to allocate initial stack 
pages. With the added test for VM_GROWSDOWN, it is not able to allocate 
any pages on PA-RISC at all, and execve fails as soon as it tries to 
allocate a stack page.

The bug can be fixed by dropping the test for VM_GROWSDOWN from 
expand_downwards.

Fixes: 8d7071af8907 ("mm: always expand the stack with the mmap write lock held")
Signed-off-by: Mikulas Patocka <mpatocka@xxxxxxxxxx>
Cc: stable@xxxxxxxxxxxxxxx	# v6.4

---
 mm/mmap.c |    3 ---
 1 file changed, 3 deletions(-)

Index: linux-6.4.1/mm/mmap.c
===================================================================
--- linux-6.4.1.orig/mm/mmap.c	2023-07-03 18:17:35.000000000 +0200
+++ linux-6.4.1/mm/mmap.c	2023-07-03 21:22:44.000000000 +0200
@@ -2036,9 +2036,6 @@ int expand_downwards(struct vm_area_stru
 	struct vm_area_struct *prev;
 	int error = 0;
 
-	if (!(vma->vm_flags & VM_GROWSDOWN))
-		return -EFAULT;
-
 	address &= PAGE_MASK;
 	if (address < mmap_min_addr || address < FIRST_USER_ADDRESS)
 		return -EPERM;





[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux