Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1676942

[PATCH 0/1] expand_downwards: don't require the gap if !vm_prev

From Oleg Nesterov <oleg@redhat.com>
Newsgroups linux.kernel
Subject [PATCH 0/1] expand_downwards: don't require the gap if !vm_prev
Date 2017-06-28 20:00 +0200
Message-ID <tXppY-t5-75@gated-at.bofh.it> (permalink)
Organization linux.* mail to news gateway

Show all headers | View raw


See the patch, but actually I have another question...

Now that the stack-guard-page has gone, why do we need to allow to grow
into the previous VM_GROWSDOWN vma? IOW, why we can not simply remove
the VM_GROWSDOWN check in expand_downwards() ?

Yes, this is what the kernel did before the recent changes. But afaics
only because the kernel could not know if the vma->vm_start page is
actually guard or not.

IOW, iiuc before the recent change it was not simple to _disallow_ this,
and that is why it worked. Just for example, suppose an application does

	addr = mmap(MAP_GROWSDOWN);
	mprotect(addr, PAGE_SIZE, PROT_NONE);
	*(addr + PAGE_SIZE) = 0;

and of course this should not fail.

But the the kernel could not know if vm_start == addr + PAGE_SIZE is the
"valid" address, or this vma was expanded before and vm_start is the stack
guard.

Yes, we can probably check anon_vma's as the comment suggests, but imo we
we can just remove the VM_GROWSDOWN case unconditionally.

Oleg.

Back to linux.kernel | Previous | NextNext in thread | Find similar | Unroll thread


Thread

[PATCH 0/1] expand_downwards: don't require the gap if !vm_prev Oleg Nesterov <oleg@redhat.com> - 2017-06-28 20:00 +0200
  Re: [PATCH 0/1] expand_downwards: don't require the gap if !vm_prev Linus Torvalds <torvalds@linux-foundation.org> - 2017-06-29 01:30 +0200
    Re: [PATCH 0/1] expand_downwards: don't require the gap if !vm_prev Oleg Nesterov <oleg@redhat.com> - 2017-06-29 17:20 +0200
      Re: [PATCH 0/1] expand_downwards: don't require the gap if !vm_prev Linus Torvalds <torvalds@linux-foundation.org> - 2017-06-29 20:30 +0200
        Re: [PATCH 0/1] expand_downwards: don't require the gap if !vm_prev Oleg Nesterov <oleg@redhat.com> - 2017-06-29 21:00 +0200
          Re: [PATCH 0/1] expand_downwards: don't require the gap if !vm_prev Linus Torvalds <torvalds@linux-foundation.org> - 2017-06-29 21:10 +0200
    Re: [PATCH 0/1] expand_downwards: don't require the gap if !vm_prev Michal Hocko <mhocko@kernel.org> - 2017-06-30 15:30 +0200
      Re: [PATCH 0/1] expand_downwards: don't require the gap if !vm_prev Linus Torvalds <torvalds@linux-foundation.org> - 2017-06-30 19:10 +0200
        Re: [PATCH 0/1] expand_downwards: don't require the gap if !vm_prev Michal Hocko <mhocko@kernel.org> - 2017-06-30 19:30 +0200
          Re: [PATCH 0/1] expand_downwards: don't require the gap if !vm_prev Linus Torvalds <torvalds@linux-foundation.org> - 2017-06-30 19:50 +0200

csiph-web