Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp5373029pxu; Wed, 21 Oct 2020 23:51:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzZ7arDvv+ZJkc6nmKPdY+CPZcckAEZTOCArvprrQxD900KltwClSAh2L11C0gtwc+TsRdl X-Received: by 2002:aa7:c7cf:: with SMTP id o15mr873843eds.15.1603349490750; Wed, 21 Oct 2020 23:51:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603349490; cv=none; d=google.com; s=arc-20160816; b=RsUITUNGuneVf0nA4cJLA5dI1XYcmMzt3bDHFSf6GWSMf0QgK9aNUYS6FOlsJubOQM ub0w18isEF7SQtLtr1lx+ZUYDfukFy9pFCAOBtx/Ux5kZUbivNOcGtBBzVYU7SEa70GS fJBI2r9D0HAAUfQbmpoxIeBs7wzC1ljrlnZ955fjn1BsHvXHiEn5SvaERq5b4k8Zy9j8 5u9U3FmVLHU5YsS6SmhKUagM4DX77Dwyto56GijAg/Y2OiSD9lXIrYlFGm4KxIi/uP1z 6IQQyGqgFDnaL/lIve4Po10nRyWPBLTBtFteL/uzFajUh3tM2Se/6XvEwD0jrFXbcQET FR2w== 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-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=QmgTEKwAstprmqCLOa3+RIlsgOb3vaDpc+a/kqXMeho=; b=d0erQG5T1APCOIiIRyPKsIWOPAnEIE0IUvIGnN1XcvA60vR/OAYqYEUD44OZObG6ru bVpfJB2yCEQZQvmkxQQH6Yq/hd8cPgp/i7YxWx/4AQd96iGlYBbyfwnhhwQTITk4sJW2 DrEWorgo/BPLPCoINmOfJYaioeGHNgtOmTG2EqlcyE4fe7nIfNs3hVyfo7T1RPoKEpnX d+aJRbC+EE0GTfokOzDKOSos39RXuz3pKlG4se06kHekXLewqVJ2Go0JkL4FllCTMKTS vA+E0N9hhAyAIedD9hjVfy27dWHpHdAJkf3EuhEkyH4fL8iS2WW9IrDmo+Jpk84olxv2 VDTw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=kF5lPFe4; 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 d12si405520edj.601.2020.10.21.23.51.07; Wed, 21 Oct 2020 23:51:30 -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=kF5lPFe4; 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 S2505094AbgJUUJD (ORCPT + 99 others); Wed, 21 Oct 2020 16:09:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33126 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2505090AbgJUUJD (ORCPT ); Wed, 21 Oct 2020 16:09:03 -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 29238C0613CF for ; Wed, 21 Oct 2020 13:09:03 -0700 (PDT) Received: by mail-pg1-x542.google.com with SMTP id b23so2159399pgb.3 for ; Wed, 21 Oct 2020 13:09:03 -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:content-transfer-encoding:in-reply-to; bh=QmgTEKwAstprmqCLOa3+RIlsgOb3vaDpc+a/kqXMeho=; b=kF5lPFe40b1By22pyNf/QSD4ROD/TqtxRsGYCI+6UAvkwJBnp0Bv7hekYoZDC4YPyh TuXjh9jmqmmtmR5MePoh8VDkwqjC1qIEF7FhZepb+nHrVfXKuvGAs3v6eEhHOdkTt1a9 bSFpMSFITiNN8MPP2KQPWrwup5YiohRy88eb4= 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:content-transfer-encoding :in-reply-to; bh=QmgTEKwAstprmqCLOa3+RIlsgOb3vaDpc+a/kqXMeho=; b=GnNtV9uDS6UjQ3Msf+XzDtqPsDAUwlmgEU0jVOzGWWkXxnXyWbTVc/2xsO3YjGLnyY Q79sQbf6LWo6yG4iGvWtcQ4BZ2Y2+oXQXqq8Lj5PJCKL7OcJU2AYmLEJJBP8bXVpg7Zl uU73gOut4wGJ4y+sa/8qO4tIsdnXysaeuV4RkVurPxwGtPjVtw9lMtX40Z4CS6WG1/Ws E4Dj1RxYaLcXn8HhRaXtPJv+1WKajzbQ+6bC1tuvBQ9oawfYgYMnXgR9//FKW9djUueM nqmI7Si8upWV1bD9WOTC0dUMGBVisMrsRzZCh9yfEk2wkVSL20iIOWDbEUxFrnCFOAp7 gHfw== X-Gm-Message-State: AOAM531El1Cx9T7lYEObZL9mimsexbE6FtjFGgf9lkEU8WS9p3QiXA5K 5ufZ8xGk3b6SfxcZGavQVBjuOQ== X-Received: by 2002:aa7:95a6:0:b029:155:336c:3494 with SMTP id a6-20020aa795a60000b0290155336c3494mr4884846pfk.17.1603310942592; Wed, 21 Oct 2020 13:09:02 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id y10sm3344623pff.119.2020.10.21.13.09.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Oct 2020 13:09:01 -0700 (PDT) Date: Wed, 21 Oct 2020 13:09:00 -0700 From: Kees Cook To: =?utf-8?B?RsSBbmctcnXDrCBTw7JuZw==?= Cc: Ingo Molnar , Stephen Rothwell , Nick Desaulniers , Arnd Bergmann , clang-built-linux , linux-arch , LKML , X86 ML Subject: Re: [PATCH v2] vmlinux.lds.h: Keep .ctors.* with .ctors Message-ID: <202010211304.60EF97AF2@keescook> References: <20201005025720.2599682-1-keescook@chromium.org> <202010141603.49EA0CE@keescook> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Oct 14, 2020 at 09:53:39PM -0700, Fāng-ruì Sòng wrote: > On Wed, Oct 14, 2020 at 4:04 PM Kees Cook wrote: > > > 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 > > I think it would be great to figure out why these .ctors.* .dtors.* are generated. I haven't had the time to investigate. This patch keeps sfr's builds from regressing, so we need at least this first. > ~GCC 4.7 switched to default to .init_array/.fini_array if libc > supports it. I have some refactoring in this area of Clang as well > (e.g. https://reviews.llvm.org/D71393) > > And I am not sure SORT(.init_array.*) or SORT(.ctors.*) will work. The > correct construct is SORT_BY_INIT_PRIORITY(.init_array.*) The kernel doesn't seem to use the init_priority attribute at all. Are you saying the cause of the .ctors.* names are a result of some internal use of init_priority by the compiler here? -- Kees Cook