From patchwork Mon Sep 10 10:42:39 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Thierry X-Patchwork-Id: 10593909 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 D20986CB for ; Mon, 10 Sep 2018 10:46:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C02B628E3E for ; Mon, 10 Sep 2018 10:46:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B3C2F28E40; Mon, 10 Sep 2018 10:46:32 +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=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE 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 317D328E3E for ; Mon, 10 Sep 2018 10:46:32 +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:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: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:In-Reply-To: References:List-Owner; bh=z4hi/KzMr/Ms7ts4S8ruiYfSI2y422S4huowY7qalaw=; b=tBU GbCR5Js9XLXUfQxofF6cN+UhlgBXxsdd8DLlm3ZVbbgzPjOYvMWefJbPRvLDsZ0iZQOdZUxIE+2HH Q5YH1ms/GM/O4cyPCDJ877IXFamACT2NI/cz09Ys787WgHIZ9EJzdJVPSg0h+UCzMccxOO15VpqLE sOJmplNpCJ8nsfui9a3ff8OJ5RDWkrX+iCtYWryhLXTwW+bXI9CS3COuifOh2U27rJLaALNyMVH8I Y+HUsSJGw3SzPsUkCBG0yV/GUzMPwYKrT1idI6pwRAbwb6m6aKblTMWpwOI7J94NPCuNIPoXrS9bT MWwDBZV4YX+x5tQ1uQwVjM6B0qfsq8Q==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1fzJi1-0005qv-9t; Mon, 10 Sep 2018 10:46:21 +0000 Received: from foss.arm.com ([217.140.101.70]) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1fzJex-0002no-43 for linux-arm-kernel@lists.infradead.org; Mon, 10 Sep 2018 10:43:15 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id C2A0F18A; Mon, 10 Sep 2018 03:43:00 -0700 (PDT) Received: from e112298-lin.Emea.Arm.com (usa-sjc-imap-foss1.foss.arm.com [10.72.51.249]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id AC22E3F575; Mon, 10 Sep 2018 03:42:59 -0700 (PDT) From: Julien Thierry To: linux-arm-kernel@lists.infradead.org, linux@armlinux.org.uk Subject: [PATCH v3 0/9] ARM: spectre-v1.1 mitigations Date: Mon, 10 Sep 2018 11:42:39 +0100 Message-Id: <1536576168-40096-1-git-send-email-julien.thierry@arm.com> X-Mailer: git-send-email 1.9.1 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180910_034311_240517_416AAA92 X-CRM114-Status: GOOD ( 10.79 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: mark.rutland@arm.com, will.deacon@arm.com, Julien Thierry MIME-Version: 1.0 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 Hi, The series provides mitigations for spectre-v1.1. It is mostly mirroring what Russell did [1], but this time for writes to user provided addresses. * Patches 1-5 replace some __put_user_error calls with __copy_to_user, this both reduces the number of time address sanitizing is performed and also the number of time PAN needs to be toggled. * Patches 6-9 ensure user addresses used by __put_user* and __copy_to_user functions are sanitized before being used. Changes since v2[2]: - Ensure padding in vfp_sigframe is properly initialized - Fix incorrect copy of oabi events Changes since v1[3]: - Fixed off-by-one error in uaccess_mask_range_ptr, spotted by Russell - Remove remaining calls to __put_user_error() and get rid of the macro - Reorder the patches to better reflect the spectre-v1 series [1] http://lists.infradead.org/pipermail/linux-arm-kernel/2018-July/589869.html [2] https://www.spinics.net/lists/arm-kernel/msg674995.html [3] https://www.spinics.net/lists/arm-kernel/msg671026.html Cheers, Julien Julien Thierry (9): ARM: signal: copy registers using __copy_to_user() ARM: signal: always use __copy_to_user to save iwmmxt context ARM: vfp: use __copy_to_user() when saving VFP state ARM: oabi-compat: copy oabi events using __copy_to_user() ARM: signal: replace __put_user_error with __put_user ARM: uaccess: Prevent speculative use of the current addr_limit ARM: spectre-v1.1: use put_user() for __put_user() ARM: spectre-v1,v1.1: provide helpers for address sanitization ARM: spectre-v1.1: harden __copy_to_user arch/arm/include/asm/assembler.h | 11 ++++++ arch/arm/include/asm/thread_info.h | 4 +- arch/arm/include/asm/uaccess.h | 49 ++++++++++++++++++++--- arch/arm/kernel/signal.c | 80 +++++++++++++++++++++----------------- arch/arm/kernel/sys_oabi-compat.c | 8 +++- arch/arm/lib/copy_from_user.S | 6 +-- arch/arm/lib/copy_to_user.S | 6 ++- arch/arm/lib/uaccess_with_memcpy.c | 3 +- arch/arm/vfp/vfpmodule.c | 20 ++++------ 9 files changed, 122 insertions(+), 65 deletions(-) --- 1.9.1