From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.1 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id EE732C5DF60 for ; Fri, 8 Nov 2019 12:37:18 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C5AB9222CE for ; Fri, 8 Nov 2019 12:37:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1573216638; bh=h4vs9NF4uH90oYj9MkiodEwh4RctUT/XuHp5FZsThUw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=dawgUMxIMejWwoJvxVwjtOVANjgdRi9J0x0UYrG41BpCqc+QpgQ/sp4N4K3sOdFX6 wPjbO8hduuNoSyBRKLqBjG1M34/LH8pvroAUjvsUd9wv3rZvon8Vz32fXTIsL3iFqo zcjiH6ICV3Q6yN/wt3BAJWs9zzu/wpNZrIxR2Kzc= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727044AbfKHMhS (ORCPT ); Fri, 8 Nov 2019 07:37:18 -0500 Received: from mail.kernel.org ([198.145.29.99]:44932 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726372AbfKHMhS (ORCPT ); Fri, 8 Nov 2019 07:37:18 -0500 Received: from localhost.localdomain (lfbn-mar-1-550-151.w90-118.abo.wanadoo.fr [90.118.131.151]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 476122245C; Fri, 8 Nov 2019 12:37:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1573216637; bh=h4vs9NF4uH90oYj9MkiodEwh4RctUT/XuHp5FZsThUw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=E3hfSTOOl3lE5SGca8ZKPBik8uzpHhU8N8hvFUoy+PkBAVX+Ai44Js5LVB17yTwlQ cVgDi+TAKyHXZw65tzGB2o0CyMSQwOWHdVkRlhctDXkQe36xOcu77sgx6vUVuxSmWb tunVkhB2hkzbKwj4OPMhg4cNor5c/7MptMUhr6JM= From: Ard Biesheuvel To: stable@vger.kernel.org Cc: linus.walleij@linaro.org, rmk+kernel@armlinux.org.uk, Julien Thierry , Ard Biesheuvel Subject: [PATCH for-stable-4.4 41/50] ARM: 8795/1: spectre-v1.1: use put_user() for __put_user() Date: Fri, 8 Nov 2019 13:35:45 +0100 Message-Id: <20191108123554.29004-42-ardb@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191108123554.29004-1-ardb@kernel.org> References: <20191108123554.29004-1-ardb@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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: David A. Long Reviewed-by: Julien Thierry Signed-off-by: Sasha Levin Signed-off-by: Ard Biesheuvel --- 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 0404dd101331..98bbf89763a6 100644 --- a/arch/arm/include/asm/uaccess.h +++ b/arch/arm/include/asm/uaccess.h @@ -408,6 +408,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; \ @@ -415,12 +423,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; \ @@ -500,6 +502,7 @@ do { \ : "r" (x), "i" (-EFAULT) \ : "cc") +#endif /* !CONFIG_CPU_SPECTRE */ #ifdef CONFIG_MMU extern unsigned long __must_check -- 2.20.1