Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp1124114pxf; Fri, 12 Mar 2021 02:29:52 -0800 (PST) X-Google-Smtp-Source: ABdhPJxHqH+GnwPvowM8kKLnLzuxX03d6lbo8yRkjp5URqoogB3sve6hTE3iCQ2FiJflOECANGGg X-Received: by 2002:a05:6402:46:: with SMTP id f6mr13399670edu.252.1615544992076; Fri, 12 Mar 2021 02:29:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1615544992; cv=none; d=google.com; s=arc-20160816; b=FWfhf4pQrhpTnptPDMMlGTiwCZYynX3Sifo/gCI8mU7opdHPaQZUhqTwB7jyhxmT3U 5Y3+vQuOGNORAACoR3Gjt6BjJ6QkHaIDRa+86S/n4qJDmXDB1JygAht1/puX0qkc8Zu5 4Ps7R/aLGnPeIz0aAnBULfNAa3/TSkT11ZDjOiUQLiW+f+3gnY9minoLSi2oTrNpVvoa rEJnYSUv2Blo73pF4WNx3WR/RzzHaaTAMTbjnmcbPJtWLUB4rhiEpFx2+s0dPijZ5fpO 71vck/FqvPmB55TLiub/tZHIpLBZSIqVB6Ay+32zLFdxa3YGt1X2h5DCsjQ3gsnyyxp4 8J2g== 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 :user-agent:references:in-reply-to:date:cc:to:from:subject :message-id; bh=9rUPKURpUncoqh8csyQ+1vdPjijeQt9U9huPfqEBWI0=; b=SljWtFqRp/oB/+H64sM09F1rMIcEDmPmD1LyqY9dGVWPt6UcGUURvwqmovRsX/1Bhx dgRAlJJ+vMauItMQwDL4jov8/+/pEwCh4+FAukWfG2FQc0kj3m8yhegu44pbWQW5LWw/ xIKf672r80hG9eZYMB2ZotPvDZ2v+B8421+gbrFMSPsONEO+VhbZK7JBrSTSbrjw5MeA pxfWLx2880tWYjgFpD7RLOIPWmXFsgRF7J8MSHYeQdGAT9ttF56aRmVsN6HtfhF+h2Ec AIWRgQEe/2YKIkRUBSu39TQhwPCrEay+BM1aXkbRxLP5Lsmvk3QhBkA7P/mZd+Ld9u2V 5tHQ== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id jo5si3909553ejb.644.2021.03.12.02.29.28; Fri, 12 Mar 2021 02:29:52 -0800 (PST) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233487AbhCLK0f (ORCPT + 99 others); Fri, 12 Mar 2021 05:26:35 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34560 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233329AbhCLK0Y (ORCPT ); Fri, 12 Mar 2021 05:26:24 -0500 Received: from sipsolutions.net (s3.sipsolutions.net [IPv6:2a01:4f8:191:4433::2]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5F4ABC061574; Fri, 12 Mar 2021 02:26:23 -0800 (PST) Received: by sipsolutions.net with esmtpsa (TLS1.3:ECDHE_SECP256R1__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim 4.94) (envelope-from ) id 1lKezq-00F8hH-G7; Fri, 12 Mar 2021 11:26:18 +0100 Message-ID: <0375326f2f20dc82c056d41faee97489a1a03677.camel@sipsolutions.net> Subject: Re: [PATCH 2/6] module: add support for CONFIG_MODULE_DESTRUCTORS From: Johannes Berg To: linux-kernel@vger.kernel.org, linux-um@lists.infradead.org Cc: Jessica Yu , Alexander Viro , linux-fsdevel@vger.kernel.org Date: Fri, 12 Mar 2021 11:26:17 +0100 In-Reply-To: <20210312104627.8b2523b0593c.Ib0fb7906e3d7bd69ebe5eb877e2e9f33ef915d4b@changeid> References: <20210312095526.197739-1-johannes@sipsolutions.net> <20210312104627.8b2523b0593c.Ib0fb7906e3d7bd69ebe5eb877e2e9f33ef915d4b@changeid> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.38.4 (3.38.4-1.fc33) MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-malware-bazaar: not-scanned Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 2021-03-12 at 10:55 +0100, Johannes Berg wrote: > From: Johannes Berg > > At least in ARCH=um with CONFIG_GCOV (which writes all the > coverage data directly out from the userspace binary rather > than presenting it in debugfs) it's necessary to run all > the atexit handlers (dtors/fini_array) so that gcov actually > does write out the data. > > Add a new config option CONFIG_MODULE_DESTRUCTORS that can > be selected via CONFIG_WANT_MODULE_DESTRUCTORS that the arch > selects (this indirection exists so the architecture doesn't > have to worry about whether or not CONFIG_MODULES is on). > Additionally, the architecture must then (when it exits and > no more module code can run) call run_all_module_destructors > to run the code for all modules that are still loaded. When > modules are unloaded, the handlers are called as well. Oops, I forgot to add this bit to the patch: --- a/scripts/module.lds.S +++ b/scripts/module.lds.S @@ -16,6 +16,8 @@ SECTIONS { .init_array 0 : ALIGN(8) { *(SORT(.init_array.*)) *(.init_array) } + .fini_array 0 : ALIGN(8) { *(SORT(.fini_array.*)) *(.fini_array) } + __jump_table 0 : ALIGN(8) { KEEP(*(__jump_table)) } __patchable_function_entries : { *(__patchable_function_entries) } Should that be under the ifdef? .init_array isn't, even though it's only relevant for CONFIG_CONSTRUCTORS. johannes