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: 11070325 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 3902213AC for ; Thu, 1 Aug 2019 08:26:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2D3332839C for ; Thu, 1 Aug 2019 08:26:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 21C25283C3; Thu, 1 Aug 2019 08:26:37 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id B3CA42839C for ; Thu, 1 Aug 2019 08:26:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=RO+RtrXEnMGPyx5BtJIr9CLrSnzK8wqFPC3bSNybMi4=; b=E/jVbhzra0zzMA 63t+ZR/XIgL78ENURZBcR0HLM2hc6AGwfyMT+sUdL6x1cE+Oqhbvu4dRjMu9s0wgCMboIVy3nXJZN Q+7Ck46UkYEn/xPBh3bwth3rESccVORzIQNe8MHoF6b08UMwjT4b3syHSPj97ishjZEaAKI7o0DiM 7pCT/+hcpYBuPqvHz+eTKtuzN6EEEmfcYvC536TnsRyKZOGcQsWbRtB22lyurxlfKNEwO28rhfeaC AieQGgNNK0p8WCHUoqdLFydQatUjVPLnC5J/HyCgVRgX0IKNHmHfVVAhucsyeuUqPvPN5zPxStaml B0v5hPJe2Yvjg47x28FA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1ht6Q0-0002wU-1I; Thu, 01 Aug 2019 08:26:36 +0000 Received: from mail-pl1-x644.google.com ([2607:f8b0:4864:20::644]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1ht6Ke-00038T-3O for linux-arm-kernel@lists.infradead.org; Thu, 01 Aug 2019 08:21:07 +0000 Received: by mail-pl1-x644.google.com with SMTP id m9so31740456pls.8 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=sCCvMR5Le2PdqqIbUAYCjt/WKa1fzLW3UWoYDk+pSXkiO9cLYyb6K0g3lqc7snfKYi YyZT7RKTpZWI/J6eplvsLTj8Za4+BWYeet3ln506v81nuS+dPwsUz5WQFbTuhQDRMCVk ECMuuYzjgKWQVZgP5fSsVFtJzW0U2mvb997af2RrIjz/UzQqAibl51FYT/ocmBCQdu0y pxCW6t7dw5M3Jy4Sy33rFs/IhmBtFVoAWnJa73nwxhBz0XEmqaTWGj9D924EkWqDduXS QKU3jDP+g55isozpqupNqvzzYPyA1g8Z49TqdbTXnWX2aVIDQEbXv1ZIis11yYIxUjaR iegQ== X-Gm-Message-State: APjAAAUUpyoycJljFPc1MjLPd931hoFIA31uednlfvg3dUNJZ61Kaf4P WTgfES9AEBwSXYsVV4voJVemYg== X-Google-Smtp-Source: APXvYqxHzo8Gha+mkvmGOss5j3RTk3imIHXq1nsnN4IBoKCBHaJe829TSCm3FiSqE9ZmAng+hLC2qw== 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 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190801_012104_223168_B11C21FB X-CRM114-Status: GOOD ( 10.55 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Rutland , Julien Thierry , Marc Zyngier , Viresh Kumar , guohanjun@huawei.com, Will Deacon , mark.brown@arm.com, Catalin Marinas , Russell King , linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP 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(-) 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