From patchwork Thu Feb 14 02:10:12 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Long X-Patchwork-Id: 158280 Delivered-To: patches@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp793764jaa; Wed, 13 Feb 2019 18:10:34 -0800 (PST) X-Received: by 2002:a0c:8876:: with SMTP id 51mr1035919qvm.38.1550110234640; Wed, 13 Feb 2019 18:10:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550110234; cv=none; d=google.com; s=arc-20160816; b=G2TDDWqkwR5dee/O/6aAEfA5x3aMPs09vg4W/9N+kL98pMv31KUlOVWwWUMbQ/VmVL I3imCIVK4D+eiYVmTSe8w2xyvHAL7XOjZHvhkyeFePWvpPuWnehYA3vIT9qL4RqFuRbr rcoFWx88f6KUtWXew7MALaH/K0D29eQq4ZBXFIYQDiHwBT0ECy3vbg/Dorfe7JcZU4Z/ 4pFLAcS0ldsX8T0bsfdgFH2ThJX5RmOjPpsinIwKU5HwNPHE8qbcZNjGT/1nd/AOPmhs tf3BWtT3LR0iUYwURet+voSZebElRYgPhJTSiaiGYYVBiEEud5xiisPzkp7Zms38noDF vbXw== 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=GrDWcqvz4w1IZM4bLnbt43ZL+fuuyvY4dihBlBpjGL0=; b=PzzX6JXa8O4+14fyeWIVZlJwBe97yhr8jDMhzUiZI4JS7jf4xnLO61sUByxyooxQoA AYAoS+AKwiEfKWjd5cQ7jb/kh9E9ses0dRHHIsnKLDGZJOyFmVBlYIR4D2zlw49y4B5E IlhhkkmoJmpY1peRq+EqwxVuw11MDc/XIiW+uDBUJ1S4mdMIHg/mASAf4ysMDfZEHrb5 ptAYEf+eUSg28PVe/o7ZB2ByDapx5eCO5FmaZKZ851/ru91u/KaSMQvU9ccLGdjlnwjQ Qy/N2tXv6FJnqTl/G6QjRHHD+riUFqiy6liHrtZloT24dHh8RsQXZ7C5YxImmXRyW8pS FNpA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=VzVvpheq; 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 j190sor662351qke.8.2019.02.13.18.10.34 for (Google Transport Security); Wed, 13 Feb 2019 18:10:34 -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=VzVvpheq; 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=GrDWcqvz4w1IZM4bLnbt43ZL+fuuyvY4dihBlBpjGL0=; b=VzVvpheqp9hL5aBvqV+UN/IEz2gVnF1Cd2GNJPqgtpJxcEv0o4pOTs70+aKuKSm1tU 4yuf6fy5j/ngR5niiCDuPZ1urSER5nY8Vu2VyLILOUjXsgbY6uP1q5Sfl2VmFELP1ZhP Ivu61ESd9zhK+pwXou8EBzthzF3fUsbcyyrv9obV29tsQhmk9N4xXNCnunAWNLutaHWA xlR6KTYV/46+gyXMLMErG2nHz841J5HP6jfeLuncyZ4cIWRlkjEpnPP4U7hMjnLqbSeE S3tmG2ohyBEE3oLDehlIhmtR0UcIVft2PQohanK3NDZkTuIcrVUuTn0eD+B/fwtJ8Jp/ WjqQ== 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=GrDWcqvz4w1IZM4bLnbt43ZL+fuuyvY4dihBlBpjGL0=; b=U/ZEk1hu5bV3DTWjgZkuoghOSv6NrqCeFWZ6X5NzLcqVRVwuPeGhUeMXFtTDA8cgA5 UOGzyhysEpuSNY+MEa+rMIydsYa0CvwxXg7MrEA8c/eC64BB+CgAHMwOxEzz8op03ILe STHqksagLZzkirngpT1BhFar/Vh809B7IGADvggqnwTiYlHHGDSSp7QTdr9hONhfXjL8 s9It1yOgfjZQYgJDpSWRxnyx1gAIRU3FwNdSFgMzllHDATBxG65LuYGPRt9wsLeYRW+q qKxwWG0Dung0y7RMaygDxWEstDivZiD0qJrT5/UXDdIxtprOPWCMtgQz8fk6/IEvs8JC RWkw== X-Gm-Message-State: AHQUAuZLaHA0x4fnwl/Q2jDwVAo7/KuJno1OqE0XX+nIYZaBeyoLqufX UKfUByjE+YXQeFk+uTfdgHwWYEmj X-Google-Smtp-Source: AHgI3IaYYyWqe9n1hfxRFdlH3JFi+4Eec1KQI0gP7QHpfay6mpCKQirj30l/dFG8TeXKP9DcSIgg5g== X-Received: by 2002:a37:628a:: with SMTP id w132mr1008754qkb.60.1550110234410; Wed, 13 Feb 2019 18:10:34 -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 d63sm1091575qka.22.2019.02.13.18.10.33 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 13 Feb 2019 18:10:33 -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.14 V2 07/17] ARM: 8795/1: spectre-v1.1: use put_user() for __put_user() Date: Wed, 13 Feb 2019 21:10:12 -0500 Message-Id: <20190214021022.5313-8-dave.long@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190214021022.5313-1-dave.long@linaro.org> References: <20190214021022.5313-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 7d19584f5c39..cf50b030c62c 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