Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp2075361pxk; Sat, 5 Sep 2020 07:44:03 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx9ZQ5wfmB1EowZfL7evdkNIDlClVhUlkx5OyCLJI4JDVWJZRDWCDowaIHJXeyX9FFAfLoT X-Received: by 2002:a17:906:b881:: with SMTP id hb1mr12521313ejb.207.1599317043008; Sat, 05 Sep 2020 07:44:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599317043; cv=none; d=google.com; s=arc-20160816; b=Vc4LhvLzPU4eCO1X1H92VhavEC63ItZfLsJlqQDmjac/BBXrK/lalWln+BSM79g6qY 0RYnPP5zm6HrYK2JWCKzm/A2p3yQsSLGmpcqy5zjKbeW/a4WkMlZjy7IoO3BwLOg68oW xyCee2gAOiyl/qzCeB2+SLWQ1ObVo8py+VoJgBegm4fKZGZ7AvgCTeqnHxLgjxEXquPT J+RlmiV0s/54utJN2jIn7EMOxZhe1iTivzld6LDTE6zX8EFRDy3EjbEPhcpLmPkQ/m2G BzFqhfIQ06kZRh0Og3XHIWUtoEKn3i/KPSW82MWhiNsmyMVd7PUvbGiD340G4LvCHjvF MNKQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=5yBrpLLhz27oCoX09b1ANQ4bSi/YqsHxEyXtwDd08Mc=; b=gnbuVIML963vgZYm94dkBqPLLa2hHTUXK8XU0yFlcO6JDRoxEiEIOYkkiouCwLCJQ1 Fbi8c5ifA6dy3+1O7D8d/JdattAWU9unU99rkSGMB9MbA6qkf9EhvTgdAR7JlMWq3SPn +QOL4fQn1EPYES1Y/FfPdrrKsfe7eCkDloHk2iZroLKg+uzNbcFHaUTFvK9OVn1dr5Fe JMfikWp7d34owwqzhah1eoxxOvBLLWGAm+BLHSMU5nsQz/n+KNYysCYx3/ECvmCHn5xI XHfUNVtYm3yU1ZT0od7Jdi1LrgRI8iBlAyVeZrPA13gkKBJ4LmMfyumtfuHhsEmhQXt7 S69w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id pk25si6425895ejb.746.2020.09.05.07.43.07; Sat, 05 Sep 2020 07:44:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728297AbgIEOl4 (ORCPT + 99 others); Sat, 5 Sep 2020 10:41:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56704 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726302AbgIEOlz (ORCPT ); Sat, 5 Sep 2020 10:41:55 -0400 Received: from ZenIV.linux.org.uk (zeniv.linux.org.uk [IPv6:2002:c35c:fd02::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3FAA6C061244; Sat, 5 Sep 2020 07:41:55 -0700 (PDT) Received: from viro by ZenIV.linux.org.uk with local (Exim 4.92.3 #3 (Red Hat Linux)) id 1kEZNo-00AviF-NY; Sat, 05 Sep 2020 14:41:36 +0000 Date: Sat, 5 Sep 2020 15:41:36 +0100 From: Al Viro To: Christoph Hellwig Cc: Paul Walmsley , Palmer Dabbelt , Arnd Bergmann , linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org Subject: Re: [PATCH 3/8] asm-generic: fix unaligned access hamdling in raw_copy_{from,to}_user Message-ID: <20200905144136.GA2604093@ZenIV.linux.org.uk> References: <20200904165216.1799796-1-hch@lst.de> <20200904165216.1799796-4-hch@lst.de> <20200904180617.GQ1236603@ZenIV.linux.org.uk> <20200904223518.GR1236603@ZenIV.linux.org.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200904223518.GR1236603@ZenIV.linux.org.uk> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Sep 04, 2020 at 11:35:18PM +0100, Al Viro wrote: > Now, if you look at raw_copy_from_user() you'll see an interesting > picture: some architectures special-case the handling of small constant sizes. > Namely, > arc (any size; inlining in there is obscene, constant size or not), > c6x (1,4,8), > m68k/MMU (1,2,3,4,5,6,7,8,9,10,12) > ppc (1,2,4,8), > h8300 (1,2,4), > riscv (with your series)(1,2,4, 8 if 64bit). FWIW, on the raw_copy_to_user() side the same set of constant sizes is recongized by the same architectures and we have * __put_user/put_user in asm-generic/uaccess.h make use of that * arc, c6x, ppc and riscv using it to store sigset_t on sigframe * 3 odd callers: * arc stash_usr_regs(), inlined and unrolled large copy_to_user() * ppc kvm_htab_read(), 64bit store. * i915_gem_execbuffer_ioctl(): if (__copy_to_user(&user_exec_list[i].offset, &exec2_list[i].offset, sizeof(user_exec_list[i].offset))) in a loop. 'offset' here is __u64. That's it. IOW, asm-generic put_user() is the only real cause to have those magic sizes recognized on raw_copy_to_user() side.