Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp4619721pxf; Tue, 23 Mar 2021 15:42:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwFTMewLXr+oWatripaGnPUGi3gZmX9zwC2CeTOOlfZUYagqYGqKlImTHm+mIIE5Z2EYiW+ X-Received: by 2002:a17:906:58c9:: with SMTP id e9mr473678ejs.26.1616539368680; Tue, 23 Mar 2021 15:42:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616539368; cv=none; d=google.com; s=arc-20160816; b=Vp3NZBl+SVhhhKxyVZ7hLghqBzLfHIryFnt0QAiaoOLcYZ462DMtdaiKarX+Qprc5f OX+1BONfX9QROq8Iyc+Vj54L2IKDjli9xKo+XaUy2h1tjiUzAXo0hvW9HUr7PipKbgvI cC3VW0km+/6/IA3PXCAl3KavJWmBeYmEA+MGAsf27j5e1fnuVjWY5R1FX/6dYuyLAlKa XjkRcA+jo7kMNQWtkd7vrgGueMubMUWdxqnnlFYbymN+gTyyndHCJT0pyRYt9muYUh2+ d5XoCOycQxec42SHGBq4f6pAP/1WXRuX80cA0r2QDQ2IOa10rTGr0GEAm4lUS5m2x6NO YUhw== 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=2K8tLkChb+506zF+z/6B3jJAVVp0oMTr1r3/3aTgbn4=; b=ycUhP8YO4HDAxCdd/pU/TbhyAJZEFS62vsbDX09cz3lfLPUYwlR4on1Ek6AGpSa0nX 5bYTqi0V4Evg1PZCxqXq/Cj6I85tysqilKdBWs/ICoiIJvJa3O7nfu7Y4GalLc+A+Toi eZwt2nsA2+EVvkIMrUm0uh9zt67EHsqQsp9Wix9SORIgI8uvd4/UpaXBeBEqcCnXpLOI yRL9Vjf6JlTdZ1c/IHiPHGCw49rneUR/+bh7swNDVV9q4P31yztJPirAKZlk/5FoUEL3 j+EwEyLqDqfZBk6v7Ql+c4rqWnRyzwkDJdZylOFLt8gmrzAI77hi3DsF4mFSJmhp1FGC QtAg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=Pe81cQ60; 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 lz12si267582ejb.304.2021.03.23.15.42.13; Tue, 23 Mar 2021 15:42:48 -0700 (PDT) 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=Pe81cQ60; 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 S234075AbhCWWkc (ORCPT + 99 others); Tue, 23 Mar 2021 18:40:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42676 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234045AbhCWWkD (ORCPT ); Tue, 23 Mar 2021 18:40:03 -0400 Received: from mail-oi1-x22a.google.com (mail-oi1-x22a.google.com [IPv6:2607:f8b0:4864:20::22a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BAFEAC061764 for ; Tue, 23 Mar 2021 15:40:02 -0700 (PDT) Received: by mail-oi1-x22a.google.com with SMTP id z15so18798960oic.8 for ; Tue, 23 Mar 2021 15:40:02 -0700 (PDT) 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=2K8tLkChb+506zF+z/6B3jJAVVp0oMTr1r3/3aTgbn4=; b=Pe81cQ60l5HI2BEwB08JrmJgjyYI5GsI3IG5+NoNvN7VxFUlwWmEy8vXEIyGwtmzwW PMhpc0Uoys2+0YlJncs+JwzktMZ4f7sMDoja0mnZeF9Av0u9MAKIbVp6r2SqjdHhCwl4 91CyfWajYrMgrHW+aut9mDhFzzUElhDwht9/MjUcojOa+L+0nxzHZiE2W5ucqb5Cm/G+ 0kn9cLuHDDhFx2cfgZs538uCneOninzEY03vpioj/99K2O9tZk5aEH1w8TsBOYitABPk NEKvMo6kq01IAKkKBlZAOaNYMcnXQJyDKKPo5l1L5qhGIO8xwAtsCn3VcYlm69I5+d+w DZaw== 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=2K8tLkChb+506zF+z/6B3jJAVVp0oMTr1r3/3aTgbn4=; b=SK64Iwt7an81w53Sn6xBa3K7xwzJiTScHiXaXiHtjcwu7XqCUVpcrWjbL6r1RA6BUO fFnNxfCpsxtXDhch7snksKRz9UngL2rTRFtT+Cy4gTyIMwZ3BAcPJSfRAJPZbtEGL9dJ Ef+eolRj6AZtNyqp/E9Wa/jc01Cue+WX9JpjhB3PstW9ZTGEi91sNoNb4Nn0GlE/7Pze Hg0koLIEbEl9Hu34/lWoNmqTt9Ps/aURDOy8WDk/JXQi2Cp6SBMkfgliDRzPG30/qs/K j7xFp4H0r1Wi3M5jB+U6lgrEvWvRFIo82zCDrTRSUNnGzS4fOtMf5f1Frl6AYz4OKYi1 Bpnw== X-Gm-Message-State: AOAM533mGxjljN+mIoOVim3iNI29UGBVA3QGeEWnsJaeQc/Fhv0Oty2t 1QJodni4bEV1uQjosmnc4tE5eyUKpUdobvj7t5qhcw== X-Received: by 2002:aca:c683:: with SMTP id w125mr263549oif.43.1616539201756; Tue, 23 Mar 2021 15:40:01 -0700 (PDT) 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, 23 Mar 2021 15:39:50 -0700 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 Thanks for the suggestion. I've sent an inquiry to the author of -mharden-sls* in GCC and hopefully that would shed some more light. We do get warnings for oraphon sections when using lld. The other linkers do not seem to provide such warnings, although the boot failure also does not seem to happen with them. On Mon, Mar 22, 2021 at 4:45 AM Linus Walleij wrote: > > On Wed, Mar 10, 2021 at 5:43 AM Jian Cai wrote: > > 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: > > > > > 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? > > I think the best thing is to have something like this: > Implement a macro such as this in > include/linux/compiler-clang.h > > #define SLS_TEXT_SECTION *(.text.__llvm_slsblr_thunk_*) > > then the corresponding in include/linux/compiler-gcc.h > but here also add a > > #define SLS_TEXT_SECTION #error "no compiler support" > > if the compiler version does not have this. > > I don't know the exact best approach sadly, as the patch > looks now it seems a bit fragile, I wonder if you get linker > warnings when this section is unused? > > Yours, > Linus Walleij