Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp1635174pxa; Thu, 6 Aug 2020 12:06:13 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx7xxfF8zMXGHNNbclYrCGXZtAcspRcR5+a3uHwmpwdCHa4LHJDjgv/4OdA9Sr9Ljg9F4w/ X-Received: by 2002:a17:906:9717:: with SMTP id k23mr5890459ejx.493.1596740773464; Thu, 06 Aug 2020 12:06:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1596740773; cv=none; d=google.com; s=arc-20160816; b=mw149NUdTNJn/Xu4gz3EIhI2VDa5W9QNobrVQvUYvlSA0kCKOZpfN+0bd3WMA6GcZY 2nrs8cpPF6XTrw3HP6KoRY/O3vACZy+sURQDWeBqsNU/lNv9BrEt9aVhM2Jckq26K9OJ 0sInJsULkdnAJcR+3VyUo1rzkFPITCO60xzSspUtWbmoqnYjhpF9UIkz2EMLBB2QIJeC hddqGX0LqCvEfcNf071b1wf/V5KuqYfqXqQ9uy6fzBx2OzCG4OCR2UXdjdo6cgQNn/9h U4/ishsQv+1btZKxv/ASyLEXZZVRLqRO8GmkvUlAh3YCktUJc+9Js/igiSgds4FdHD+e U/Ig== 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=yQz8jNT7jbM1zvtc9MWwIejDFC/8b3Ez/9JWOSG7lno=; b=mpS/mslLXrYid9ABBjkX9LH63Lf3OcljMsIGJ1FM7Q1k2ZAAP6K0RGqGmTJVPrmIf8 F7KHEIC4Es7ICjlnVVkQ3ZUxY97TE7GclaBMpyrzKuTZ1H+/GLWof+h84b2VpsbGaTae JUMEs6QI2U3hjwNnr8QjqM6eWxHX4OKi5snrqzviGknm0a5Ty3/Ud55vuYDSDG6LOUch sWA7U9OtXG1ORBkVjyr9lr+PO6+BWGPnAZtORQhB4V3wrtYPbTrVwwMj/JvwFgifk4go 3tlDJdlABXafZlaYpqrrzXJRmbB7gyOExhJLV4LnzvhL32kDGSz4dK+LgMKwMZ7m1eI0 i8zg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=QThCNrkJ; 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 r29si3663733edx.264.2020.08.06.12.05.50; Thu, 06 Aug 2020 12:06:13 -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=QThCNrkJ; 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 S1729806AbgHFTCe (ORCPT + 99 others); Thu, 6 Aug 2020 15:02:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35676 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727884AbgHFTCc (ORCPT ); Thu, 6 Aug 2020 15:02:32 -0400 Received: from mail-ed1-x544.google.com (mail-ed1-x544.google.com [IPv6:2a00:1450:4864:20::544]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8634CC061574 for ; Thu, 6 Aug 2020 12:02:32 -0700 (PDT) Received: by mail-ed1-x544.google.com with SMTP id di22so28748151edb.12 for ; Thu, 06 Aug 2020 12:02:32 -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=yQz8jNT7jbM1zvtc9MWwIejDFC/8b3Ez/9JWOSG7lno=; b=QThCNrkJPHr7s8iGlc4uJowP3s2qbSNAZJpUW7ELidrJUK4mRke6zh9BN727pTaUcX s0Zdlw7Yaz2UO4I4m0bPU7i0qJgki0oxGA9nHGGa22RnjGxdNU/ZrqiH1bjNEtU3n0T7 QhloKmQ7m8OCCX86CWv9iFnezJNfb5LboVOUqU1SoQOpM4AATGJUIwltweLLiPN/Wtqc KkE97A0v/Ob2s+fW8cVjdA1WCYb3a1f/aXSSns2Q3rWqgu1JGZm8ZFM910hEHPuSupIQ fDDi8TRxAAbWx9P0lLKwFYnP0XEPve49vOaD80w93nLM17VQ5XiNOGJq6SWp+38D1SO+ +a0w== 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=yQz8jNT7jbM1zvtc9MWwIejDFC/8b3Ez/9JWOSG7lno=; b=hlTlYBELYSooFk69z34642OEXBxFD2dX7fuWqJAGVk06VASpaoDUxJ92k/ju+LTC89 0qui+cdL5yfq7picE3qXDgGDO856q8PWxrrRAMXivm4r8/q2EkqaxVymxrE+yJDnfCqL 8fIbU0PuLyPSjhDulWm8Nr2zpIX49K0bdE786ypa4WJlMvpiF7MygJbWGaY9Ngq+vTvl r4PfYL4rkdZrcqJS9eVFsL2moNzl+2JhGUumdN6WoJm/ZCy98vmytfTiJ7Ny39h2t/7V z2X1dAlYdZMK6Ay40lL/P3txqJF5J7mqhEHZEqQAU7qswkyvxY78PvpftYfwrauEMokx uCmg== X-Gm-Message-State: AOAM532dT7oNSR215X109NOd1/+AvIhcU+SQNzAdjkuIAByD/DUYwx16 nRz5hZ2d7TPg8v5XV6GbU1o= X-Received: by 2002:aa7:db10:: with SMTP id t16mr5281903eds.196.1596740551235; Thu, 06 Aug 2020 12:02:31 -0700 (PDT) Received: from ltop.local ([2a02:a03f:a7fb:e200:d567:ec52:e0a5:f485]) by smtp.gmail.com with ESMTPSA id w19sm4262655ejv.92.2020.08.06.12.02.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Aug 2020 12:02:30 -0700 (PDT) Date: Thu, 6 Aug 2020 21:02:29 +0200 From: Luc Van Oostenryck To: Stafford Horne 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: <20200806190229.b7jbmkavu7qqzegy@ltop.local> References: <20200805210725.310301-1-shorne@gmail.com> <20200805210725.310301-7-shorne@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200805210725.310301-7-shorne@gmail.com> 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 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. -- Luc