Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp680011pxj; Fri, 14 May 2021 12:56:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz+/G7Ybp3YDKmo3pNZMVR6ujL307YEjU3JPCwKyeImsA6fd+Ijx2aCjIE86NT7O1mrZFRq X-Received: by 2002:a02:662b:: with SMTP id k43mr43647173jac.139.1621022198343; Fri, 14 May 2021 12:56:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621022198; cv=none; d=google.com; s=arc-20160816; b=Fa10GRyFsj/UesvsMKC09jfn3TMyuHYh4Zef2woj4jHuFmslXnnUrrKh8YY1mOM43P fheYltUKM18nPyFBpfWOaDWKSIntjFp+blgJLTf9n/9Hsnn6UnQPGNq/GiOpgf4gC8kx ynvkbAvzgaG5XTAx8uF/Z2f2oxMkdoOhOIPvHu6LciS5IcWvOt2CGrIiVrHBFq1aeT6G 5oJJPb+unzEbh3T1UN4ajg0VGSVbdnTFnMRV4nLAxHyf0YOV8/ZKIvLkcqCALWmgxLmL 7a0edsCO3fEGIWAzA4U0aYQ2UxRtvKKq3XzwpH8eFOewdPkuYQI3sPz2Q6Ao4BkE85KM lP8g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=O2WwZG5UT0TfHcCm0KHfCmgki4wkc4NSDE9GZOtTDBw=; b=EyKFv9tAGpTjRbCZbjqbqqweTPNkoI5/AIGeng9kfHBorSa6Sd8I7jOky+gxEeLBBt zHLnny7fI8e6+iNDir51sjmPRmumXi3s1eJ+p+NO5r4glbneDQH/NI/pFQO/XnG/e5ss Jb6kXSZAcJ3OIwabF3YaqBa7X06EIECcL5N4HMWI366TJAhQT4PgVZyntGFEp2O2LeZi r4QKT7u3gPQqDpn+TNxQVIp6fFJOdJrwFzXJw7mZw7MYn24WKc+IPIrvCsFz2gckGgE4 s1niTLkmbq2tYtkIMC1W29JLSRGpUyx12B22VSkvVma33Rf8F+MttogKZQkkJ/e3AZF+ 2KbA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail (test mode) header.i=@armlinux.org.uk header.s=pandora-2019 header.b=TF233q9q; 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=fail (p=NONE sp=NONE dis=NONE) header.from=armlinux.org.uk Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id q4si8243826jas.111.2021.05.14.12.56.25; Fri, 14 May 2021 12:56:38 -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=fail (test mode) header.i=@armlinux.org.uk header.s=pandora-2019 header.b=TF233q9q; 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=fail (p=NONE sp=NONE dis=NONE) header.from=armlinux.org.uk Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235089AbhENRKy (ORCPT + 99 others); Fri, 14 May 2021 13:10:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60294 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230063AbhENRKy (ORCPT ); Fri, 14 May 2021 13:10:54 -0400 Received: from pandora.armlinux.org.uk (pandora.armlinux.org.uk [IPv6:2001:4d48:ad52:32c8:5054:ff:fe00:142]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A2562C061574 for ; Fri, 14 May 2021 10:09:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2019; h=Sender:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=O2WwZG5UT0TfHcCm0KHfCmgki4wkc4NSDE9GZOtTDBw=; b=TF233q9qLO0O68foj6C8iQwRL pUyQ1GTm2Et4Zh4ATAmKIqFs8jp3NVXUsWYBojTUb2hwhceKKM0FXl91o+68ZC4A/h+umOZZwbDVy HsJCpUAhscY2gYpqmpMipKsfNzjnC2LmJo4mM+pxPp+KEzNRBHcLSrUiNCOP9Y1/H+CObRRCqA+oG 7cKHeQ8KXbZs8yZaN+xRdARUTtBiBSqvCy6aU27Tqh8UaNtil1RcMnjXBiUpfNwf0ZHOIiQH5vT1L 4lyCvCTivpisjnxaFOiCHqaDpwrI8+6thMsRIbpIvbLzV2EMzSTXOGhTKJ1xMDiFfDFgqzrphh4In j6SNJyRCw==; Received: from shell.armlinux.org.uk ([fd8f:7570:feb6:1:5054:ff:fe00:4ec]:43974) by pandora.armlinux.org.uk with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lhbJb-0008UZ-JT; Fri, 14 May 2021 18:09:31 +0100 Received: from linux by shell.armlinux.org.uk with local (Exim 4.92) (envelope-from ) id 1lhbJa-0004AI-Ad; Fri, 14 May 2021 18:09:30 +0100 Date: Fri, 14 May 2021 18:09:30 +0100 From: "Russell King (Oracle)" To: Jessica Yu Cc: linux-kernel@vger.kernel.org, Peter Zijlstra Subject: Re: [PATCH v2] module: check for exit sections in layout_sections() instead of module_init_section() Message-ID: <20210514170930.GE12395@shell.armlinux.org.uk> References: <20210514160904.21989-1-jeyu@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210514160904.21989-1-jeyu@kernel.org> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: Russell King (Oracle) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, May 14, 2021 at 06:09:04PM +0200, Jessica Yu wrote: > Previously, when CONFIG_MODULE_UNLOAD=n, the module loader just does not > attempt to load exit sections since it never expects that any code in those > sections will ever execute. However, dynamic code patching (alternatives, > jump_label and static_call) can have sites in __exit code, even if __exit is > never executed. Therefore __exit must be present at runtime, at least for as > long as __init code is. > > Commit 33121347fb1c ("module: treat exit sections the same as init > sections when !CONFIG_MODULE_UNLOAD") solves the requirements of > jump_labels and static_calls by putting the exit sections in the init > region of the module so that they are at least present at init, and > discarded afterwards. It does this by including a check for exit > sections in module_init_section(), so that it also returns true for exit > sections, and the module loader will automatically sort them in the init > region of the module. > > However, the solution there was not completely arch-independent. ARM is > a special case where it supplies its own module_{init, exit}_section() > functions. Instead of pushing the exit section checks into > module_init_section(), just implement the exit section check in > layout_sections(), so that we don't have to touch arch-dependent code. > > Fixes: 33121347fb1c ("module: treat exit sections the same as init sections when !CONFIG_MODULE_UNLOAD") > Signed-off-by: Jessica Yu Looks good! Reviewed-by: Russell King (Oracle) Thanks! -- RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!