From: Julien Grall Subject: Re: [PATCH] arm/xen: Enable user access to the kernel before issuing a privcmd call Date: Fri, 11 Sep 2015 16:36:55 +0100 Message-ID: <55F2F517.6020105__40635.3038074032$1441985960$gmane$org@citrix.com> References: <1441980963-9002-1-git-send-email-julien.grall@citrix.com> <1441981760.3549.57.camel@citrix.com> <55F2E909.70600@citrix.com> <1441983304.3549.73.camel@citrix.com> <55F2EBA6.6060008@citrix.com> <20150911152525.GU21084@n2100.arm.linux.org.uk> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1ZaQOv-00037K-B3 for xen-devel@lists.xenproject.org; Fri, 11 Sep 2015 15:38:09 +0000 In-Reply-To: <20150911152525.GU21084@n2100.arm.linux.org.uk> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Russell King - ARM Linux Cc: Ian Campbell , stefano.stabellini@eu.citrix.com, Riku Voipio , linux-kernel@vger.kernel.org, xen-devel@lists.xenproject.org, linux-arm-kernel@lists.infradead.org List-Id: xen-devel@lists.xenproject.org On 11/09/15 16:25, Russell King - ARM Linux wrote: > On Fri, Sep 11, 2015 at 03:56:38PM +0100, Julien Grall wrote: >> Well, we can't assume that the function will be called with uaccess >> disabled. > > Please explain your reasoning. I think I was confused about the usage of uaccess. Thank you for the explanation. > The reason copy_from_user() et.al. need to save and restore the DACR is > because the DACR may be in one of two states on older ARM architectures. > It may have set the kernel domain to 'manager' mode, to allow these > accessors to work on kernel memory, or the kernel domain may be in > 'client' mode, thereby preventing the accessors from touching kernel > memory. > > Unless the code path is reachable with the kernel domain in manager > mode, (iow, a set_fs(KERNEL_DS) or set_fs(get_ds()) has been done) then > it should be safe to use uaccess_disable/uaccess_enable. I believe that our privcmd driver doesn't made any usage of set_fs(...), so I will use the uaccess_{disable,enable} macro. Regards, -- Julien Grall