Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp3258939pxa; Sat, 8 Aug 2020 15:37:15 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw8Zh1ySD2nGqT9qUZRVcy7NyKlun2QgOutAG/f1R4AAPWd/yKMZuYWyqB/cbP26w8vhp5N X-Received: by 2002:a17:906:cc4d:: with SMTP id mm13mr15076661ejb.191.1596926235584; Sat, 08 Aug 2020 15:37:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1596926235; cv=none; d=google.com; s=arc-20160816; b=gC1t0dihxynGqPxNU98BZ5L6UXcZCRidIHD/2oiYVtID6OSXamhDEqkhlXWOR7TmP3 vN2SDXTdwzvdeLbbg0PqQQ7FE+9z/i6vyRxN8QehTnz52TLgYSTmCLbWnW5BoFfoLXJn LxHWVWSNSxNI0jIqOvzg07Vvg1mptK3Pp2IV2aNwvrl/hcnLkL8Jl45rapMgFK+GFCdi lHpPsSzCPJqGM7AmGeL3X1QuhyH3GodA6SN0q3A1Abvef3W+igt0/jkvipVSdXWnQk27 5knVr1EpUaPL0ylwVYkLTrhweWBKtjK6+SCXzIukFDBywVexjObWo2kdLjkeHRL1b3rR YElQ== 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 :dkim-signature; bh=I/495s6jK4+K+lb6gJ13kJw9U3KMzAEyRbv/wQPm9f8=; b=g8IOTPijF6y1VBBLGiBwEVWzdU18ruTQjhRGkBZX9qmukXsafJEIkK8BOtIV0AfmPU +m3+CurfZHxT3t0VdqT1Pm7OSx9zW413ViNeBEDHVubYWcnfOKx+USiGl53yvi35aftj RNUAGAz7ycRjIPzKR5oU8mWBuBSPafUZUstOPMfqTqn6B7jQQzC/KOjhzU9gI9xWu3dA cVuupt+npxIsLUICAD89jRNrERRVTJXMU7Bgtttx9yvIbIsvLAN3peNjp+MACXG0d09+ nJUYDXD1nlTw2UP1ZgzMGrB/jO17aw4LoFxVQIzYF2ZVbWUH49GVo/x8/UbdOcw85VQe FaiQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=H3PLCcId; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v27si7623488edw.469.2020.08.08.15.36.53; Sat, 08 Aug 2020 15:37:15 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=H3PLCcId; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726175AbgHHWfF (ORCPT + 99 others); Sat, 8 Aug 2020 18:35:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57534 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725950AbgHHWfF (ORCPT ); Sat, 8 Aug 2020 18:35:05 -0400 Received: from mail-pj1-x1044.google.com (mail-pj1-x1044.google.com [IPv6:2607:f8b0:4864:20::1044]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 542C2C061756 for ; Sat, 8 Aug 2020 15:35:05 -0700 (PDT) Received: by mail-pj1-x1044.google.com with SMTP id mt12so2740277pjb.4 for ; Sat, 08 Aug 2020 15:35:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=I/495s6jK4+K+lb6gJ13kJw9U3KMzAEyRbv/wQPm9f8=; b=H3PLCcIdqUB3EIjsg8we5jSGI9NkkuDvWgva4xebovhozPZytq9rBepnyTmSuYCkKO 8E7+pKxRjIoIvtunYP1O+4A+yPxtXwNYXUi1ToAzG8O0kgjOpUP5WdbULMZ0zpx2bPmh qzlcpfMbk2iDSkMqBQNDNL83I3ZOB6RajjCDS6khFj4cYF89Cmi6bxq+EpDduudOc16s OEYAVV2uA2Hmz6WgWKCSSa6bJazvH9z06VGgg7RbEd7l0VQYngs4gFnMo8rHJLCCXHwG X9SecNqMrx3wv/M4bGKVLlEgbhdYLmHSAiU1WrHFx96fo/BKuX4uGtYOJRtYUoxGORvv 5jEQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=I/495s6jK4+K+lb6gJ13kJw9U3KMzAEyRbv/wQPm9f8=; b=Lb1DJmkfJ9YaOXZTBQ6W45UPxRwWPQv1Pro22hnOgTyhNa6IlEoqNvMKl0dd3FKaRq YiO+1RM6oGPlCRYzxpa3QBU+Sgu2VTgXC+S/wF1/B0eK32Rlk7Vm6fgUw9HGIMRuuZ7v vOCWCYf5YQFY7hWmWEY2eq1BuACuf44St1kbkG4lB3B00cwwckp2k7xj8paQbMK6Mia+ MMi2Um+hMkh4/QoHc9sdOGxgy7dW3PSPdfrlrZZTaFnVe/yQzrZ1NMlljaerC8FtsMG4 8NEE17JIkQ4Zud2s/4RHBdOU338RJx+5DMoDl64x+zWbrPqN3c/67R3KSlw62JL6/+hw A+lA== X-Gm-Message-State: AOAM531MYmQgpAFXCo1rdjwTxnwWjZAHo5b7SuPLiKJYI0+oOi8dHfc0 a93sccE9qIiosa4ff8aAIWw= X-Received: by 2002:a17:90a:1a42:: with SMTP id 2mr18451210pjl.16.1596926104709; Sat, 08 Aug 2020 15:35:04 -0700 (PDT) Received: from localhost (g223.115-65-55.ppp.wakwak.ne.jp. [115.65.55.223]) by smtp.gmail.com with ESMTPSA id y196sm18148356pfc.202.2020.08.08.15.35.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 08 Aug 2020 15:35:03 -0700 (PDT) Date: Sun, 9 Aug 2020 07:35:01 +0900 From: Stafford Horne To: Luc Van Oostenryck Cc: LKML , Jonas Bonn , Stefan Kristiansson , openrisc@lists.librecores.org Subject: Re: [PATCH v2 6/6] openrisc: uaccess: Add user address space check to access_ok Message-ID: <20200808223501.GP80756@lianli.shorne-pla.net> References: <20200805210725.310301-1-shorne@gmail.com> <20200805210725.310301-7-shorne@gmail.com> <20200806190229.b7jbmkavu7qqzegy@ltop.local> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200806190229.b7jbmkavu7qqzegy@ltop.local> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Aug 06, 2020 at 09:02:29PM +0200, Luc Van Oostenryck wrote: > On Thu, Aug 06, 2020 at 06:07:25AM +0900, Stafford Horne wrote: > > Now that __user annotations are fixed for openrisc uaccess api's we can > > add checking to the access_ok macro. This patch adds the __chk_user_ptr > > check, on normal builds the added check is a nop. > > > > Signed-off-by: Stafford Horne > > --- > > arch/openrisc/include/asm/uaccess.h | 3 ++- > > 1 file changed, 2 insertions(+), 1 deletion(-) > > > > diff --git a/arch/openrisc/include/asm/uaccess.h b/arch/openrisc/include/asm/uaccess.h > > index 85a55359b244..53ddc66abb3f 100644 > > --- a/arch/openrisc/include/asm/uaccess.h > > +++ b/arch/openrisc/include/asm/uaccess.h > > @@ -57,7 +57,8 @@ static inline int __range_ok(unsigned long addr, unsigned long size) > > > > #define access_ok(addr, size) \ > > ({ \ > > - __range_ok((unsigned long)(addr), (size)); \ > > + __chk_user_ptr(addr); \ > > + __range_ok((__force unsigned long)(addr), (size)); \ > > }) > > Just for info, __force is not needed when casting a pointer to > unsigned long (or uintptr_t). It's not incorrect to use one > but I think it's to avoid __force as much as possible. Thanks, I didn't realize that. I will fix. -Stafford