Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp212975pxu; Thu, 15 Oct 2020 01:52:19 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzKS8kE3UCNNbDtUnvYZFtqypcLBk/EYsWxmPuosA9PGw1J/EV2GhGmzzUWyds5dnorLliv X-Received: by 2002:a17:907:20e7:: with SMTP id rh7mr3452532ejb.515.1602751939667; Thu, 15 Oct 2020 01:52:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1602751939; cv=none; d=google.com; s=arc-20160816; b=o9g1IzsABcWpEZazuUXDKFU3ZuVMQQOotwOjlpQJI5utkwGGbEWK+nAAOvD6MCqWYq Jp7XbK+Sk6xqnufIe1BXQIdhO4uJl5qTmaHjZXdANUjVRrzidET3uHrw379wyYusOgof Ui2qLsZ1AKKRZWFrTWxhEerBWHXDFx9SIHj/1qsN/Eonkflh6fnvsNLsf7JKDyK0yyu5 HtxZFcfvmusFXPuuI1st+kjfgUhso9AjQaRGMDKmqi8tq3nYwO9A+hgvatH4MexTpOyL qmUzfcKvpb+pk166J9hVasYxRGtkGdsJMPLWVVzfzmhSytWS73uilBDOjFCOPTtGGJ7Z cnvw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=HqPJcxWf/UHRmEBTt7/8+9fERJsy5yZfgCD3aK5edac=; b=vrY/x+vzE+BD+ay4IOSjvxvMUBdfLrgkghNWW7gzBYM9IMldyFv3tmUkDh1ScJ6GJK 5KArgTytM6FXg3qpIBBC4RThu+sjqXMRVem7kRQxNo6n4/fDjEKNtF3x4Ao49u1JlXZ0 ylOYqawsQiMlG2/sdDezOJAY/CzZFKbj/EXSyqFBE+73A32V3+GEte6EbpLy5lWCdRK2 EVHKNfwCmqXCw/YKxz1gkwQRyGTYuqFCZC1Qb5nJYMTXDlf20obizvSy5ulkrSc4cQuP cQg7Fdr98o0wB37kKXzkBz2eJv5U47/nA40AG0VC4peksE9jvRArbRZkI7JKByIRwR9i GAlQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=A4NM72S6; 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=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c15si1583809edx.256.2020.10.15.01.51.57; Thu, 15 Oct 2020 01:52:19 -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=@chromium.org header.s=google header.b=A4NM72S6; 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=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388716AbgJOBek (ORCPT + 99 others); Wed, 14 Oct 2020 21:34:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49822 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388187AbgJOBei (ORCPT ); Wed, 14 Oct 2020 21:34:38 -0400 Received: from mail-pf1-x442.google.com (mail-pf1-x442.google.com [IPv6:2607:f8b0:4864:20::442]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0578EC051124 for ; Wed, 14 Oct 2020 16:04:44 -0700 (PDT) Received: by mail-pf1-x442.google.com with SMTP id y14so711085pfp.13 for ; Wed, 14 Oct 2020 16:04:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=HqPJcxWf/UHRmEBTt7/8+9fERJsy5yZfgCD3aK5edac=; b=A4NM72S6XOBlLt7ydRqFfSTY+OzBlWVuGGGaRlZDZkxqnf9MjeK3Cltt2aQwpxz7zl YPaTWKV0+tLK3Kb7pbXz2pJr1jB6+H/v5iYuk2OxW0AuK4tTcH+40f5MEDMJrkrAI+J2 LoHF7HCUrNhZW1eGKcy8zqurDJKuGMnRlW63c= 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=HqPJcxWf/UHRmEBTt7/8+9fERJsy5yZfgCD3aK5edac=; b=jnT0aELG9iZQEmPjyFk7rT2zE0mBYDex9M1IanHo8kR25FREqny44dORMOyWyY0npp Lx4qCoVxnWvOsiFyNfmPnGjLNmGVNqBIzhGSR5Rlt5X+mbBIFkMCDvnNtWxHfRY54fiq 5KFZESa+ol2tptQ3gcyNK+wNQh8KtbWYCevKS209yLj6igtNuAhrrYEEQArAjcQ66ukj /OrTfsqI6OWghEnMAJ23MEbjV/CcNaQeedwuKExYiO0WrbDqyB6jgKGUr77sfLkoeLio WKC6Vat6jDiahDRP3CufG+Gs5nJMcL1jEjAkorecMIyxzpRTgIqF6SIQDgDFmnfnaiS/ EN1A== X-Gm-Message-State: AOAM532LBgDqpIbSA6abvdzeUZNPVS5Az3P9ENSJCvnXazcwBw9u9n5Q ZA0KHh2tTeUP+uiKwPpJNEXceg== X-Received: by 2002:a63:845:: with SMTP id 66mr938293pgi.318.1602716684465; Wed, 14 Oct 2020 16:04:44 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id d128sm743917pfc.8.2020.10.14.16.04.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Oct 2020 16:04:43 -0700 (PDT) Date: Wed, 14 Oct 2020 16:04:42 -0700 From: Kees Cook To: Ingo Molnar Cc: Stephen Rothwell , Nick Desaulniers , Arnd Bergmann , clang-built-linux@googlegroups.com, linux-arch@vger.kernel.org, linux-kernel@vger.kernel.org, x86@kernel.org Subject: Re: [PATCH v2] vmlinux.lds.h: Keep .ctors.* with .ctors Message-ID: <202010141603.49EA0CE@keescook> References: <20201005025720.2599682-1-keescook@chromium.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201005025720.2599682-1-keescook@chromium.org> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Oct 04, 2020 at 07:57:20PM -0700, 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. > > Reported-by: Stephen Rothwell > Tested-by: Stephen Rothwell > Fixes: 83109d5d5fba ("x86/build: Warn on orphan section placement") > Signed-off-by: Kees Cook Ping -- please take this for tip/urgent, otherwise we're drowning sfr in warnings. :) -Kees > --- > 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 > -- Kees Cook