Received: by 2002:a25:ef43:0:0:0:0:0 with SMTP id w3csp224526ybm; Thu, 28 May 2020 21:25:43 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwvMRPLXXERmzfDY7AY4v2VbfrMse5sAXfRYrqXQBkLYbdAT6INpzXV6B+msnS/DofPQHsw X-Received: by 2002:a17:907:9f4:: with SMTP id ce20mr5484744ejc.365.1590726343425; Thu, 28 May 2020 21:25:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590726343; cv=none; d=google.com; s=arc-20160816; b=joTz/wnoBwrCoQZOvhoLamb1PyMDWUBSolLzfb4eS9+PYqYz3vsVYh+iMq5GlClw3z 3PfWUK35GKxcL7iNl49zjyQVcDMaOV6mGZ7ZSv0WTR4F4lbToiL7CosJDc5xT6t8qdtb yKOiFclAdPQ+S1C6PW7oX1t8DQg/Hdyl1e2gmowRPLfFxK6XYVKu1M+uq7ECu7bY16MO w3tQ2YxkcdVOTpCbj6MjtvGxc222rI932cIqq+IffuJh+yGa0A1g32syI9Sur3GJQmWp eXec8MYftEoSqMu/2N7IjetcVa6HlsfEtLOrYv8p/fUPdkaRr1BgyXcGnZWgJ/fpR8FU Iz3w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:date:message-id:subject:cc:from:to :in-reply-to; bh=2skPjn92F/HaD+dvoxhk2lLu3zcZK/UC4EguJQctvdU=; b=olfZeO3Wdj3Y44Rot68AbfIM5VYrswgi0Sqaue5kbU/9nk/G1CgzGZPkiPnlX5vR4z 2B8mo/xFes4YBg0dvTz4Bsn+AZcx+oJylf8zLb2zUhl9GN6bM1ZtufWB/ya5lRhs7CsV lrA2Gw+BWC0PtzihPmdW4o7r8gYqX7THSLRSsBuM4KX+cvxcBrFIkGS4otyMaQ0l4/M0 Vol/gWvKPGMG+1wcVe1ArznpaJujIFzLTD/T0A/vvtb7IRJCGs3lb02PNJUOEJx5JExC FF2KVDAVNOKgt0FUBXbrCLYphWWJMdePVoFo3co5erNJiwIykuHPM7neXPXrhr2OT31y pReQ== 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 hb5si4602856ejb.426.2020.05.28.21.25.19; Thu, 28 May 2020 21:25:43 -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 S1728864AbgE2EVG (ORCPT + 99 others); Fri, 29 May 2020 00:21:06 -0400 Received: from bilbo.ozlabs.org ([203.11.71.1]:54603 "EHLO ozlabs.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728916AbgE2EU1 (ORCPT ); Fri, 29 May 2020 00:20:27 -0400 Received: by ozlabs.org (Postfix, from userid 1034) id 49YBF35KWQz9sSr; Fri, 29 May 2020 14:20:23 +1000 (AEST) X-powerpc-patch-notification: thanks X-powerpc-patch-commit: 999a22890cb183b918e4372395d24426a755cef2 In-Reply-To: <36e43241c7f043a24b5069e78c6a7edd11043be5.1585898438.git.christophe.leroy@c-s.fr> To: Christophe Leroy , Benjamin Herrenschmidt , Paul Mackerras , airlied@linux.ie, daniel@ffwll.ch, torvalds@linux-foundation.org, viro@zeniv.linux.org.uk, akpm@linux-foundation.org, keescook@chromium.org, hpa@zytor.com From: Michael Ellerman Cc: linux-arch@vger.kernel.org, linux-mm@kvack.org, intel-gfx@lists.freedesktop.org, linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 1/5] uaccess: Add user_read_access_begin/end and user_write_access_begin/end Message-Id: <49YBF35KWQz9sSr@ozlabs.org> Date: Fri, 29 May 2020 14:20:23 +1000 (AEST) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 2020-04-03 at 07:20:50 UTC, Christophe Leroy wrote: > Some architectures like powerpc64 have the capability to separate > read access and write access protection. > For get_user() and copy_from_user(), powerpc64 only open read access. > For put_user() and copy_to_user(), powerpc64 only open write access. > But when using unsafe_get_user() or unsafe_put_user(), > user_access_begin open both read and write. > > Other architectures like powerpc book3s 32 bits only allow write > access protection. And on this architecture protection is an heavy > operation as it requires locking/unlocking per segment of 256Mbytes. > On those architecture it is therefore desirable to do the unlocking > only for write access. (Note that book3s/32 ranges from very old > powermac from the 90's with powerpc 601 processor, till modern > ADSL boxes with PowerQuicc II processors for instance so it > is still worth considering.) > > In order to avoid any risk based of hacking some variable parameters > passed to user_access_begin/end that would allow hacking and > leaving user access open or opening too much, it is preferable to > use dedicated static functions that can't be overridden. > > Add a user_read_access_begin and user_read_access_end to only open > read access. > > Add a user_write_access_begin and user_write_access_end to only open > write access. > > By default, when undefined, those new access helpers default on the > existing user_access_begin and user_access_end. > > Signed-off-by: Christophe Leroy > Reviewed-by: Kees Cook Applied to powerpc topic/uaccess, thanks. https://git.kernel.org/powerpc/c/999a22890cb183b918e4372395d24426a755cef2 cheers