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

From: Oleg Nesterov
Date: Tue Aug 26 2014 - 15:39:58 EST


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)
> > + end += PAGE_SIZE * 5;
> > +
> > + if (end < addr || end > vma->vm_start)
> > + goto invalid;
>
> Looks good to me, but I somehow missed in first version of the patch
> too the following aspect -- end > vma->vm_start? Maybe end >= vma->vm_end?

I think ">" is correct, the last byte is "addr + size - 1". Otherwise,
say, find_vma_intersection() is buggy. But this doesn't matter, please
see v3.

Oleg.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/