From patchwork Wed Feb 13 21:32:13 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Long X-Patchwork-Id: 158259 Delivered-To: patches@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp560889jaa; Wed, 13 Feb 2019 13:32:35 -0800 (PST) X-Received: by 2002:ac8:2190:: with SMTP id 16mr203001qty.365.1550093555737; Wed, 13 Feb 2019 13:32:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550093555; cv=none; d=google.com; s=arc-20160816; b=GrWdg0zHZNZRiy9C0IHptre9BgDX1ORD/Wa4d2rDjcVqbSVMmJj0fmiM4NZJOJa7+c ZaXLKIUeZ72R6NBe4YmaLhyq/qgKWo8TnYmskb9RRtSfGLaTbnhyZqU8OW7glfgTYU1r Nj4Yuy5nxxHLFvy2u6uC8U9E93GsrLHguLlSqJobaYWzsmtcmtBl6Jz5qDnmEzSHWxVH 4EjKyTYEl8EYaItOwoLrItsWAxdQt3MUex1FF6y+FkhEgOzGSQX4RIKc9nAzqmwfTx8t JCQPP1c645ZMCscIS6xySqesywkbWpIqaNW4MTO1FJFGolbr0kB9fnhx3xTDxy8Dfn1b 2ojQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=Y9bjfpnIjOT82L5WN75hPg2gnG6Z+LcsZzLHUB1TZws=; b=OtjP+QT3TM1XsYJ9Ar9LpyG7FJiSZRlLfq0MA1b24cmtNr2P4Frw5cwnRpyGOI71hG uK8T5omVmCIP//LB8oqJO064fhHIeP9CqibHEzi5HjcJi0fJ9j/tzIGej/x4NrmTCNd0 iP72/G0JVmx5QvVUCc4R2Jw5IqKgCVHoyb3y1Gmj271MwEC596R4bLDyS04NKplBfPjK FAvf/MrzKWCYFyWiOjj63apBGwLFhxNUwnUf6mcSsf02yp7LxT6zSKGHBFtHCIx6g+u7 er28BEcG53W7ryckrzvaCRT4KyoMQikn57cl+DCDd9eC0uoO3LVRNwiWD55o6rMflb+8 V4yw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=MzOyVW4D; spf=pass (google.com: domain of dave.long@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=dave.long@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id y2sor584094qtb.0.2019.02.13.13.32.35 for (Google Transport Security); Wed, 13 Feb 2019 13:32:35 -0800 (PST) Received-SPF: pass (google.com: domain of dave.long@linaro.org designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=MzOyVW4D; spf=pass (google.com: domain of dave.long@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=dave.long@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=Y9bjfpnIjOT82L5WN75hPg2gnG6Z+LcsZzLHUB1TZws=; b=MzOyVW4Ds6vkL8Y/zO0X8jD1DAb5GY6O3kQ39qkczIEmemCNKPrJYCWKTEGPZcvhLj oqbNB/eHgyKCShxs0F39T7zRkhQUgZxwb0LwiEMFgU2wfrAD2/wNGhxx2cF6mx66JJVi BGZyh6/XkwdlnKx2Shg/ISzfQDAZB840GPOPkg6ou95OAAVx++PnwWh49qx30F/3sAdQ 9XqmvLIfMyZdmGcvVyM69WC+yo8aW+kskfuIZN7fNu+YzJ8ZmBI/7AsgP6b86ThTx7eu BpQZhNw5bNPUY8CKrwUySJ0duKB4X5YhLLvU9q/+eKJ7r2GqY2ZFIh1YfvKQoVPJ/OAK hkBA== 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; bh=Y9bjfpnIjOT82L5WN75hPg2gnG6Z+LcsZzLHUB1TZws=; b=P9TX1eZQ4V6ZguWsSTF57QAYRNOr9wqvZgtyq0sjEvqYq50LktcuulpNgUK+/rp5Xv etez+pyO+HUOskf8TJKGp7+RAxuzH2r/sz3WMvvkVeHbPgGrbTVBBW08r3eNuIj/giFS 5vfAMIVwMFtVkqZU5uL5uMW4fFgWyMb90YS7SjiJ4gjRmHVVk3rcmddwcShYuj+wgLAA hCsYLXdyZk7DHUR9/Nx8ZTgzvAKthKkUlqEmmfrPibqq8PdHkK8Qrsk9WAFG2TR+8Zzm 1nTNGp8iKJrMiVORSbrai9yay0R3ppFwxLmnendHhYztv4K6JdXexh9ffyEdvUqUFcEg Oj7g== X-Gm-Message-State: AHQUAubppGafLcbSpKEebi8BymS1DtGFs4fLO4pftTc9qP9fr5bhIXqI 7b9Hj37z+zpLqJoZepwOR4NvAx0t X-Google-Smtp-Source: AHgI3IZpLedZO/Zy4OyyvE6dqteNaaVtgsW0nEdTvXN5uBvmTqhDJUVV0Djjr6W1HTQST2PeTfrwBg== X-Received: by 2002:ac8:33d7:: with SMTP id d23mr206276qtb.243.1550093555522; Wed, 13 Feb 2019 13:32:35 -0800 (PST) Return-Path: Received: from localhost.localdomain (pool-72-71-243-63.cncdnh.fast00.myfairpoint.net. [72.71.243.63]) by smtp.googlemail.com with ESMTPSA id 8sm382675qtr.7.2019.02.13.13.32.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 13 Feb 2019 13:32:34 -0800 (PST) From: David Long To: stable@vger.kernel.org, Russell King - ARM Linux , Florian Fainelli , Julien Thierry , Tony Lindgren , Marc Zyngier , Greg KH , Mark Rutland Cc: Will Deacon , Mark Brown , linux-kernel@vger.kernel.org Subject: [PATCH 4.19 07/17] ARM: 8795/1: spectre-v1.1: use put_user() for __put_user() Date: Wed, 13 Feb 2019 16:32:13 -0500 Message-Id: <20190213213223.916-8-dave.long@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190213213223.916-1-dave.long@linaro.org> References: <20190213213223.916-1-dave.long@linaro.org> From: Julien Thierry Commit e3aa6243434fd9a82e84bb79ab1abd14f2d9a5a7 upstream. When Spectre mitigation is required, __put_user() needs to include check_uaccess. This is already the case for put_user(), so just make __put_user() an alias of put_user(). Signed-off-by: Julien Thierry Signed-off-by: Russell King Signed-off-by: David A. Long --- arch/arm/include/asm/uaccess.h | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) -- 2.17.1 diff --git a/arch/arm/include/asm/uaccess.h b/arch/arm/include/asm/uaccess.h index d65ef85fc617..1191e7da8fab 100644 --- a/arch/arm/include/asm/uaccess.h +++ b/arch/arm/include/asm/uaccess.h @@ -370,6 +370,14 @@ do { \ __pu_err; \ }) +#ifdef CONFIG_CPU_SPECTRE +/* + * When mitigating Spectre variant 1.1, all accessors need to include + * verification of the address space. + */ +#define __put_user(x, ptr) put_user(x, ptr) + +#else #define __put_user(x, ptr) \ ({ \ long __pu_err = 0; \ @@ -377,12 +385,6 @@ do { \ __pu_err; \ }) -#define __put_user_error(x, ptr, err) \ -({ \ - __put_user_switch((x), (ptr), (err), __put_user_nocheck); \ - (void) 0; \ -}) - #define __put_user_nocheck(x, __pu_ptr, __err, __size) \ do { \ unsigned long __pu_addr = (unsigned long)__pu_ptr; \ @@ -462,6 +464,7 @@ do { \ : "r" (x), "i" (-EFAULT) \ : "cc") +#endif /* !CONFIG_CPU_SPECTRE */ #ifdef CONFIG_MMU extern unsigned long __must_check