Re: [PATCH v2] ipc/shm: fix the historical/wrong mm->start_stack check

2014-08-26 Thread Oleg Nesterov
On 08/26, Cyrill Gorcunov wrote: > > On Mon, Aug 25, 2014 at 09:12:07PM +0200, Oleg Nesterov wrote: > > + vma = find_vma(current->mm, addr); > > + if (vma) { > > + unsigned long end = addr + size; > > + > > + if (vma->vm_flags & VM_GROWSDOWN)

Re: [PATCH v2] ipc/shm: fix the historical/wrong mm->start_stack check

2014-08-26 Thread Oleg Nesterov
On 08/25, Hugh Dickins wrote: > > On Mon, 25 Aug 2014, Oleg Nesterov wrote: > > >As Hugh pointed out, we actually need to require the additional > >guard page, but this code was written before linux had it. > > > > 3. This wrongly assumes that the stack can only grown down. > > > > Personal

Re: [PATCH v2] ipc/shm: fix the historical/wrong mm->start_stack check

2014-08-25 Thread Hugh Dickins
On Mon, 25 Aug 2014, Oleg Nesterov wrote: > The ->start_stack check in do_shmat() looks ugly and simply wrong. > > 1. ->start_stack is only valid right after exec(), the application >can switch to another stack and even unmap this area. Or a stack >can simply grow, ->start_stack won't eve

Re: [PATCH v2] ipc/shm: fix the historical/wrong mm->start_stack check

2014-08-25 Thread Cyrill Gorcunov
On Mon, Aug 25, 2014 at 09:12:07PM +0200, Oleg Nesterov wrote: > + vma = find_vma(current->mm, addr); > + if (vma) { > + unsigned long end = addr + size; > + > + if (vma->vm_flags & VM_GROWSDOWN) > + end +=

[PATCH v2] ipc/shm: fix the historical/wrong mm->start_stack check

2014-08-25 Thread Oleg Nesterov
The ->start_stack check in do_shmat() looks ugly and simply wrong. 1. ->start_stack is only valid right after exec(), the application can switch to another stack and even unmap this area. Or a stack can simply grow, ->start_stack won't even notice this. 2. The reason for this check is not c