Skip to contentSkip to conversation

x86_64: enlarge window for stack growth

PATCH In review Chuck Ebbert 2 participants 2 messages Jun 23, 2006

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86_64: enlarge window for stack growth

Allow stack growth so the 'enter' instruction works. Also fixes problem in compat_sys_kexec_load() which could allocate more than 128 bytes using compat_alloc_user_space().

arch/x86_64/mm/fault.c +4 -2
@@ -410,8 +410,10 @@ asmlinkage void __kprobes do_page_fault(
 	if (!(vma->vm_flags & VM_GROWSDOWN))
 		goto bad_area;
 	if (error_code & 4) {
-		// XXX: align red zone size with ABI 
-		if (address + 128 < regs->rsp)
+		/* Allow userspace just enough access below the stack pointer
+		 * to let the 'enter' instruction work.
+		 */
+		if (address + 65536 + 32 * sizeof(unsigned long) < regs->rsp)
 			goto bad_area;
 	}
 	if (expand_stack(vma, address))
Signature · 2 lines
Chuck
 "You can't read a newspaper if you can't read."  --George W. Bush
#1 lore raw
Quoted 3 lines · Chuck Ebbert

Allow stack growth so the 'enter' instruction works. Also fixes problem in compat_sys_kexec_load() which could allocate more than 128 bytes using compat_alloc_user_space().

Merged thanks.

-Andi