]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/commitdiff
UBUNTU: SAUCE: mm: Only expand stack if guard area is hit
authorStefan Bader <stefan.bader@canonical.com>
Tue, 20 Jun 2017 13:12:33 +0000 (15:12 +0200)
committerStefan Bader <stefan.bader@canonical.com>
Tue, 20 Jun 2017 13:12:33 +0000 (15:12 +0200)
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>
mm/memory.c

index fca9dc75a04d3f01d3e012ae808fc8525d7f64fd..ad7fa9be2fa0cb8c29ea9a3aba613cc51261811d 100644 (file)
@@ -2733,9 +2733,10 @@ static int do_anonymous_page(struct vm_fault *vmf)
                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