From: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
To: Thomas Gleixner <tglx@linutronix.de>
Cc: linux-kernel <linux-kernel@vger.kernel.org>,
linux-api <linux-api@vger.kernel.org>,
Peter Zijlstra <peterz@infradead.org>,
"Paul E. McKenney" <paulmck@linux.vnet.ibm.com>,
Boqun Feng <boqun.feng@gmail.com>,
Andy Lutomirski <luto@amacapital.net>,
Dave Watson <davejwatson@fb.com>, Paul Turner <pjt@google.com>,
Andrew Morton <akpm@linux-foundation.org>,
Russell King <linux@arm.linux.org.uk>,
Ingo Molnar <mingo@redhat.com>, "H. Peter Anvin" <hpa@zytor.com>,
Andi Kleen <andi@firstfloor.org>, Chris Lameter <cl@linux.com>,
Ben Maurer <bmaurer@fb.com>, rostedt <rostedt@goodmis.org>,
Josh Triplett <josh@joshtriplett.org>,
Linus Torvalds <torvalds@linux-foundation.org>,
Catalin Marinas <catalin.marinas@arm.com>,
Will Deacon <will.deacon@arm.com>,
Michael
Subject: Re: [RFC PATCH for 4.18 3/5] rseq: uapi: declare rseq_cs field as union, update includes
Date: Fri, 6 Jul 2018 15:23:39 -0400 (EDT) [thread overview]
Message-ID: <436937568.1359.1530905019620.JavaMail.zimbra@efficios.com> (raw)
In-Reply-To: <1846432971.1245.1530892973439.JavaMail.zimbra@efficios.com>
----- On Jul 6, 2018, at 12:02 PM, Mathieu Desnoyers mathieu.desnoyers@efficios.com wrote:
> ----- On Jul 5, 2018, at 2:05 PM, Mathieu Desnoyers
> mathieu.desnoyers@efficios.com wrote:
>
[...]
> The 0-day bot noticed that __get_user() is unimplemented for 64-bit
> values on arm32 (although get_user() is implemented).
>
> The following diff fixes this discrepancy, and allows this rseq patch
> to build on arm32:
>
For -rc, I would favor the following simpler approach. Or I could even
just use get_user() instead. Thoughts ?
rseq: implement work-around for missing 8-byte __get_user on arm
Now that rseq uses __u64 for its pointer fields, 32-bit architectures
need to read this 64-bit value from user-space.
__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. Work-around this limitation
by using get_user() on ARM instead, with its redundant access check.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
CC: Thomas Gleixner <tglx@linutronix.de>
Cc: Joel Fernandes <joelaf@google.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Dave Watson <davejwatson@fb.com>
Cc: Will Deacon <will.deacon@arm.com>
Cc: Andi Kleen <andi@firstfloor.org>
Cc: "H . Peter Anvin" <hpa@zytor.com>
Cc: Chris Lameter <cl@linux.com>
Cc: Russell King <linux@arm.linux.org.uk>
Cc: Andrew Hunter <ahh@google.com>
Cc: Michael Kerrisk <mtk.manpages@gmail.com>
Cc: "Paul E . McKenney" <paulmck@linux.vnet.ibm.com>
Cc: Paul Turner <pjt@google.com>
Cc: Boqun Feng <boqun.feng@gmail.com>
Cc: Josh Triplett <josh@joshtriplett.org>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Ben Maurer <bmaurer@fb.com>
Cc: linux-api@vger.kernel.org
CC: linux-arm-kernel@lists.infradead.org
Cc: Andy Lutomirski <luto@amacapital.net>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
diff --git a/kernel/rseq.c b/kernel/rseq.c
index 3081e67..0e67625 100644
--- a/kernel/rseq.c
+++ b/kernel/rseq.c
@@ -18,6 +18,16 @@
#define CREATE_TRACE_POINTS
#include <trace/events/rseq.h>
+/*
+ * ARM does not implement 8 bytes __get_user. Use get_user on that
+ * architecture instead.
+ */
+#ifdef CONFIG_ARM
+#define __rseq_get_user get_user
+#else
+#define __rseq_get_user __get_user
+#endif
+
#define RSEQ_CS_PREEMPT_MIGRATE_FLAGS (RSEQ_CS_FLAG_NO_RESTART_ON_MIGRATE | \
RSEQ_CS_FLAG_NO_RESTART_ON_PREEMPT)
@@ -120,7 +130,7 @@ static int rseq_get_rseq_cs(struct task_struct *t, struct rs
u32 sig;
int ret;
- ret = __get_user(ptr, &t->rseq->rseq_cs.ptr64);
+ ret = __rseq_get_user(ptr, &t->rseq->rseq_cs.ptr64);
if (ret)
return ret;
if (!ptr) {
--
Mathieu Desnoyers
EfficiOS Inc.
http://www.efficios.com
WARNING: multiple messages have this Message-ID (diff)
From: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
To: Thomas Gleixner <tglx@linutronix.de>
Cc: linux-kernel <linux-kernel@vger.kernel.org>,
linux-api <linux-api@vger.kernel.org>,
Peter Zijlstra <peterz@infradead.org>,
"Paul E. McKenney" <paulmck@linux.vnet.ibm.com>,
Boqun Feng <boqun.feng@gmail.com>,
Andy Lutomirski <luto@amacapital.net>,
Dave Watson <davejwatson@fb.com>, Paul Turner <pjt@google.com>,
Andrew Morton <akpm@linux-foundation.org>,
Russell King <linux@arm.linux.org.uk>,
Ingo Molnar <mingo@redhat.com>, "H. Peter Anvin" <hpa@zytor.com>,
Andi Kleen <andi@firstfloor.org>, Chris Lameter <cl@linux.com>,
Ben Maurer <bmaurer@fb.com>, rostedt <rostedt@goodmis.org>,
Josh Triplett <josh@joshtriplett.org>,
Linus Torvalds <torvalds@linux-foundation.org>,
Catalin Marinas <catalin.marinas@arm.com>,
Will Deacon <will.deacon@arm.com>,
Michael Kerrisk <mtk.manpages@gmail.com>,
Joel Fernandes <joelaf@google.com>
Subject: Re: [RFC PATCH for 4.18 3/5] rseq: uapi: declare rseq_cs field as union, update includes
Date: Fri, 6 Jul 2018 15:23:39 -0400 (EDT) [thread overview]
Message-ID: <436937568.1359.1530905019620.JavaMail.zimbra@efficios.com> (raw)
In-Reply-To: <1846432971.1245.1530892973439.JavaMail.zimbra@efficios.com>
----- On Jul 6, 2018, at 12:02 PM, Mathieu Desnoyers mathieu.desnoyers@efficios.com wrote:
> ----- On Jul 5, 2018, at 2:05 PM, Mathieu Desnoyers
> mathieu.desnoyers@efficios.com wrote:
>
[...]
> The 0-day bot noticed that __get_user() is unimplemented for 64-bit
> values on arm32 (although get_user() is implemented).
>
> The following diff fixes this discrepancy, and allows this rseq patch
> to build on arm32:
>
For -rc, I would favor the following simpler approach. Or I could even
just use get_user() instead. Thoughts ?
rseq: implement work-around for missing 8-byte __get_user on arm
Now that rseq uses __u64 for its pointer fields, 32-bit architectures
need to read this 64-bit value from user-space.
__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. Work-around this limitation
by using get_user() on ARM instead, with its redundant access check.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
CC: Thomas Gleixner <tglx@linutronix.de>
Cc: Joel Fernandes <joelaf@google.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Dave Watson <davejwatson@fb.com>
Cc: Will Deacon <will.deacon@arm.com>
Cc: Andi Kleen <andi@firstfloor.org>
Cc: "H . Peter Anvin" <hpa@zytor.com>
Cc: Chris Lameter <cl@linux.com>
Cc: Russell King <linux@arm.linux.org.uk>
Cc: Andrew Hunter <ahh@google.com>
Cc: Michael Kerrisk <mtk.manpages@gmail.com>
Cc: "Paul E . McKenney" <paulmck@linux.vnet.ibm.com>
Cc: Paul Turner <pjt@google.com>
Cc: Boqun Feng <boqun.feng@gmail.com>
Cc: Josh Triplett <josh@joshtriplett.org>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Ben Maurer <bmaurer@fb.com>
Cc: linux-api@vger.kernel.org
CC: linux-arm-kernel@lists.infradead.org
Cc: Andy Lutomirski <luto@amacapital.net>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
diff --git a/kernel/rseq.c b/kernel/rseq.c
index 3081e67..0e67625 100644
--- a/kernel/rseq.c
+++ b/kernel/rseq.c
@@ -18,6 +18,16 @@
#define CREATE_TRACE_POINTS
#include <trace/events/rseq.h>
+/*
+ * ARM does not implement 8 bytes __get_user. Use get_user on that
+ * architecture instead.
+ */
+#ifdef CONFIG_ARM
+#define __rseq_get_user get_user
+#else
+#define __rseq_get_user __get_user
+#endif
+
#define RSEQ_CS_PREEMPT_MIGRATE_FLAGS (RSEQ_CS_FLAG_NO_RESTART_ON_MIGRATE | \
RSEQ_CS_FLAG_NO_RESTART_ON_PREEMPT)
@@ -120,7 +130,7 @@ static int rseq_get_rseq_cs(struct task_struct *t, struct rs
u32 sig;
int ret;
- ret = __get_user(ptr, &t->rseq->rseq_cs.ptr64);
+ ret = __rseq_get_user(ptr, &t->rseq->rseq_cs.ptr64);
if (ret)
return ret;
if (!ptr) {
--
Mathieu Desnoyers
EfficiOS Inc.
http://www.efficios.com
next prev parent reply other threads:[~2018-07-06 19:23 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-07-05 18:05 [RFC PATCH for 4.18 0/5] Restartable Sequences updates Mathieu Desnoyers
2018-07-05 18:05 ` Mathieu Desnoyers
2018-07-05 18:05 ` [RFC PATCH for 4.18 1/5] rseq: use __u64 for rseq_cs fields, validate user inputs Mathieu Desnoyers
2018-07-05 18:05 ` Mathieu Desnoyers
2018-07-05 18:05 ` [RFC PATCH for 4.18 2/5] rseq: uapi: update uapi comments Mathieu Desnoyers
2018-07-05 18:05 ` Mathieu Desnoyers
2018-07-05 18:05 ` [RFC PATCH for 4.18 3/5] rseq: uapi: declare rseq_cs field as union, update includes Mathieu Desnoyers
2018-07-05 18:05 ` Mathieu Desnoyers
2018-07-06 16:02 ` Mathieu Desnoyers
2018-07-06 16:02 ` Mathieu Desnoyers
2018-07-06 19:23 ` Mathieu Desnoyers [this message]
2018-07-06 19:23 ` Mathieu Desnoyers
2018-07-06 19:31 ` Linus Torvalds
2018-07-06 19:31 ` Linus Torvalds
2018-07-06 19:35 ` Mathieu Desnoyers
2018-07-06 19:35 ` Mathieu Desnoyers
2018-07-06 19:38 ` Mathieu Desnoyers
2018-07-06 19:38 ` Mathieu Desnoyers
2018-07-06 19:56 ` Linus Torvalds
2018-07-06 19:56 ` Linus Torvalds
2018-07-07 15:06 ` Russell King - ARM Linux
2018-07-07 15:06 ` Russell King - ARM Linux
2018-07-06 19:56 ` Andy Lutomirski
2018-07-06 19:56 ` Andy Lutomirski
2018-07-05 18:06 ` [RFC PATCH for 4.18 4/5] rseq: remove unused types_32_64.h uapi header Mathieu Desnoyers
2018-07-05 18:06 ` Mathieu Desnoyers
2018-07-05 18:06 ` [RFC PATCH for 4.18 5/5] rseq/selftests: cleanup: update comment above rseq_prepare_unload Mathieu Desnoyers
2018-07-05 18:06 ` 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=436937568.1359.1530905019620.JavaMail.zimbra@efficios.com \
--to=mathieu.desnoyers@efficios.com \
--cc=akpm@linux-foundation.org \
--cc=andi@firstfloor.org \
--cc=bmaurer@fb.com \
--cc=boqun.feng@gmail.com \
--cc=catalin.marinas@arm.com \
--cc=cl@linux.com \
--cc=davejwatson@fb.com \
--cc=hpa@zytor.com \
--cc=josh@joshtriplett.org \
--cc=linux-api@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@arm.linux.org.uk \
--cc=luto@amacapital.net \
--cc=mingo@redhat.com \
--cc=paulmck@linux.vnet.ibm.com \
--cc=peterz@infradead.org \
--cc=pjt@google.com \
--cc=rostedt@goodmis.org \
--cc=tglx@linutronix.de \
--cc=torvalds@linux-foundation.org \
--cc=will.deacon@arm.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.