From: Julien Grall <julien.grall@citrix.com>
To: Russell King - ARM Linux <linux@arm.linux.org.uk>
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 <riku.voipio@linaro.org>
Subject: Re: [PATCH v2] arm/xen: Enable user access to the kernel before issuing a privcmd call
Date: Fri, 11 Sep 2015 18:32:27 +0100 [thread overview]
Message-ID: <55F3102B.3090309@citrix.com> (raw)
In-Reply-To: <20150911170027.GX21084@n2100.arm.linux.org.uk>
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@arm.linux.org.uk>
>
> 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
>>
>
--
Julien Grall
next prev parent reply other threads:[~2015-09-11 17:33 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-09-11 16:25 Julien Grall
2015-09-11 17:00 ` Russell King - ARM Linux
2015-09-11 17:09 ` Julien Grall
2015-09-11 17:32 ` Julien Grall [this message]
2015-09-11 17:36 ` Julien Grall
2015-09-11 17:51 ` Russell King - ARM Linux
2015-09-11 17:56 ` Stefano Stabellini
2015-09-11 17:59 ` Russell King - ARM Linux
2015-09-14 9:36 ` Stefano Stabellini
2015-09-14 10:04 ` Russell King - ARM Linux
2015-09-14 11:07 ` Stefano Stabellini
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=55F3102B.3090309@citrix.com \
--to=julien.grall@citrix.com \
--cc=ian.campbell@citrix.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@arm.linux.org.uk \
--cc=riku.voipio@linaro.org \
--cc=stefano.stabellini@eu.citrix.com \
--cc=xen-devel@lists.xenproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome