From patchwork Thu Feb 14 14:49:20 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Long X-Patchwork-Id: 158400 Delivered-To: patches@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp1462212jaa; Thu, 14 Feb 2019 06:49:41 -0800 (PST) X-Received: by 2002:ac8:2f4e:: with SMTP id k14mr3314532qta.76.1550155781321; Thu, 14 Feb 2019 06:49:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550155781; cv=none; d=google.com; s=arc-20160816; b=0dBR9Dvb5vFs2XLqPDYDIXLe2YVmAMthyK/E5tS4SuxkFH1vKVlc3wvd52w8sulmVk z1pvwt4USU2xbbSMihxZqurc+/mjLNUKPNDx4y753aGIUREKV5VdQKxBsjMUhEov8jjg ftZWtUifZCqC2XhrX1y2DTBYCqXMawoo1uyms0O1aDU3dBSRQra4TWDMuJCfzenWLIER 2zb7yRUdKrLoZ4HNIpTyXLkGgJQSln83yfjWcV8Oi5D2dMHbMVrC+DgcBFlpM+3sGcEi uABfO+kl8m6puQzAPboeVthbKim54myMG/X438CrupbHYd1MSD9aiLLlB5d1gBR77pWo w+Ew== 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=3EUxbJ4Gs2ebNHsOGp92F1GifsPVltaoVmIWi4xEEBo=; b=DzU30+b6Riay/PXz3rWPMdkoX43OQpeoL7XrZf/Lgwftp+LsLSFpTyfg9iIOi2gEDI vH7DozRYgGG05bJOWh5sUKKkT80YjQGimZ4WN3TN9kO8b94P8Nk+rIdGpXwEgOo7os2f chp9nHJWelR0M6Q/hxEPK3uPvqIqb9R/Og808plwGE10wS7mXv3rs16Lx+bKITrsR96S x7qeyS/BLTEzpwVfKKA9efzkLJZ0KSuoBj/CDUAX6/izABa0i2hXJgmXrL/UHD+jsG4N KVktd2NTreO9ww8IAq6Fh/zEq242oxaHfVfqU0UGi1UaWrzY3j4fFyl6mgOWI73tqk2c /yHg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Ioo7iJvX; 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 g9sor2954549qvm.22.2019.02.14.06.49.41 for (Google Transport Security); Thu, 14 Feb 2019 06:49:41 -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=Ioo7iJvX; 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=3EUxbJ4Gs2ebNHsOGp92F1GifsPVltaoVmIWi4xEEBo=; b=Ioo7iJvX7d6MQbbygi6AqmTR717u8Nn9q4l6Lz9RRC1h2d3f5BI8HB987KC8ic+sht SQoxNNsUvDcnct0MF5I7HmqlYkNS2SnlTLS6JYqlJzKgIMXBTIjxD/ZV1tuqzpb8uBNH PT+t9K7fRpu0muIzuxJZ8aQn96cPNTdDS6TQkBjJDluavck2nBuD8bXJAUe6O24/tHBv IqnIxPiZ3ZUbgvPrcsMySFm4fRYjuYQ18ImpPHE0oknCl1zf75nzAP2rV/RLyoq3jQsY t32Aj633ROdtEItbocW7xgTqUgYH/Skv+qTXrlsGaJwxZDOZWqyXOnVmgqKtIjJhzjRX PAlA== 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=3EUxbJ4Gs2ebNHsOGp92F1GifsPVltaoVmIWi4xEEBo=; b=o9puDYzU6G1DVUcq9JoeHnNFyupYlBvBuIBJ0ZAs5OfJVpU0yUA3osrFPprI26P/V8 yQPZ36kWoZaGFXSgc6ODqU0k9R+E4OZlKQvRsgtqq09kisRmnYG9tpi+sH49PJSTTQuK OcTeKcSJL7H02tIK5EhDt51tEJDTMjEU3h0CuNBbpWd7PLVDrBJsp6kiQfBM7oU0M5BW 9ebRjFiaJaH8L4KShueP0o8bpSUheNtVAx2aVYtvp1tEPmhuQXR2K/y9ZXiUOZCTvsc1 G6dM9GI8Db8xWQLUBlomQ9BEALlTF8KK/Dqvbk0MS3QBsj+zxakEKYbVQW9Qeo7RphJG hUgA== X-Gm-Message-State: AHQUAuY6yU48RkfkpI1wgs4kR2tKXqPm9K6EmJ4JXZ103PUSjHbPKiLU SH+HtT+7XLgkIbti4HcmrEXG8cSa X-Google-Smtp-Source: AHgI3IZsomSLVmJUtA5Ud1tLgJJgLsgoW/v5KOp+5LVD6Kt1FqCgcuILjIUVEQBX6zyvIgGiuH5Uqg== X-Received: by 2002:a0c:8816:: with SMTP id 22mr3233956qvl.247.1550155781094; Thu, 14 Feb 2019 06:49:41 -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 k66sm1498919qkc.25.2019.02.14.06.49.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 14 Feb 2019 06:49:40 -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.9 06/16] ARM: 8795/1: spectre-v1.1: use put_user() for __put_user() Date: Thu, 14 Feb 2019 09:49:20 -0500 Message-Id: <20190214144930.27539-7-dave.long@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190214144930.27539-1-dave.long@linaro.org> References: <20190214144930.27539-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 9ae888775743..b61acd62cffb 100644 --- a/arch/arm/include/asm/uaccess.h +++ b/arch/arm/include/asm/uaccess.h @@ -400,6 +400,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; \ @@ -407,12 +415,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; \ @@ -492,6 +494,7 @@ do { \ : "r" (x), "i" (-EFAULT) \ : "cc") +#endif /* !CONFIG_CPU_SPECTRE */ #ifdef CONFIG_MMU extern unsigned long __must_check