From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753514AbbIKRAq (ORCPT ); Fri, 11 Sep 2015 13:00:46 -0400 Received: from pandora.arm.linux.org.uk ([78.32.30.218]:41492 "EHLO pandora.arm.linux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753289AbbIKRAn (ORCPT ); Fri, 11 Sep 2015 13:00:43 -0400 Date: Fri, 11 Sep 2015 18:00:27 +0100 From: Russell King - ARM Linux To: Julien Grall Cc: xen-devel@lists.xenproject.org, linux-arm-kernel@lists.infradead.org, ian.campbell@citrix.com, stefano.stabellini@eu.citrix.com, linux-kernel@vger.kernel.org, Riku Voipio Subject: Re: [PATCH v2] arm/xen: Enable user access to the kernel before issuing a privcmd call Message-ID: <20150911170027.GX21084@n2100.arm.linux.org.uk> References: <1441988759-4572-1-git-send-email-julien.grall@citrix.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1441988759-4572-1-git-send-email-julien.grall@citrix.com> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 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 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. > __HVC(XEN_IMM) > + > + /* > + * Disable userspace access from kernel. This is fine to do it > + * unconditionally as no set_fs(KERNEL_DS)/set_fs(get_ds()) is > + * called before. > + */ > + uaccess_disable r4 > + > ldm sp!, {r4} > ret lr > ENDPROC(privcmd_call); > -- > 2.1.4 > -- FTTC broadband for 0.8mile line: currently at 9.6Mbps down 400kbps up according to speedtest.net.