Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp666018pxx; Wed, 28 Oct 2020 13:53:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwTzNht/615zUMQaf+kaWeeQZU34NsWAEUxu5Z/Ijir1qZFi/rKzXZWbgWEOMcwaeqNCXlJ X-Received: by 2002:a17:907:40c2:: with SMTP id nv2mr870925ejb.337.1603918419247; Wed, 28 Oct 2020 13:53:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603918419; cv=none; d=google.com; s=arc-20160816; b=hXZx15D7DQzBh6EwOlS6ZlaiNMYYsF1bXDlK9x9In+6snHf88qnL5+f7Cugq1ZkfnZ bg9U/mtVZyHN4YbfJvHbRJnZjmyXQV+bXQQWMfA6Y6QEYG9IvY67bRPjr4a4GaaefTCW Eg+GlPGiL10rueuIuQ+V91Tc/roVEK+aG4FvaZeImulK/HMceWpfP06U+20Ue9aZMAnK HNBVCGFrbka2O16THjwd+Sdze6FCxDtY8opoYLG3kuK/LqxbyljbkALrCNh/eRQ4RtVS Y/ZSFGhjOituALb+Ul2z5wVdGpim4Fz0Vpo1I7gH7mJjMix56wcHTknM23RgmTkCdQyK DAXA== 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=fzsbwLvdGSJ+Kgby3r9OLU17GqYc/oKZO3Jxig1YfGc=; b=ZAVPClogExtVNETfuPooU6hIw9uxDQSUEl7ssBuLqzB+fttZSjmTRyMc5svTf57HHp sFD13FxzmCKjFXM/MSSo+DxhfjqOUKU+aybAi4XsDxrnXXM4O2VTUOD+ubzC2MxGLPZq 3M5MoyMthbQgsNn48eW3DZ4ahvTyeCkYDNoPbMy3tul8IBcnL94FKtUbtZ2WsdbNW1O2 kGrVVzGyAkzQpyaFOVEH4s4IKbdicdlmRFV25Q4L7hISipDFxqnlg3ngvjdaCZckcUFh iCyiUtdLYghicntpw1FAOSuacsquiXcZbACt923vXB5gzb7v2lx0d9vaJAE7K0hVPgAl PzEg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=ZLHgLc3I; 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=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y1si30775edp.57.2020.10.28.13.53.17; Wed, 28 Oct 2020 13:53:39 -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=@kernel.org header.s=default header.b=ZLHgLc3I; 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=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1830104AbgJ0TdO (ORCPT + 99 others); Tue, 27 Oct 2020 15:33:14 -0400 Received: from mail.kernel.org ([198.145.29.99]:48954 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1830096AbgJ0TdO (ORCPT ); Tue, 27 Oct 2020 15:33:14 -0400 Received: from mail-ot1-f54.google.com (mail-ot1-f54.google.com [209.85.210.54]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id D9C572225E; Tue, 27 Oct 2020 19:33:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603827193; bh=cCb5ESWzvqpee6cBNzRlKMh6WeU754Njt36C7Aon99s=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=ZLHgLc3Iue0tuLATFozFOGfw9hlJ0tAXtjAg7MF3L+yYfGPdQW+4h9/f8c4vD2dx2 jZ1lgcNiNpgGeeL89MxyFD9LCu3+9gEdTR+kYVgChq4ibYKtbg1YmFvud40f1f/3yT S0/I9M+EAAioEch6DOeWJePWxeFXgGmuCEApSIxY= Received: by mail-ot1-f54.google.com with SMTP id f37so2171299otf.12; Tue, 27 Oct 2020 12:33:12 -0700 (PDT) X-Gm-Message-State: AOAM531L44NT5Ik5VB3d3k2lTz1rxLeJkV6CbgfLCD+3mge9Qzh1J7hl s1BUIPcir/QC4BiTg4zPAXHRFFrBFu8w62RIkX0= X-Received: by 2002:a9d:2daa:: with SMTP id g39mr2760143otb.77.1603827192042; Tue, 27 Oct 2020 12:33:12 -0700 (PDT) MIME-Version: 1.0 References: <20200821194310.3089815-1-keescook@chromium.org> <20200821194310.3089815-14-keescook@chromium.org> In-Reply-To: From: Ard Biesheuvel Date: Tue, 27 Oct 2020 20:33:00 +0100 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v6 13/29] arm64/build: Assert for unwanted sections To: Geert Uytterhoeven Cc: Nick Desaulniers , 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 Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 27 Oct 2020 at 20:25, 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: > > > > > > > On Fri, Aug 21, 2020 at 9:56 PM Kees Cook wrote: > > > > > > > > In preparation for warning on orphan sections, discard > > > > > > > > unwanted non-zero-sized generated sections, and enforce other > > > > > > > > expected-to-be-zero-sized sections (since discarding them might hide > > > > > > > > problems with them suddenly gaining unexpected entries). > > > > > > > > > > > > > > > > Suggested-by: Ard Biesheuvel > > > > > > > > Signed-off-by: Kees Cook > > > > > > > > > > > > > > This is now commit be2881824ae9eb92 ("arm64/build: Assert for unwanted > > > > > > > sections") in v5.10-rc1, and is causing the following error with > > > > > > > renesas_defconfig[1]: > > > > > > > > > > > > > > aarch64-linux-gnu-ld: warning: orphan section `.eh_frame' from > > > > > > > `kernel/bpf/core.o' being placed in section `.eh_frame' > > > > > > > aarch64-linux-gnu-ld: Unexpected GOT/PLT entries detected! > > > > > > > aarch64-linux-gnu-ld: Unexpected run-time procedure linkages detected! > > > > > > > > > > > > > > I cannot reproduce this with the standard arm64 defconfig. > > > > > > > > > > > > > > I bisected the error to the aforementioned commit, but understand this > > > > > > > is not the real reason. If I revert this commit, I still get: > > > > > > > > > > > > > > aarch64-linux-gnu-ld: warning: orphan section `.got.plt' from > > > > > > > `arch/arm64/kernel/head.o' being placed in section `.got.plt' > > > > > > > aarch64-linux-gnu-ld: warning: orphan section `.plt' from > > > > > > > `arch/arm64/kernel/head.o' being placed in section `.plt' > > > > > > > aarch64-linux-gnu-ld: warning: orphan section `.data.rel.ro' from > > > > > > > `arch/arm64/kernel/head.o' being placed in section `.data.rel.ro' > > > > > > > aarch64-linux-gnu-ld: warning: orphan section `.eh_frame' from > > > > > > > `kernel/bpf/core.o' being placed in section `.eh_frame' > > > > > > > > > > > > > > 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. > Given that it was added for issues related to retpolines, ORC and objtool, it should be safe to make that annotation x86-only.