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.6 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, 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 F17DBC4363A for ; Thu, 29 Oct 2020 02:12:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 9020220738 for ; Thu, 29 Oct 2020 02:12:11 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="KmnzLyn6" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387777AbgJ2CMK (ORCPT ); Wed, 28 Oct 2020 22:12:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46308 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726821AbgJ1Vgb (ORCPT ); Wed, 28 Oct 2020 17:36:31 -0400 Received: from mail-pf1-x441.google.com (mail-pf1-x441.google.com [IPv6:2607:f8b0:4864:20::441]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F3287C0613CF; Wed, 28 Oct 2020 14:36:30 -0700 (PDT) Received: by mail-pf1-x441.google.com with SMTP id j18so558159pfa.0; Wed, 28 Oct 2020 14:36:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=w1z4WmWcLWyyqsDJon/u9K8bQjOmOpYyTbSE3GXlbcE=; b=KmnzLyn6+i47a2oCXFfbgt2Tl8Pl3YHx/z1ecMXZptZN4+33a97ws0FeT7y7jVKJOV JkZrCjLxHhLLjhAObO34l1ZOruX9V27jywR7gnnYUyENTcDmOFnHqs17aihRwsZCin92 WBmDtijEWJEifi1t8tBx8Ox4uhm/3p+ZrnbKqjs8eVcrZROtMAjXBdYVV6OqpxKaebr5 4yf+pklO5ndbVUsQwkvo9hqWmfV+pkzJ2HnHyHDOE6Yb5rjoe8pYoM7FK97ileQiaS6t zQnbU14uXJfXVT2cqwSXYdHjFcUQRZc7SanlIjeBTz9uOTVyv0kREmVrfrxVtq6a0nrP e4Jg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=w1z4WmWcLWyyqsDJon/u9K8bQjOmOpYyTbSE3GXlbcE=; b=jZ1+G0s5fDIHAM1T4xx6AzuzqNQR+DbQOulcwZonrhBx+wwBDGiV8g3pCXi2ksWOOj jOiTqkHTC/ktKDPETJJ0tz1jGNWa5hOZPmNnq2mlEtRL/cv3FyFMwAcYMkZyLUGqejxH 54ab2fDe+y2RTasa4GZ3wRE49G80ciNLseJ985fzxesyvSeVhF7NZURNe+l9x9VwKKYI E/U0EB9h3oO58es2tisCMgo/Z3gqZPRD1doSYEfGY59E91XVOOMk2OZmvlNSU5KeTU5B HlHaUVrUFSeIQa1BhpT1GCnyCb42ditzkAO3DsVK7BIIJMIY8gHZpKyufaA4kClab+D6 3K8g== X-Gm-Message-State: AOAM53358mIZqQTHA3g1YMbaeP1rUWVLXRKPxkGE7lyx20rMGaZMmMwN 5EvXE7VjNaOVirTaMc8U4zk= X-Google-Smtp-Source: ABdhPJzc8SV3mCeTDsHSaTgxv1uPpdKkvU4mR2f4hj7joD1tL0pet8MnLxwK4NjP52rxZMSdgkeKnw== X-Received: by 2002:a17:90b:1043:: with SMTP id gq3mr873181pjb.213.1603920990427; Wed, 28 Oct 2020 14:36:30 -0700 (PDT) Received: from ast-mbp.dhcp.thefacebook.com ([2620:10d:c090:400::4:1c8]) by smtp.gmail.com with ESMTPSA id 189sm511557pfw.215.2020.10.28.14.36.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Oct 2020 14:36:29 -0700 (PDT) Date: Wed, 28 Oct 2020 14:36:14 -0700 From: Alexei Starovoitov To: Ard Biesheuvel Cc: Nick Desaulniers , 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: <20201028213614.kqk7atvk6fcjely4@ast-mbp.dhcp.thefacebook.com> References: <20200821194310.3089815-14-keescook@chromium.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Oct 27, 2020 at 09:15:17PM +0100, 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") That commit is broken. I had this patch in my queue: -#define __no_fgcse __attribute__((optimize("-fno-gcse"))) +#define __no_fgcse __attribute__((optimize("-fno-gcse,-fno-omit-frame-pointer"))) Sounds like you want to add -fno-asynchronous-unwind-tables to the above list? > 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 That will work too, but optimize("-fno...,-fno..,-fno..") is imo cleaner.