Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp197248pxb; Tue, 9 Mar 2021 21:04:05 -0800 (PST) X-Google-Smtp-Source: ABdhPJyBIcErFO1thfTvDVvzR7IJwDRq1pklqcmraE9Z3Fy7GLmNO7qYQNlokSXtGnZiu8fn9PG1 X-Received: by 2002:a50:e882:: with SMTP id f2mr1192351edn.184.1615352644891; Tue, 09 Mar 2021 21:04:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1615352644; cv=none; d=google.com; s=arc-20160816; b=yJUpo0O5B9xF6OYvOcw3K09+s8j3VnLD9+9/nHw1xzVqUIpRnt2Zk24Irf8lpXueN0 /NUpaULUPf7cODHOjFUHhXrnDAwN61Ro75GYU0WyqY5fv71WrKaZ3pX2xfas8iYdYgmv 4ltvWZbhvggrpGj3b9CflRORFoHLwxBkkrGJwwQAQmyiT3sNiwmsPm8GdlzDtdYPW/Yk oO9HKzCBRHau0sLTdtidG4mzFJ20aoTAJnMFIabPiXKg/m145cpAkXopd+LOyZID2J98 b8PC+fGAP9keYy8KosHN5JsO8rKYuXum54bsD6MN3oNau8iKnD04OcdtWSGNJzUb3SZe PYiQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=9sVW/yEh768vDJxep1QYojM5RquL8YGeRAgcKVSj11Q=; b=yu76FcgHHGqX9TtGn9HuElHWtxUssMKklEQIbDBR8O889Hawa+hOCyMh7Uy59ErjdE 1hxk/9ns6p4/hbo2pwT+ZvjHFZgbJ8gDZH/T9iGbtcki85euMafuS1JvpGQ3Pq+Nuneg ioEMNCdFk7teEMxLpxjeSzLSw84VGPywbf3p13FQIujLxGdVRPuzjPAVyVeS4OCKf4A6 Lxbvtj9f9HHznA0b/B+vIdU9o6+ZURsAvdDvAn7siW8SBp/9zfFqhZXyTCXQtHtRFxdF Fj9+mjmKHU5KamFL0xyxUMATwEIzMsuauXhuF7mghbAK+dZG07AoBP3uUnGfo4Gx5JjF p51A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=tQoIjHIj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id bd18si10456122edb.609.2021.03.09.21.03.42; Tue, 09 Mar 2021 21:04:04 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=tQoIjHIj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231135AbhCJEoF (ORCPT + 99 others); Tue, 9 Mar 2021 23:44:05 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45692 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232289AbhCJEnk (ORCPT ); Tue, 9 Mar 2021 23:43:40 -0500 Received: from mail-ot1-x32a.google.com (mail-ot1-x32a.google.com [IPv6:2607:f8b0:4864:20::32a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A2C45C061760 for ; Tue, 9 Mar 2021 20:43:40 -0800 (PST) Received: by mail-ot1-x32a.google.com with SMTP id f8so10129042otp.8 for ; Tue, 09 Mar 2021 20:43:40 -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=9sVW/yEh768vDJxep1QYojM5RquL8YGeRAgcKVSj11Q=; b=tQoIjHIjxlyxEXvV1M3f7zlUJ0EJ6iuPzwotpyuWgFl3QSRHEI/bk0ZGiM7zP0WHTe IxNVgTaEfb12GuNXnQ/GGGAZzzRnWFennElHJ1uxROn337JWx0RvEYIQzDBMIaSoEMsP Dqjs+FvtrSNT72rmcwHLgyxfa+CLqBvGXwGRw6J3p7SGgEyzO9lkA/K6No3i9Zuc46fa MQRy2hcY16n4Yowp/8mbuiPCZ76oh4O+vh8FkWitoQqcm82eRlLCAkwqjWVtwupZnv+m Li15kvDeZ3AE3HrfIpV2Ijlg67tEdxHj4EinK2P9c7l22vScMGm3tYlRwg4gYVhvYeIJ ujBA== 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=9sVW/yEh768vDJxep1QYojM5RquL8YGeRAgcKVSj11Q=; b=SBbh6pBf2f3j23pwgOh4UFAsaGRojG3RUhE8vJxRQEfci70PgN15fLakuo2qib/jFv S+sVd5y5nH0nUDErIby3S3SDmWcvjA5yQ8y+EJybEQ4BWqDURzxCpct0ZZriZoxIqA1C R1YYtTqHn3yI90ouc3Vo3Wo1apkG7BBb+vo3BjQJDqwN9MFxw8nVRQcWI79ehnuRAi56 nb8NHAzdLpeBXxzF8HHOXmR5EH+2ATsPaHAJtEPJDxUaq48q+IzpfdYs7hM7WLyAjc/W 3F9RI2r+Y4H6AEpbI8fyjtLW5l1eHvu/AOswJb5vAEeOkjkIE/AEiTOit9HUa+7kRNA6 ibcw== X-Gm-Message-State: AOAM533uiXOJ1bqdeQ7Agn8uaQfmjbn9xAjs8jZiKv1d8YUMjEg/Xv1z KlTlmDcDzl7ukTfzGnDsPWI9ZCsy6spekVMSjgrQ8w== X-Received: by 2002:a9d:66c9:: with SMTP id t9mr1219555otm.111.1615351419664; Tue, 09 Mar 2021 20:43:39 -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: Tue, 9 Mar 2021 20:43:28 -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 Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Mar 6, 2021 at 4:25 AM Linus Walleij wrote: > > On Fri, Mar 5, 2021 at 12:23 AM Jian Cai wrote: > > 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 > > And how does that work with this part of your patch: > > +#define SLS_TEXT \ > + ALIGN_FUNCTION(); \ > + *(.text.__llvm_slsblr_thunk_*) > > This does not look compiler agnostic? > You are right, GCC does generate different oraphan section names. I will address it in the next version of the patch. Also it seems only arm64 gcc supports -mharden-sls=* at this moment, arm32 gcc does not support it yet. I don't know if there is any plan to implement it for 32-bit gcc, but should we patch arm32 linker script preemptively, assuming the sections will be named with the same pattern like how clang does so the kernel would not fail to boot when the flag is implemented? Thanks, Jian > Yours, > Linus Walleij