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,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 45F37C4363A for ; Tue, 27 Oct 2020 20:30:08 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id DB7B621D41 for ; Tue, 27 Oct 2020 20:30:07 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Q5lrtyim" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S372907AbgJ0UaH (ORCPT ); Tue, 27 Oct 2020 16:30:07 -0400 Received: from mail-qk1-f193.google.com ([209.85.222.193]:45226 "EHLO mail-qk1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S372894AbgJ0UaG (ORCPT ); Tue, 27 Oct 2020 16:30:06 -0400 Received: by mail-qk1-f193.google.com with SMTP id 188so2519368qkk.12; Tue, 27 Oct 2020 13:30:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:date:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=pTfXLkUKJcoocwAw1MeELq2/Ah/3yvNDEolWgsyMElU=; b=Q5lrtyimNp/GH2HLr2f3gpGZrDsx/FjkIOPDACzMb7NDXOrHRTwhXxdtZrqtPZsBot /Xhsg1G0rVa9a0DxOI0bUj8yoO58aJMkrp0jdfgERpTOeEPZ3ynhtbFpKknRzAlk29zz axsL6lCyqJyuBV1f4Ica4nNXe649p79NNDqXeUVms8qszp69b4wzdNGMkW8oiEyo8df2 fxBzmwHQsAU+YXmLPT5yLOhwZbNp32k2aKJ6RR9TtT884JNrzjvQ12ea8NYXyGiMBk/F ZJtAX086HFmdxJfDNiCMEp3Tr1Onqo8PDfpBAZtOO249DxwcObr7CjJkSxXdIBKY+Lsg iB/w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:date:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to; bh=pTfXLkUKJcoocwAw1MeELq2/Ah/3yvNDEolWgsyMElU=; b=DO82RT2mwZ35wNqyISziQicyvHpJgxxfWzMMB56gG6V1DbsaikoInqtYUb0isdsLC8 B9/Bquzyd7zX48jFfMAeCuQs4knQuLRvKCoueIQPHJ/oNebwvk78UEH1GjuoYIN/GaTu N/mxXKaBCrwEbni/H339Ds0cKFH+0nbSg2dbbR58Ec72dYMbRYlEZ0O2LgAS51hf6PQM 5MqGQcs3/c5N7mJSeSD7Fz9MFtMf/aaezj3xhvV9jCI/hCuGrn2N96hUPH2zPfuJO3YD L1zNvpToS7CURdrVPAWPZg4RJdrLXjr/97e+QxWV56C1PGN9P5KVzora2GPm3b0DgK6Q X8Kw== X-Gm-Message-State: AOAM530GcKw+id0CtlnhD5UI1u+9u4wT1o6G/IjHjY0HRpMxXZmfYlZ7 PHQbF7lqQ+96zSE6DR7ejsU= X-Google-Smtp-Source: ABdhPJyVdWnZxrvjlPKa1Zli67mpvt40pZAWRVvGroOz15avhiMyv9GHvjgyCXpsLh1G9Ug6AlLQHA== X-Received: by 2002:a37:4f92:: with SMTP id d140mr3840320qkb.402.1603830603983; Tue, 27 Oct 2020 13:30:03 -0700 (PDT) Received: from rani.riverdale.lan ([2001:470:1f07:5f3::b55f]) by smtp.gmail.com with ESMTPSA id b23sm1454393qkh.68.2020.10.27.13.30.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Oct 2020 13:30:03 -0700 (PDT) Sender: Arvind Sankar From: Arvind Sankar X-Google-Original-From: Arvind Sankar Date: Tue, 27 Oct 2020 16:30:01 -0400 To: Nick Desaulniers Cc: Ard Biesheuvel , 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 Subject: Re: [PATCH v6 13/29] arm64/build: Assert for unwanted sections Message-ID: <20201027203001.GA1833548@rani.riverdale.lan> References: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Oct 27, 2020 at 01:17:55PM -0700, Nick Desaulniers wrote: > 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 https://gcc.gnu.org/onlinedocs/gcc/Function-Specific-Option-Pragmas.html#Function-Specific-Option-Pragmas #pragma GCC optimize is equivalent to the function attribute, so does that actually help? Btw, the bug mentioned in asm_volatile_goto seems like its been fixed in 4.9, so the hack could be dropped now?