[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH v2] arm/xen: Enable user access to the kernel before issuing a privcmd call



On Fri, 11 Sep 2015, Russell King - ARM Linux wrote:
> On Fri, Sep 11, 2015 at 06:56:50PM +0100, Stefano Stabellini wrote:
> > On Fri, 11 Sep 2015, Russell King - ARM Linux wrote:
> > > On Fri, Sep 11, 2015 at 06:36:05PM +0100, Julien Grall wrote:
> > > > On 11/09/15 18:32, Julien Grall wrote:
> > > > > On 11/09/15 18:00, Russell King - ARM Linux wrote:
> > > > >> On Fri, Sep 11, 2015 at 05:25:59PM +0100, Julien Grall wrote:
> > > > >>> +   /*
> > > > >>> +    * Privcmd calls are issued by the userspace. We need to allow 
> > > > >>> the
> > > > >>> +    * kernel to access the userspace memory before issuing the 
> > > > >>> hypercall.
> > > > >>> +    */
> > > > >>> +   uaccess_enable r4
> > > > >>> +
> > > > >>> +   /* r4 is loaded now as we use it as scratch register before */
> > > > >>>     ldr r4, [sp, #4]
> > > > >>
> > > > >> As I mentioned in one of my previous mails, "ip" should be safe to 
> > > > >> use
> > > > >> here - it's a caller-corrupted register, just like r0-r3 and lr.  So,
> > > > >> you could do:
> > > > >>
> > > > >>      ldr r4, [sp, #4]
> > > > >> +    uaccess_enable ip
> > > > > 
> > > > > The register ip (aka r12) is used to store the hypercall number. So we
> > > > > can't reuse it as scratch register.
> > > > > 
> > > > > The easiest one is r4.
> > > > > 
> > > > >>
> > > > >> which fractionally tightens the window.
> > > > >>
> > > > >> However, there's nothing actually wrong with your version - there's 
> > > > >> no
> > > > >> way we could've got this far with sp pointing at userspace.
> > > > >>
> > > > >> I'm happy with either version, so:
> > > > >>
> > > > >> Acked-by: Russell King <rmk+kernel@xxxxxxxxxxxxxxxx>
> > > > >>
> > > > >> How do you want to handle the patch?  I already have some other 
> > > > >> uaccess
> > > > >> fixes queued up to send to Linus before the merge window closes.
> > > > 
> > > > Forgot to answer to this bits. I was thinking to ask Stefano carrying
> > > > the patch in xentip. Although it won't go until rc1.
> > > > 
> > > > I don't mind if it's going earlier in Linux/master.
> > > 
> > > Thanks, I've applied your patch as-is now.
> > 
> > That's fine by me, the patch looks good.
> 
> If you'd like your ack on it, please send one, I can still do that.

Acked-by: Stefano Stabellini <stefano.stabellini@xxxxxxxxxxxxx>

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.