[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAK8P3a2YKifKbt4-CUODe4YYPxT-+pRwkj0BAvbw1P8vUg9x1A@mail.gmail.com>
Date: Tue, 9 Jun 2020 16:22:34 +0200
From: Arnd Bergmann <arnd@...db.de>
To: afzal mohammed <afzal.mohd.ma@...il.com>
Cc: Russell King <linux@...linux.org.uk>,
Linux ARM <linux-arm-kernel@...ts.infradead.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: ARM: vmsplit 4g/4g
On Tue, Jun 9, 2020 at 2:15 PM afzal mohammed <afzal.mohd.ma@...il.com> wrote:
> On Mon, Jun 08, 2020 at 08:47:27PM +0530, afzal mohammed wrote:
> > On Mon, Jun 08, 2020 at 04:43:57PM +0200, Arnd Bergmann wrote:
>
> > > There is another difference: get_user_pages_fast() does not return
> > > a vm_area_struct pointer, which is where you would check the access
> > > permissions. I suppose those pointers could not be returned to callers
> > > that don't already hold the mmap_sem.
> >
> > Ok, thanks for the details, i need to familiarize better with mm.
>
> i was & now more confused w.r.t checking access permission using
> vm_area_struct to deny write on a read only user page.
>
> i have been using get_user_pages_fast() w/ FOLL_WRITE in copy_to_user.
> Isn't that sufficient ?, afaiu, get_user_pages_fast() will ensure that
> w/ FOLL_WRITE, pte has write permission, else no struct page * is
> handed back to the caller.
Ah, that does make a lot of sense, I had just never used that flag
myself so I wasn't aware of this.
> Am i missing something or wrong in the analysis ?
As far as I can tell, you are absolutely right, and get_user_pages_fast()
is the best way to handle this correctly and efficiently.
Arnd
Powered by blists - more mailing lists