[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20080729005105.GA15046@martell.zuzino.mipt.ru>
Date: Tue, 29 Jul 2008 04:51:05 +0400
From: Alexey Dobriyan <adobriyan@...il.com>
To: Linus Torvalds <torvalds@...ux-foundation.org>
Cc: Johannes Weiner <hannes@...urebad.de>, akpm@...uxfoundation.org,
torvalds@...uxfoundation.org, npiggin@...e.de,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] x86: do not overrun page table ranges in gup
On Mon, Jul 28, 2008 at 05:39:18PM -0700, Linus Torvalds wrote:
>
>
> On Mon, 28 Jul 2008, Linus Torvalds wrote:
> >
> > So no, the right fix would be to align 'start' first, which means that
> > everything else (including 'end') will be page-aligned. Aligning just one
> > or the other is very very wrong.
>
> Does this work?
>
> Not pretty, but it stands _some_ chance of being correct.
vmsplice01 doesn't crash now.
> --- a/arch/x86/mm/gup.c
> +++ b/arch/x86/mm/gup.c
> @@ -223,14 +223,17 @@ int get_user_pages_fast(unsigned long start, int nr_pages, int write,
> struct page **pages)
> {
> struct mm_struct *mm = current->mm;
> - unsigned long end = start + (nr_pages << PAGE_SHIFT);
> - unsigned long addr = start;
> + unsigned long addr, len, end;
> unsigned long next;
> pgd_t *pgdp;
> int nr = 0;
>
> + start &= PAGE_MASK;
> + addr = start;
> + len = (unsigned long) nr_pages << PAGE_SHIFT;
> + end = start + len;
> if (unlikely(!access_ok(write ? VERIFY_WRITE : VERIFY_READ,
> - start, nr_pages*PAGE_SIZE)))
> + start, len)))
> goto slow_irqon;
>
> /*
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists