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=-11.4 required=3.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_IN_DEF_DKIM_WL 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 E8654C55178 for ; Tue, 27 Oct 2020 20:18:10 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 864622072D for ; Tue, 27 Oct 2020 20:18:10 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="YWQRdPDO" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1831138AbgJ0USJ (ORCPT ); Tue, 27 Oct 2020 16:18:09 -0400 Received: from mail-pl1-f193.google.com ([209.85.214.193]:36310 "EHLO mail-pl1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1831128AbgJ0USI (ORCPT ); Tue, 27 Oct 2020 16:18:08 -0400 Received: by mail-pl1-f193.google.com with SMTP id r10so1363399plx.3 for ; Tue, 27 Oct 2020 13:18:07 -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=i1Sa4pOklTVSBDn1gBaNdBfK+3lXBzX6RjisxK7EZK0=; b=YWQRdPDOE/u+vucTsLTHMVDd0xCZ/ZqYuYBbMMaVwfrCEi30oBxPzNwfA+hIJg/kAi Hvpl9C5lBhGAl/BiWW0xixUeyIqHLqlZn4iRKvZITtltWdYUlHZge9jjfusHSv/UIOsP ThXOycdvIkrnLRN/h7K1b5dnl1PZQe1VrZFX46noaZVrULb79H1AvqQiGYbEOEW3iU+0 Z3U8e4pC3Y/KLsiw+/pCXK3+u7MjzIBsSA7L3Sm6NcgtRWFkwaqK8NCUQmIn+7bJf1z1 L2h9MUabimjWEHUS3n5gK2kd2WpDVvu2TSAZ1f2iq71hAT9rUsN64bMj98JX15V3bDqp EiIg== 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=i1Sa4pOklTVSBDn1gBaNdBfK+3lXBzX6RjisxK7EZK0=; b=htjkaiOkBUWqRIQiRWjiVKdEKLMM4AeWnqw0zugQRc3TubZfrL5QwtGmY904084KCu s4Knatuvxs3Ka6FiYkEFPx6fy/pNulMt85bzqtCPy89QA2sYMZqg7Wd/o/mhD19l4eQp 47pQlfsrnozbmEBmcz7kh7F5z1c0qeS2YxGZ85JAnbT8M0ZZC1J/nTxLYAm0a0y542S9 HsFHrO+Zb9PpoAb7/leFsmBTTuWY5ih6VWVt9Bd8kUpOVHqI7ijgBlTyua69v0z2V2Sc DdulhIrm5olhwE1W3eoPd8G94F7uobAg0PVEouTfF9VkDB19t+3SnocmrqM2MRrr5CZA L4mw== X-Gm-Message-State: AOAM5321gnGx6IAkaTZoPm/SdP+lXJY7DhVFkkyC7AFkHpQboLY+yreA cBJT2HmJidz5ll809YM0cmFd7Wxic/ib//eubU35jg== X-Google-Smtp-Source: ABdhPJywIjgcBV8qXcoNqM7Ed4H7EaNmCfoq2mAz/vgmUAzc6HfUFJTb7scXcDgK4JpIdX27+zaHnJ3FgMPaCTSILwc= X-Received: by 2002:a17:902:8a8b:b029:d5:f871:92bd with SMTP id p11-20020a1709028a8bb02900d5f87192bdmr4163850plo.10.1603829886728; Tue, 27 Oct 2020 13:18:06 -0700 (PDT) MIME-Version: 1.0 References: <20200821194310.3089815-1-keescook@chromium.org> <20200821194310.3089815-14-keescook@chromium.org> In-Reply-To: From: Nick Desaulniers Date: Tue, 27 Oct 2020 13:17:55 -0700 Message-ID: Subject: Re: [PATCH v6 13/29] arm64/build: Assert for unwanted sections To: Ard Biesheuvel Cc: Geert Uytterhoeven , Kees Cook , Ingo Molnar , Catalin Marinas , Mark Rutland , Peter Collingbourne , James Morse , Borislav Petkov , Ingo Molnar , Russell King , Masahiro Yamada , Arvind Sankar , Nathan Chancellor , Arnd Bergmann , "the arch/x86 maintainers" , clang-built-linux , Linux-Arch , linux-efi , Linux ARM , Linux Kernel Mailing List , Linux-Renesas , Josh Poimboeuf , kernel-toolchains@vger.kernel.org, Miguel Ojeda Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Oct 27, 2020 at 1:15 PM Ard Biesheuvel wrote: > > On Tue, 27 Oct 2020 at 21:12, Nick Desaulniers wrote: > > > > On Tue, Oct 27, 2020 at 12:25 PM Geert Uytterhoeven > > wrote: > > > > > > Hi Nick, > > > > > > CC Josh > > > > > > On Mon, Oct 26, 2020 at 6:49 PM Nick Desaulniers > > > wrote: > > > > On Mon, Oct 26, 2020 at 10:44 AM Geert Uytterhoeven > > > > wrote: > > > > > On Mon, Oct 26, 2020 at 6:39 PM Ard Biesheuvel wrote: > > > > > > On Mon, 26 Oct 2020 at 17:01, Geert Uytterhoeven wrote: > > > > > > > On Mon, Oct 26, 2020 at 2:29 PM Geert Uytterhoeven wrote: > > > > > > > > On Mon, Oct 26, 2020 at 1:29 PM Geert Uytterhoeven wrote: > > > > > > > > > I.e. including the ".eh_frame" warning. I have tried bisecting that > > > > > > > > > warning (i.e. with be2881824ae9eb92 reverted), but that leads me to > > > > > > > > > commit b3e5d80d0c48c0cc ("arm64/build: Warn on orphan section > > > > > > > > > placement"), which is another red herring. > > > > > > > > > > > > > > > > kernel/bpf/core.o is the only file containing an eh_frame section, > > > > > > > > causing the warning. > > > > > > > > When I see .eh_frame, I think -fno-asynchronous-unwind-tables is > > > > missing from someone's KBUILD_CFLAGS. > > > > But I don't see anything curious in kernel/bpf/Makefile, unless > > > > cc-disable-warning is somehow broken. > > > > > > I tracked it down to kernel/bpf/core.c:___bpf_prog_run() being tagged > > > with __no_fgcse aka __attribute__((optimize("-fno-gcse"))). > > > > > > Even if the function is trivially empty ("return 0;"), a ".eh_frame" section > > > is generated. Removing the __no_fgcse tag fixes that. > > > > That's weird. I feel pretty strongly that unless we're working around > > a well understood compiler bug with a comment that links to a > > submitted bug report, turning off rando compiler optimizations is a > > terrible hack for which one must proceed straight to jail; do not pass > > go; do not collect $200. But maybe I'd feel differently for this case > > given the context of the change that added it. (Ard mentions > > retpolines+orc+objtool; can someone share the relevant SHA if you have > > it handy so I don't have to go digging?) > > commit 3193c0836f203a91bef96d88c64cccf0be090d9c > Author: Josh Poimboeuf > Date: Wed Jul 17 20:36:45 2019 -0500 > > bpf: Disable GCC -fgcse optimization for ___bpf_prog_run() > > has > > Fixes: e55a73251da3 ("bpf: Fix ORC unwinding in non-JIT BPF code") > > and mentions objtool and CONFIG_RETPOLINE. > > > (I feel the same about there > > being an empty asm(); statement in the definition of asm_volatile_goto > > for compiler-gcc.h). Might be time to "fix the compiler." > > > > (It sounds like Arvind is both in agreement with my sentiment, and has > > the root cause). > > > > I agree that the __no_fgcse hack is terrible. Does Clang support the > following pragmas? > > #pragma GCC push_options > #pragma GCC optimize ("-fno-gcse") > #pragma GCC pop_options > > ? Put it in godbolt.org. Pretty sure it's `#pragma clang` though. `#pragma GCC` might be supported in clang or silently ignored, but IIRC pragmas were a bit of a compat nightmare. I think Arnd wrote some macros to set pragmas based on toolchain. (Uses _Pragma, for pragmas in macros, IIRC). -- Thanks, ~Nick Desaulniers