]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/commit
mm/mmap.c: expand_downwards: don't require the gap if !vm_prev
authorOleg Nesterov <oleg@redhat.com>
Mon, 17 Jul 2017 12:53:29 +0000 (14:53 +0200)
committerKleber Sacilotto de Souza <kleber.souza@canonical.com>
Mon, 17 Jul 2017 16:18:21 +0000 (18:18 +0200)
commitaea792ba99ba73a6b0c4e5aea3b4b6b3f9d821f6
treed52646e7b8daba9e53ebcb2a0593613f0d22246c
parent3e4f09eef73ad12d4876e24daf52a0dc0891d7da
mm/mmap.c: expand_downwards: don't require the gap if !vm_prev

expand_stack(vma) fails if address < stack_guard_gap even if there is no
vma->vm_prev.  I don't think this makes sense, and we didn't do this
before the recent commit 1be7107fbe18 ("mm: larger stack guard gap,
between vmas").

We do not need a gap in this case, any address is fine as long as
security_mmap_addr() doesn't object.

This also simplifies the code, we know that address >= prev->vm_end and
thus underflow is not possible.

Link: http://lkml.kernel.org/r/20170628175258.GA24881@redhat.com
Signed-off-by: Oleg Nesterov <oleg@redhat.com>
Acked-by: Michal Hocko <mhocko@suse.com>
Cc: Hugh Dickins <hughd@google.com>
Cc: Larry Woodman <lwoodman@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
CVE-2017-1000364

(cherry picked from commit 32e4e6d5cbb0c0e427391635991fe65e17797af8)
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
Acked-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
Acked-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
mm/mmap.c