Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp24947pxa; Mon, 3 Aug 2020 21:28:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzGgSkwZR6CLfG1Kbin/8ZTEIWiEcM0KAvhue1I+pWZfX3QM5v/dkXtcghDHQOMTFjDPvsT X-Received: by 2002:a17:906:840c:: with SMTP id n12mr18860073ejx.246.1596515328227; Mon, 03 Aug 2020 21:28:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1596515328; cv=none; d=google.com; s=arc-20160816; b=qLBSf9VTMrek19qEsW9lgMuWlcicO8jv8fBHLail/WY+30sPTyKkmXfGuEVXxdhRae jiQ4B57BCg4VDTKEc+0Gfmj52auuCAEyMPKt7qk15bcL6R/bofWA6G6CmELI+HWZsUp1 9iQO7nvnSm6hN939hsWAA2kdSGfXLRvfdUXeKZ88Dc5cTbVo0ONo5FOas68TFjAj6rWD yzk8tYdpVU3tXb/hdYWzjkvI5hK+YnnpYM63kVBt7i2QhvkX2UG7G/czIysjPxneouZC 9UoQjORddqBpSHQSeU+B+o8tXSX5c4T83xkbydO1KyImF9R/iNPVWUXTkmSJWKAl0rQq wT7g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=EcaRclfd0NpwDQkcLxmVNZSW1Z0kqxgpCzRoAu48M1w=; b=PNp6DySNMJVqbUVcIeYIpDinsPWX0ta5ntxMbCxWunI6Q/zd385jyhXJY4eeW19yj5 OQ42Vo7zn25lg6KIM0ij4UAl8c3HLo8Qfo5mlL20ak2tKTf8z4faL6tZDiyNDioa+45Z 5xbNc0O0BXYFGA6qlzVbkrb5/BzTMVKAeFs/kYHfsjbSkLUsSHJ7WP+W7XNAyZhd0Yn9 mNwY0/hOQSUbbXNX4UnIzNGobCcBk81sEUtnrJLNsph8D96t0d4W7ytC61yrxdB9MtEx rlulSDx07lK4yEK1hFG2BIYCI+t3JA4P8oKNmcXL3lhRjl1w0O8rKYetEK7EsfR4mjqV k4GQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Q913rhBu; 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 u16si12381544eje.469.2020.08.03.21.28.25; Mon, 03 Aug 2020 21:28:48 -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=Q913rhBu; 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 S1729733AbgHDEYc (ORCPT + 99 others); Tue, 4 Aug 2020 00:24:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48866 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725999AbgHDEYc (ORCPT ); Tue, 4 Aug 2020 00:24:32 -0400 Received: from mail-pf1-x441.google.com (mail-pf1-x441.google.com [IPv6:2607:f8b0:4864:20::441]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 11230C06174A for ; Mon, 3 Aug 2020 21:24:32 -0700 (PDT) Received: by mail-pf1-x441.google.com with SMTP id z188so11649285pfc.6 for ; Mon, 03 Aug 2020 21:24:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=EcaRclfd0NpwDQkcLxmVNZSW1Z0kqxgpCzRoAu48M1w=; b=Q913rhBuAyO0+o60xPFJW8wXg5ZGqcIWEXeCz7RiId05lFNkXDJ1auQO6qwHL22ddS HYG3qOGO/VlnsSMATSISis4CbCxnYJNbpCvOzH1rH6+1FEmnWPrf7ziw+lN+Ltq9Hj06 Xp78/F6OYdjbecx/AI6LxXrCQAws+A9x91HLi/S9ervmpAoa8EbMmZDYtiFexsmF9/Ke lmJPvQcI6bkFGspcHQsOt/fp3LljJIy7s1cJs5dWrg/bqRzoM9EOXJBgci6Q7QZhJVcT UD/SdZNbTOG9pRZ07Arw3hyGUH1hiRrbH/LjJeQXA7Uk7ifC38OrgCWSrl8JcwiYDqn9 mjnw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=EcaRclfd0NpwDQkcLxmVNZSW1Z0kqxgpCzRoAu48M1w=; b=Kw2eb75z7j7tRT5MqGqtC+gkibyMbzMYYOPtZ3LUD6nuYSUz6QVyOXL4/ghHHFerCP 6m8eBEOq6FzcTGQGSsNaBNMmJQt8h1OSBq3I/ANCP0qRJecxeVKcpB/NOENBNN0geoXX S+yRqmpXmEgy92z+/MhyDlEgGcN+IgIBprDgDBpVv0WfehdGPZoJwpJrf8cmcKsOb1An zRQggEtsCk5YZFurWDHG3cX+jAfQhh/fjDM/dV2XuHSldwSTiA0iqzTsgZEAB04MJds1 2n+0Ax9s9DUUA51KOocYv0Yns7atG8KAnmruD0JuJI8IYMKlYjw0GFySvaiQK3yxonns 2+kQ== X-Gm-Message-State: AOAM530W5Bon1zLj96SxlgVC+zKsigmCengrcYzD3tKrcE+o2QSwRGIs OSDvln3dy5uJQad3DljP15mXpzjW X-Received: by 2002:a63:4861:: with SMTP id x33mr17010551pgk.448.1596515071039; Mon, 03 Aug 2020 21:24:31 -0700 (PDT) Received: from localhost (g223.115-65-55.ppp.wakwak.ne.jp. [115.65.55.223]) by smtp.gmail.com with ESMTPSA id x9sm21164602pff.145.2020.08.03.21.24.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 Aug 2020 21:24:30 -0700 (PDT) From: Stafford Horne To: LKML Cc: Stafford Horne , Jonas Bonn , Stefan Kristiansson , Luc Van Oostenryck , openrisc@lists.librecores.org Subject: [PATCH 6/6] openrisc: uaccess: Add user address space check to access_ok Date: Tue, 4 Aug 2020 13:23:54 +0900 Message-Id: <20200804042354.3930694-7-shorne@gmail.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200804042354.3930694-1-shorne@gmail.com> References: <20200804042354.3930694-1-shorne@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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)); \ }) /* -- 2.26.2