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=-17.4 required=3.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_IN_DEF_DKIM_WL autolearn=unavailable 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 695C9C47095 for ; Mon, 5 Oct 2020 17:36:23 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 24B092080A for ; Mon, 5 Oct 2020 17:36:23 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="GBwOGDWD" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727839AbgJERgW (ORCPT ); Mon, 5 Oct 2020 13:36:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40264 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726600AbgJERgW (ORCPT ); Mon, 5 Oct 2020 13:36:22 -0400 Received: from mail-pg1-x542.google.com (mail-pg1-x542.google.com [IPv6:2607:f8b0:4864:20::542]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 77086C0613CE for ; Mon, 5 Oct 2020 10:36:22 -0700 (PDT) Received: by mail-pg1-x542.google.com with SMTP id h6so5764526pgk.4 for ; Mon, 05 Oct 2020 10:36:22 -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=tGneaUPSfmwmZclVabdMQtlpK5P/Q67PdE+cZq4zgcM=; b=GBwOGDWDRut7KhZTbQ6/Yi5l7rHvibdoTP1rWlTv094qtnCKgxidxIjLDZIspampjB dEWxjaqxkI2E/pLxBwkz5mNnUeWikWSVhEc0F4xiw4LQqc0VI+I/Gpd4Kw0BxlVF7DvU sCs3d4yP1p+CFlSyF9mp7MdSst1cLCLOTL++2rVcqvUzrV6Qqb3lrSTYJ1tpzX6QbWqf LlxpmqrhyBE54li2VPtdndcbISMNFKzaemvvZkv8UnyrU86L3/cXE6fMebI+Bb0oaqvY iMjhvjfAnZDS7s06AEcd/aUI/xi+GG8yG7ggyZ2pIr3MbiSjAuXsVuF/5jGVm+q8wydN XmvA== 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=tGneaUPSfmwmZclVabdMQtlpK5P/Q67PdE+cZq4zgcM=; b=b+5J6NC4ch6pf3oEMmIaEN+cayVk1rl7Evx9G5dWgcfB1XTWrZF58wC944KjbCq5bT UsnVi4oRXFTH/8mDe1WEg9JvAmZNnCFIn57KV119asfLOc1LvXyC0O89WwRCH1HosBDF ZG9mtiNrCY1FW9gFPo4hwjgA8V8jLxPdhJhsMUb3iXoOcoIJHyFEZyn/DthQCDfsBh0j X5Vj1W7NSVjp08RQxRtPhmgUTueGGNezoc7tYaVa9rQsRfeuBLufLaI3jR9DqBkZe5CC +aG5EFfGPxU4JGQyiLoveI2bmWLPhd7h4b7uV5vnJZeuCSDlGczN3RR7FXTqimuW9Atp 2TiQ== X-Gm-Message-State: AOAM531zuqsduEmNIHqjiggqW2bV9i1gMmuQbohxaUL8fkukOZbOOFto Y1a0sTNHSGITwZqfQkj6pZPivEWcCnmY10QAbUbCng== X-Google-Smtp-Source: ABdhPJxn56caBLZKbrVaopjudCJE86MNDFRX0mqIhB6Pn1QzmCP8YlqsezxHYWQwvGujFEdbYWR/mgySkQY/MAL1pbA= X-Received: by 2002:a65:6858:: with SMTP id q24mr596445pgt.10.1601919381716; Mon, 05 Oct 2020 10:36:21 -0700 (PDT) MIME-Version: 1.0 References: <20201005025720.2599682-1-keescook@chromium.org> In-Reply-To: <20201005025720.2599682-1-keescook@chromium.org> From: Nick Desaulniers Date: Mon, 5 Oct 2020 10:36:11 -0700 Message-ID: Subject: Re: [PATCH v2] vmlinux.lds.h: Keep .ctors.* with .ctors To: Kees Cook Cc: Ingo Molnar , Stephen Rothwell , Arnd Bergmann , clang-built-linux , linux-arch , LKML , linux-toolchains@vger.kernel.org, Segher Boessenkool Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-arch@vger.kernel.org On Sun, Oct 4, 2020 at 7:57 PM Kees Cook wrote: > > Under some circumstances, the compiler generates .ctors.* sections. This > is seen doing a cross compile of x86_64 from a powerpc64el host: > > x86_64-linux-gnu-ld: warning: orphan section `.ctors.65435' from `kernel/trace/trace_clock.o' being > placed in section `.ctors.65435' > x86_64-linux-gnu-ld: warning: orphan section `.ctors.65435' from `kernel/trace/ftrace.o' being > placed in section `.ctors.65435' > x86_64-linux-gnu-ld: warning: orphan section `.ctors.65435' from `kernel/trace/ring_buffer.o' being > placed in section `.ctors.65435' > > Include these orphans along with the regular .ctors section. It's very curious to see different behavior based on whether one is targeting x86_64 via native compilation vs cross compilation. Acked-by: Nick Desaulniers > > Reported-by: Stephen Rothwell > Tested-by: Stephen Rothwell > Fixes: 83109d5d5fba ("x86/build: Warn on orphan section placement") > Signed-off-by: Kees Cook > --- > v2: brown paper bag version: fix whitespace for proper backslash alignment > --- > include/asm-generic/vmlinux.lds.h | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h > index 5430febd34be..b83c00c63997 100644 > --- a/include/asm-generic/vmlinux.lds.h > +++ b/include/asm-generic/vmlinux.lds.h > @@ -684,6 +684,7 @@ > #ifdef CONFIG_CONSTRUCTORS > #define KERNEL_CTORS() . = ALIGN(8); \ > __ctors_start = .; \ > + KEEP(*(SORT(.ctors.*))) \ > KEEP(*(.ctors)) \ > KEEP(*(SORT(.init_array.*))) \ > KEEP(*(.init_array)) \ > -- > 2.25.1 > -- Thanks, ~Nick Desaulniers