Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp2969625pxk; Sun, 4 Oct 2020 19:58:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxLY8olUIbjvC4va7EakVYuaOpWIRPtrqws9KCdiIOZ3SJQ0bpxQmgzgzNBUTRyGolSd1E/ X-Received: by 2002:aa7:c155:: with SMTP id r21mr15200653edp.140.1601866731395; Sun, 04 Oct 2020 19:58:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1601866731; cv=none; d=google.com; s=arc-20160816; b=asqRMxQ/ORaA8y3/du8YdMWhOHgnORH4p6UM2iotNz7Cb0CVAUgwzTp/8k9/Vr/H+h QVErP3UgVBtJgREcp4LZwA6jYJJMjJ+yijO7CIc/wV4xCY3qE9Xug5oargDz9T03toP8 rZV0JB4VMCnQwe2/jtHLQ6A++FZNSD/gxg6suHcLQgetkH4CAtsN5yFWVhZB8crwm5jh UHCPo84QfFs+hwic4Ryb4UZAuzyZUzO122Ert9erJ3zcEo+bxUfrwVSA8rSS/rHwV8/B jHNmZaqAiM5+ry2WLeSGG8cMcdnUtD4Gtv4BlU1HEktSRPU55V4I/lEQsUlgck+5uWAv KflA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=OGtLendMkx3eeiJ6VgZEb6Gt3GGRj2yTJFPvPu5CLd4=; b=SxhkpYMY2cedyP8HqPh1iGeO3ClPx4u4rnpgHdvqKuMKcVZlOM5JYDE4xocas/rWap jMevIq6/y76OzMTIHZwMGbX7eLPp0pt/iuldAZo8XDfFmXj9mo/HM0qWa8R9hP9WpSsw b4hEsVRd0C9LPevziN5U4bZ+5A5e64MBocrCq2IztuXVQ2OfZCZUFCZe2cQWPuokH5YX 4NkU5OEptj9F/+RUJIW6Gfc2Bq+CDasP5mJhzcX8nov3I39A8ldYfva0ZUGg1786EOxU BhBsjJL2PtakDFKNyyRI3xmBj1U4QyasYYAVFZKqapPD4R07CG0O0Qtze6gWAguMSt8m Y5NA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=RaF15Fd9; 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 rn19si6320785ejb.340.2020.10.04.19.58.29; Sun, 04 Oct 2020 19:58:51 -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=RaF15Fd9; 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 S1725866AbgJEC53 (ORCPT + 99 others); Sun, 4 Oct 2020 22:57:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45606 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725862AbgJEC53 (ORCPT ); Sun, 4 Oct 2020 22:57:29 -0400 Received: from mail-pf1-x444.google.com (mail-pf1-x444.google.com [IPv6:2607:f8b0:4864:20::444]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ED161C061787 for ; Sun, 4 Oct 2020 19:57:28 -0700 (PDT) Received: by mail-pf1-x444.google.com with SMTP id x22so5808840pfo.12 for ; Sun, 04 Oct 2020 19:57:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=OGtLendMkx3eeiJ6VgZEb6Gt3GGRj2yTJFPvPu5CLd4=; b=RaF15Fd9rYMAFtanTSuiLem9OplLh2MzO6PBjm+lngJx9STARKCibEd3b0xHsunTvN 7kiUTbR2+wm8WuBfQQO0XldpTAfbxT0hTaAQeAESh0fziqtK7T9vf4nwlgsOSi2UA8zb 9kKQF2KzC/o+KXmnclK6xjAISy50b9I5axX18= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=OGtLendMkx3eeiJ6VgZEb6Gt3GGRj2yTJFPvPu5CLd4=; b=K05wT0H2oYAQjX0qCzAVfdV67ov2QfFOFMgNK0ikRqj//at++UBLDXst3jNjYH72xQ 2hRY6l4nk/gZ+z18j9LLquVHN8y2tXZ6Ehf4rVXE3PyXffKw/XqjGcz+KGURAw2lEOnv a+SV21EuwnfmuOkvJOnznenctoKLuqVmlrDFzav2/v0aghjL5V6LQ8058MLGK5zrGypd xuufLQVcyCP94a72GnlBUvTGwybloYfaGlbbf+RzmoRWzinFb8WZkjgfjcswMiFoGFoD /kY+ZCq7lTXxi6EGbiciO4h0pEKpkP2QaOM8//JBmYcXEFphxtVfi7h1YE2Hmc7MCCX/ Wahw== X-Gm-Message-State: AOAM532QPuWWUS29dm7zhbqNT02rymq2qUhd8JbiXFeXCoKXqMxyrn3l rWMQDbIjoV0C/drxxOig6O7VFEcGhAPfKejN X-Received: by 2002:a62:2985:0:b029:142:2501:34d6 with SMTP id p127-20020a6229850000b0290142250134d6mr14273789pfp.47.1601866648452; Sun, 04 Oct 2020 19:57:28 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id g126sm9476727pfb.32.2020.10.04.19.57.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 04 Oct 2020 19:57:27 -0700 (PDT) From: Kees Cook To: Ingo Molnar Cc: Kees Cook , Stephen Rothwell , Nick Desaulniers , Arnd Bergmann , clang-built-linux@googlegroups.com, linux-arch@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2] vmlinux.lds.h: Keep .ctors.* with .ctors Date: Sun, 4 Oct 2020 19:57:20 -0700 Message-Id: <20201005025720.2599682-1-keescook@chromium.org> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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