----- On Jul 6, 2018, at 12:02 PM, Mathieu Desnoyers mathieu.desnoyers@xxxxxxxxxxxx wrote: > ----- On Jul 5, 2018, at 2:05 PM, Mathieu Desnoyers > mathieu.desnoyers@xxxxxxxxxxxx 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@xxxxxxxxxxxx> CC: Thomas Gleixner <tglx@xxxxxxxxxxxxx> Cc: Joel Fernandes <joelaf@xxxxxxxxxx> Cc: Peter Zijlstra <peterz@xxxxxxxxxxxxx> Cc: Catalin Marinas <catalin.marinas@xxxxxxx> Cc: Dave Watson <davejwatson@xxxxxx> Cc: Will Deacon <will.deacon@xxxxxxx> Cc: Andi Kleen <andi@xxxxxxxxxxxxxx> Cc: "H . Peter Anvin" <hpa@xxxxxxxxx> Cc: Chris Lameter <cl@xxxxxxxxx> Cc: Russell King <linux@xxxxxxxxxxxxxxxx> Cc: Andrew Hunter <ahh@xxxxxxxxxx> Cc: Michael Kerrisk <mtk.manpages@xxxxxxxxx> Cc: "Paul E . McKenney" <paulmck@xxxxxxxxxxxxxxxxxx> Cc: Paul Turner <pjt@xxxxxxxxxx> Cc: Boqun Feng <boqun.feng@xxxxxxxxx> Cc: Josh Triplett <josh@xxxxxxxxxxxxxxxx> Cc: Steven Rostedt <rostedt@xxxxxxxxxxx> Cc: Ben Maurer <bmaurer@xxxxxx> Cc: linux-api@xxxxxxxxxxxxxxx CC: linux-arm-kernel@xxxxxxxxxxxxxxxxxxx Cc: Andy Lutomirski <luto@xxxxxxxxxxxxxx> Cc: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> Cc: Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx> 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 -- To unsubscribe from this list: send the line "unsubscribe linux-api" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html