This was a change which happened rather late in the process. It might
have some performance benefit as it avoids trying to expand the stack
every time it is touched and instead checks on whether the guard area
has been reached.
CVE-2017-
1000364
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
Acked-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>
Acked-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
return VM_FAULT_SIGBUS;
/* Check if we need to add a guard page to the stack */
- if ((vma->vm_flags & (VM_GROWSDOWN|VM_GROWSUP)) &&
- expand_stack(vma, vmf->address) < 0)
- return VM_FAULT_SIGSEGV;
+ if (stack_guard_area(vma, vmf->address)) {
+ if (expand_stack(vma, vmf->address) < 0)
+ return VM_FAULT_SIGSEGV;
+ }
/*
* Use pte_alloc() instead of pte_alloc_map(). We can't run