From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 495E3C3279B for ; Tue, 10 Jul 2018 06:16:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id E8B3F2075B for ; Tue, 10 Jul 2018 06:16:43 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E8B3F2075B Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ellerman.id.au Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751182AbeGJGQj (ORCPT ); Tue, 10 Jul 2018 02:16:39 -0400 Received: from ozlabs.org ([203.11.71.1]:34377 "EHLO ozlabs.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750937AbeGJGQi (ORCPT ); Tue, 10 Jul 2018 02:16:38 -0400 Received: from authenticated.ozlabs.org (localhost [127.0.0.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPSA id 41PsR41pdwz9s0W; Tue, 10 Jul 2018 16:16:31 +1000 (AEST) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=ellerman.id.au From: Michael Ellerman To: Mathieu Desnoyers , Thomas Gleixner Cc: linux-kernel , linux-api , Peter Zijlstra , "Paul E. McKenney" , Boqun Feng , Andy Lutomirski , Dave Watson , Paul Turner , Andrew Morton , Russell King , Ingo Molnar , "H. Peter Anvin" , Andi Kleen , Chris Lameter , Ben Maurer , rostedt , Josh Triplett , Linus Torvalds , Catalin Marinas , Will Deacon , Michael Kerrisk , Joel Fernandes , Andrew Hunter , linux-arm-kernel Subject: Re: [PATCH for 4.18 2/6] rseq: use get_user/put_user rather than __get_user/__put_user In-Reply-To: <854203778.2272.1531157327328.JavaMail.zimbra@efficios.com> References: <20180708210330.27324-1-mathieu.desnoyers@efficios.com> <20180708210330.27324-3-mathieu.desnoyers@efficios.com> <854203778.2272.1531157327328.JavaMail.zimbra@efficios.com> Date: Tue, 10 Jul 2018 16:16:28 +1000 Message-ID: <87tvp7mx8j.fsf@concordia.ellerman.id.au> MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Mathieu Desnoyers writes: > ----- On Jul 8, 2018, at 5:03 PM, Mathieu Desnoyers mathieu.desnoyers@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. cheers