linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: mathieu.desnoyers@efficios.com (Mathieu Desnoyers)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH for 4.18 2/6] rseq: use get_user/put_user rather than __get_user/__put_user
Date: Tue, 10 Jul 2018 09:48:35 -0400 (EDT)	[thread overview]
Message-ID: <1050939005.3002.1531230515472.JavaMail.zimbra@efficios.com> (raw)
In-Reply-To: <87tvp7mx8j.fsf@concordia.ellerman.id.au>

----- On Jul 10, 2018, at 2:16 AM, Michael Ellerman mpe at ellerman.id.au wrote:

> Mathieu Desnoyers <mathieu.desnoyers@efficios.com> writes:
>> ----- On Jul 8, 2018, at 5:03 PM, Mathieu Desnoyers
>> mathieu.desnoyers at efficios.com wrote:
>>
>>> In preparation to use __u64 for the rseq_cs pointer field, 32-bit
>>> architectures need to read this 64-bit value located in user-space
>>> addresses.
>>> 
>>> __get_user is used to read this value, given that its access check has
>>> already been performed with access_ok() on rseq registration.
>>> 
>>> arm does not implement 8-byte __get_user. Rather than trying to
>>> improve __get_user on ARM, use get_user/put_user across rseq instead.
>>> 
>>> If those end up showing up in benchmarks, the proper approach would be to
>>> use user_access_begin() / unsafe_get/put_user() / user_access_end()
>>> anyway.
>>
>> So, another twist to this story: ppc32 does not implement u64 get_user().
> 
> Or __get_user() for that matter.
> 
> But we should just fix it.
> 
> We have the asm to do it, it's just the fact that __gu_val is unsigned
> long causes the size > sizeof(x) check here to fail:
> 
> #define __get_user_size(x, ptr, size, retval)			\
> do {								\
>	retval = 0;						\
>	__chk_user_ptr(ptr);					\
>	if (size > sizeof(x))					\
>		(x) = __get_user_bad();				\
> 
> 
> 
> We seem to be able to fix that with the __inttype() trick that x86 uses.
> 
> That's probably not 4.18 material though. But if you want to go with
> copy_from_user() for now you could then switch to get_user() for 4.19.

I agree. Let's use copy_from_user() for 4.18. Once get_user() ends up supporting
u64 on ppc32 for 4.19, rseq will happily move back to it.

Thanks,

Mathieu

-- 
Mathieu Desnoyers
EfficiOS Inc.
http://www.efficios.com

  reply	other threads:[~2018-07-10 13:48 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20180708210330.27324-1-mathieu.desnoyers@efficios.com>
2018-07-08 21:03 ` [PATCH for 4.18 2/6] rseq: use get_user/put_user rather than __get_user/__put_user Mathieu Desnoyers
2018-07-09 17:28   ` Mathieu Desnoyers
2018-07-09 18:04     ` Linus Torvalds
2018-07-09 18:19       ` Mathieu Desnoyers
2018-07-09 19:04         ` Linus Torvalds
2018-07-10  6:16     ` Michael Ellerman
2018-07-10 13:48       ` Mathieu Desnoyers [this message]
     [not found] <20180709195155.7654-1-mathieu.desnoyers@efficios.com>
2018-07-09 19:51 ` Mathieu Desnoyers

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=1050939005.3002.1531230515472.JavaMail.zimbra@efficios.com \
    --to=mathieu.desnoyers@efficios.com \
    --cc=linux-arm-kernel@lists.infradead.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;
as well as URLs for NNTP newsgroup(s).