From patchwork Thu Aug 1 08:16:18 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 170345 Delivered-To: patch@linaro.org Received: by 2002:a92:512:0:0:0:0:0 with SMTP id q18csp5086636ile; Thu, 1 Aug 2019 01:21:06 -0700 (PDT) X-Google-Smtp-Source: APXvYqyr8c0MkI2xMBiBCamS35L/bu9WAak/UPgPLETEvS76XeanLT4dYhkhHbUM3XTBroarL/TG X-Received: by 2002:a17:902:2b8a:: with SMTP id l10mr124349806plb.283.1564647666496; Thu, 01 Aug 2019 01:21:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564647666; cv=none; d=google.com; s=arc-20160816; b=LqDtr5G5nzB+wNbeioRHr8KJW6JtRcBFeFI31O4Nr1R5E4X9lWn7H0IZlWNwsVtfcK bgsQkqq3oBsdvBjQ9yfpFclNut/QNWc+sIbT4zhTOBCglx6Xhq7xQ2pZzR1btcwk1Z89 MVDCvbr07//3q+Shjvi5eWDLEQKORokh72WW6cX1qkg4OVb+Oa4K3YN/SF0NAEDiPI03 g6YREcudaF4frwMXdtvsDH+79yM5HOrNzFNIKdXOpS2Yp2Bs2ypLZNT0O/YhC5qw6l8X ef6XUWi1eb2jnwj/V9Aa0BeaBEFUXv0qoHLQQb6/drMlw2hQs/aQ7cUh+TXmNifl9XnN 0Ayw== 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=y5vIaM+vVchIZG6+Gh1WcpqO4yKh8TnPpANQdT1zWCg=; b=WuZEZAdGZpdepu7XwrjqY1HwHXziYoMmToTTe6bmvD53s9crg8nfbzoERoBn2/0Vgd pTx7HfKaZfK/QGdMkZL0NSRMjpoqVZZmD0PDXl05igIc83WAwKX6VCGLQMSiNF3w0zjF 8iRMD6WXiE+l7YpQ7n2xGmeCr3jBQllHMtQlxm6cI/xg51m5YW+Nu3Zo0DPCWEWKiGi3 E7MoNi5uoxOyH82dnksUMHwld10FvOEdmWOSG5kZ/ipIFQjgZJUM2p8fBvMuQwwUZMQP JdseiwiOe9scKeGc6+nGLuoNwc6GK3ujsHjxUJhbXsCaZI1ACNluvWu4NEx4OiJxlUG5 pmNQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=NpnvqtjK; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y21si30526126plp.332.2019.08.01.01.21.06; Thu, 01 Aug 2019 01:21:06 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=NpnvqtjK; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727171AbfHAIVF (ORCPT + 14 others); Thu, 1 Aug 2019 04:21:05 -0400 Received: from mail-pl1-f193.google.com ([209.85.214.193]:42930 "EHLO mail-pl1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731116AbfHAIVE (ORCPT ); Thu, 1 Aug 2019 04:21:04 -0400 Received: by mail-pl1-f193.google.com with SMTP id ay6so31903212plb.9 for ; Thu, 01 Aug 2019 01:21:04 -0700 (PDT) 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 :mime-version:content-transfer-encoding; bh=y5vIaM+vVchIZG6+Gh1WcpqO4yKh8TnPpANQdT1zWCg=; b=NpnvqtjK49HYBgbUiDGgi6xSJ03C6UtcvxRKF5TE0WHirWiIbnALLSZJY52O1CHNZK FenUuArNYNx5FObhoUmbuVHY9+TQhtb77eXZaTPvmLlDTDZeLOiYBkEwSAjK+oLv7sAo 9RDwz+ktZskTt9WhFVwRYsPJ4+JwH+AmkH6fTrFVQBH0oJfx9Wtx8PhUuFsqweiS5dqt 8x7HU+jAlADxbEjOdCPkC1PWXYO1E7Nee4cq2F4h1WH4JTuScbkwZbvCbxMXmRSomJwA heyhgkDjkxTvakUp5J31B8/EXj5YPr2HQVcwbMfT9pU3CxpqNiRy+OWbMVRomKzEExiO PIyA== 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=y5vIaM+vVchIZG6+Gh1WcpqO4yKh8TnPpANQdT1zWCg=; b=lLwY9HV05G2xOqRk/uBQkisV/EcP+76kcHRmxiqi43DJYOiQNOkGnn3M1MM2N9pD1S fMQ8ZLi75rJ03apO/Hd7Ni/Vz9cLMY+P0qzdQxGIgvZq7xa5SUXANS/lTzL1MaFyZBEK kAEqd8mORWOZzCCYpdOGdGpnejIr5c2oi7XXcTu22aQzsnBCJC3RRM9fuB+s7McvUpJb WnpAqFntXd+l6CP8R+ZxiQLYT72tkrSwq2OTHOaGUBnbKwZDLkmsViEq8lMtN+MWl2l8 ln2sCtyrOmxtCnB0zsAIubwhPrngODKg8guWAwKEZv2cTzjlnyaQxXfUsabocY2GhVSz +8iQ== X-Gm-Message-State: APjAAAVm06A8xmAxqfVk11NGXR9KqxMVjA/d2EGtU4oIWulj/vLLtZBA sm5biL2IwXuvpWAePF1hZKr1O7xT28U= X-Received: by 2002:a17:902:6b86:: with SMTP id p6mr127587221plk.14.1564647663394; Thu, 01 Aug 2019 01:21:03 -0700 (PDT) Received: from localhost ([122.172.28.117]) by smtp.gmail.com with ESMTPSA id z4sm111700635pfg.166.2019.08.01.01.21.02 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 01 Aug 2019 01:21:02 -0700 (PDT) From: Viresh Kumar To: stable@vger.kernel.org Cc: Viresh Kumar , Julien Thierry , linux-arm-kernel@lists.infradead.org, Catalin Marinas , Marc Zyngier , Mark Rutland , Will Deacon , Russell King , Vincent Guittot , mark.brown@arm.com, guohanjun@huawei.com Subject: [PATCH ARM32 v4.4 V2 34/47] ARM: 8795/1: spectre-v1.1: use put_user() for __put_user() Date: Thu, 1 Aug 2019 13:46:18 +0530 Message-Id: <89ae15bfdcc72b42ebacde01603f09fd5cd880b7.1564646727.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 2.21.0.rc0.269.g1a574e7a288b In-Reply-To: References: MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.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: Viresh Kumar --- arch/arm/include/asm/uaccess.h | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) -- 2.21.0.rc0.269.g1a574e7a288b diff --git a/arch/arm/include/asm/uaccess.h b/arch/arm/include/asm/uaccess.h index 94b1bf53b820..7f96a942d9a0 100644 --- a/arch/arm/include/asm/uaccess.h +++ b/arch/arm/include/asm/uaccess.h @@ -407,6 +407,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; \ @@ -414,12 +422,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; \ @@ -499,6 +501,7 @@ do { \ : "r" (x), "i" (-EFAULT) \ : "cc") +#endif /* !CONFIG_CPU_SPECTRE */ #ifdef CONFIG_MMU extern unsigned long __must_check