Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp688849pxx; Wed, 28 Oct 2020 14:34:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxfllPs+tZxNheWlAbrp4+2ZMwRS9uBJPkmuqoUR73OKDhXRT5SS7vNARu6mshJiohOfXzj X-Received: by 2002:a50:ff02:: with SMTP id a2mr909839edu.364.1603920858100; Wed, 28 Oct 2020 14:34:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603920858; cv=none; d=google.com; s=arc-20160816; b=S8xlRALm1/B1o24IsOyp4SPIl5pXeot4yuE5oiRlvwv+fCN5u47raNiGKf64UHXgs/ ACNDT+S1TEnZ4ZRyDBvKjY4ZnwYA6WTSjVFp1JwyWDsvTAvUsRl05p2218/jgtkhXgDR Pn2ZqW/sxSGvU1WlRpf00QVD1C4b6YPIwpkuzAeu0mVR0WIclca2oAnDsXCaKUrDDgef evor/6oXDoPtlQildNJ56aZ18O1Hhp/aDZRBGVjVvFtbbtr3/9xBM4F3UbBHffKWBoe5 4DF5GYoL8Pk3K19Papabc+kaBeVJt1YdHH9xVNIaDWd28X4D62MH4rTgNyGp/Ec+lZhN cRHw== 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=i1Sa4pOklTVSBDn1gBaNdBfK+3lXBzX6RjisxK7EZK0=; b=bHyy2/usuu4C+Iktg9RGZlGHbZFX5UPf05ewfTZAdvtXn49KTSTtGKahTt1L5Symtr waUjnfENPBmnwhe1H4/+2uIFo/C1JSonT/c/SYBQFmkyIFdZTDyIu8Ef/IeucyVw/Emx W6anhfDl6dHsnUkpkROpuvQDFY1JITcfoA9CaBol8y7rySCb9UoPVc3DnkiGNwPEZyHa qSHzf7p/C2MWQ1fAmBil0QtTYSukZtPmNx5nuLDVIi0dZg9E0GeBu6gTEHdgQ2tAw+/s TuN/ytGTsV9fomxHVK7ABadiK56GP3vkBnxBT7VSRlS+JnYL9W4gIOldKjd1zwh9W4VG lemw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=YWQRdPDO; 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 f3si501458eds.476.2020.10.28.14.33.56; Wed, 28 Oct 2020 14:34:18 -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=YWQRdPDO; 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 S1831134AbgJ0USI (ORCPT + 99 others); Tue, 27 Oct 2020 16:18:08 -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-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