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=-3.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_ADSP_CUSTOM_MED,DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no 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 AC974C433E0 for ; Thu, 4 Mar 2021 23:25:19 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 3023F64F79 for ; Thu, 4 Mar 2021 23:25:19 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3023F64F79 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:Cc:To:Subject:Message-ID:Date:From:In-Reply-To: References:MIME-Version:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=PeTrAHtl8ccTlT2D2PIYTxqCuuhLmaO0H2NUjHjjFgc=; b=dqA47j4hHziUNbyLxg3v+dv0j NowZ/EEIyVFDY/EPLJ/J0Q1qf+4DGuGW3n6E0aZiPupEVs/yVuoisM6gr432KbWq4x9C+fsMPxrq2 b/uWpNJ2IBCXPCjdEBFTVPIo/QKUtrVNmWkhASHI7cJXEj7K7rfPtE6njN9wX4Fx0H6Ti0dxFe1Rz fVtT8WKxNghBG8d8o/t5N7SRfxXOcUjzLgS8uE4RRBn7NzMNNPx9z8kdC02aLLiEO3MlTUJSgrUV6 FLRCm/3CYOCR7GBAQf36SafOVI3R7dxWcEDiZ/vR34ixJHDytHp+I2ZcRvaopAu8ZSwPG1AZyBnch 8JSQ4i74w==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lHxJH-00Ahjy-Dt; Thu, 04 Mar 2021 23:23:12 +0000 Received: from mail-oi1-x22b.google.com ([2607:f8b0:4864:20::22b]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lHxJC-00AhiM-Gu for linux-arm-kernel@lists.infradead.org; Thu, 04 Mar 2021 23:23:08 +0000 Received: by mail-oi1-x22b.google.com with SMTP id l64so366418oig.9 for ; Thu, 04 Mar 2021 15:23:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=KX90TntfNSVDI/d+8xow5Mh17Q6zvuilvP5em04oWjY=; b=evlkDz3tOC0PRm2yFOMRmARwNKsKxDT+D/sjkRuXV1enp+iw0RNNX7PXb0LeA4PIuk a4adaa26mplL1TvI3Oa6QpU9gkZwS7NqO5vFN9NGwWQG96gOnbRstdXXREnPse4zOCSJ wmClzqRUYMTOHDnkjYhUnQeri3Kv6FraqdTVDrzJ+lbM8lI+UDnw03PX3A418wQZtQcf Qty0fett7YCVsVMlvaQIp+jkOWSAXv9la1FwplnqLjBg8hmMGdMAkstxUTFh25zy5YbH nR6oxYgIpHy15AjyF447AWS3rjlhHbeqgPZfA0olvaACefhOKfONldoRjh0EIossCuOe 7fKw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=KX90TntfNSVDI/d+8xow5Mh17Q6zvuilvP5em04oWjY=; b=H8b5CQ7/ELhe7m+YmFgnsnt/HYRoa/zTK0yDkZNKFf/cjra/apzfJwJ7JCcIOO+qui wvzC6vEABepyXwzBc967GCvGoXzkHUKfo9yD1S7pbIO6QtVVIFWHgStPCrpwuYyqvG5T YgSLCLTYAleFM8oeJP/4yJmXjT1yFQqhdRlcZ3svKBjohdvaSQYb5M2mk+c8X443i9Lg 3X+mdYvRnWTfzStBykvigOmsU7FZSX6f1lQBpY+Z09k3otb1nHfCdyIy4d4WGcAJvbwk GQAU29JcTRsBGRc5VQX5QgFULyJ5Idrks2ViAfYycgUt5Avg4tYukw0bU47pTFtVQnod qzqw== X-Gm-Message-State: AOAM531+aFX8dto3qyzMlVoN6QZUW9asF4XDVCNISEe3Ltwix/abf2dH QGZ93OuXIWrBPlNlM0n4v7NVzQZFRQx7cnXF/8m3lw== X-Google-Smtp-Source: ABdhPJw5EMlZ2AtRwL99MLJuH8cQy6gfiGn2xNzO1c+09YeQxhf5xOt/ZHongEMMOoo1+Yg3FJeqgp4hisY4vJzlurE= X-Received: by 2002:aca:4892:: with SMTP id v140mr4795362oia.66.1614900183011; Thu, 04 Mar 2021 15:23:03 -0800 (PST) MIME-Version: 1.0 References: <20210223023125.2265845-1-jiancai@google.com> <20210223023542.2287529-1-jiancai@google.com> In-Reply-To: From: Jian Cai Date: Thu, 4 Mar 2021 15:22:51 -0800 Message-ID: Subject: Re: [PATCH v5] ARM: Implement SLS mitigation To: Linus Walleij Cc: Nick Desaulniers , Manoj Gupta , Luis Lozano , clang-built-linux , Nathan Chancellor , David Laight , Will Deacon , Russell King , Russell King , Catalin Marinas , James Morris , "Serge E. Hallyn" , Arnd Bergmann , Masahiro Yamada , Krzysztof Kozlowski , Marc Zyngier , Kees Cook , =?UTF-8?Q?Andreas_F=C3=A4rber?= , Ard Biesheuvel , Ingo Molnar , Andrew Morton , Mike Rapoport , Mark Rutland , David Brazdil , James Morse , Linux ARM , "linux-kernel@vger.kernel.org" , linux-security-module@vger.kernel.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210304_232306_681991_5943B762 X-CRM114-Status: GOOD ( 32.36 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Wed, Mar 3, 2021 at 7:04 AM Linus Walleij wrote: > > On Tue, Feb 23, 2021 at 3:36 AM Jian Cai wrote: > > > This patch adds CONFIG_HARDEN_SLS_ALL that can be used to turn on > > -mharden-sls=all, which mitigates the straight-line speculation > > vulnerability, speculative execution of the instruction following some > > unconditional jumps. Notice -mharden-sls= has other options as below, > > and this config turns on the strongest option. > > > > all: enable all mitigations against Straight Line Speculation that are implemented. > > none: disable all mitigations against Straight Line Speculation. > > retbr: enable the mitigation against Straight Line Speculation for RET and BR instructions. > > blr: enable the mitigation against Straight Line Speculation for BLR instructions. > > I heard about compiler protection for this, so nice to see it happening! > > Would you happen to know if there is any plan to do the same for GCC? > I know you folks at Google like LLVM, but if you know let us know. I think gcc also has these options. https://gcc.gnu.org/onlinedocs/gcc/AArch64-Options.html > > > +config HARDEN_SLS_ALL > > + bool "enable SLS vulnerability hardening" > > I would go in and also edit arch/arm/mm/Kconfig under: > config HARDEN_BRANCH_PREDICTOR add > select HARDEN_SLS_ALL > > Because if the user wants hardening for branch prediction > in general then the user certainly wants this as well, if > available. The help text for that option literally says: > > "This config option will take CPU-specific actions to harden > the branch predictor against aliasing attacks and may rely on > specific instruction sequences or control bits being set by > the system firmware." > > Notice this only turns on for CPUs with CPU_SPECTRE > defined which makes sense. Also it is default y which fulfils > Will's request that it be turned on by default where > applicable. Notably it will not be turned on for pre-v7 silicon > which would be unhelpful as they don't suffer from > these bugs. Thanks for the suggestion. I will update the patch. > > Reading Kristofs compiler patch here: > https://reviews.llvm.org/rG195f44278c4361a4a32377a98a1e3a15203d3647 > > I take it that for affected CPUs we should also patch all assembly > in the kernel containing a RET, BR or BLR with > DSB SYS followed by ISB? > > I suppose we would also need to look for any mov PC, <> > code... > > I guess we can invent a "SB" macro to mimic what Aarch64 is > doing so the code is easy to read. (Thinking aloud.) > > Yours, > Linus Walleij _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel