From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.0 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B309AC433ED for ; Fri, 7 May 2021 12:31:04 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6C6996145E for ; Fri, 7 May 2021 12:31:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236685AbhEGMcC (ORCPT ); Fri, 7 May 2021 08:32:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58472 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233468AbhEGMcB (ORCPT ); Fri, 7 May 2021 08:32:01 -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 48F82C061574 for ; Fri, 7 May 2021 05:31:00 -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=B4OtqkGn285R60YiVqH6q3onTS7Lt7KKKKLOjRmOeV4=; b=ZVM8/wMyekdiVYbyNXTg1uy4i Jl9IXPuzvxmeenmYLQI3/GzdtqOmodJRHf3id3FjDcg0GLbXtEyCBabEt7NX8KPj1fc3wRhfdH7/b pDaOUqdSLBtQ6Hc+sESBUbdYJYuIIwCBjv39DEa8RxSA51brI5orDHfPHCVTGPuQ/H+dEgfhfyJ+s cOvWVc6JVxK6B85MVUKbK9YrNll44QU623fa3W3oYDP97SzMAUoBe9VciVWx4RSPWRCX2vgc2z5yV faklLezAiSxTrdHCXSGc22xLy5WZtprqEgqqdnUx3QVJLiekKU+0B/MFqp7iQK1GHnFSdbxcoY/MT zuuAASpAg==; Received: from shell.armlinux.org.uk ([fd8f:7570:feb6:1:5054:ff:fe00:4ec]:43756) by pandora.armlinux.org.uk with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lezdA-0003iW-2O; Fri, 07 May 2021 13:30:56 +0100 Received: from linux by shell.armlinux.org.uk with local (Exim 4.92) (envelope-from ) id 1lezd9-0005lq-GX; Fri, 07 May 2021 13:30:55 +0100 Date: Fri, 7 May 2021 13:30:55 +0100 From: Russell King - ARM Linux admin To: Jessica Yu Cc: Peter Zijlstra , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] ARM: module: treat exit sections the same as init sections when !CONFIG_MODULE_UNLOAD Message-ID: <20210507123054.GD1336@shell.armlinux.org.uk> References: <20210507121322.6441-1-jeyu@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210507121322.6441-1-jeyu@kernel.org> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: Russell King - ARM Linux admin Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, May 07, 2021 at 02:13:22PM +0200, Jessica Yu wrote: > 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. ... > Previously, the module loader never loaded the exit sections in the first > place when CONFIG_MODULE_UNLOAD=n. Commit 33121347fb1c ("module: treat exit > sections the same as init sections when !CONFIG_MODULE_UNLOAD") addressed > the issue by having the module loader load the exit sections and then making > __exit identify as __init for !MODULE_UNLOAD. Then, since they are treated > like init sections, they will be also discarded after init. > > That commit satisfied the above requirements for jump_labels and > static_calls by modifying the checks in the core module_init_section() > function in kernel/module.c to include exit sections. However, ARM > overrides these and implements their own module_{init,exit}_section() > functions. Add a similar check for exit sections to ARM's > module_init_section() function so that all arches are on the same page. Shouldn't the module core code itself be doing: module_init_section(name) || module_exit_section(name) itself when CONFIG_MODULE_UNLOAD is not set, rather than pushing this logic down into every module_init_section() implementation? -- RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last! From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.9 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 44850C433B4 for ; Fri, 7 May 2021 12:34:37 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 959856145D for ; Fri, 7 May 2021 12:34:36 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 959856145D Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=armlinux.org.uk Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References:Message-ID: Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=eUl+LreaftWhvkRX3iLoR4Ufha7opOd/t3drq82yyqA=; b=TAWdu8OI+3yfPhL8HgBqMJXXT dc9jJe3o4CAvcZ06kSrTYFPehJQ1wZkX6EBJdyjk6qhOzrRxgmOhDoB6sETYs2uHAy2f87dK2QW9P tN9YZCjU8U04N0mnIXkNwunUikhNDQOX2EfdxMi44liGm09Yt0nioHMW56QUXq93D7z8csxZ48j65 aHcxSI2pVFRrd3g++XEI5SXGFwwhnE10JMM3Bv+wcBHxBa4546X+JA3JBh8+TYZV/tpJ0zv2V9pXK gp8ss/Z6G3k4NUzLOx2hJJO6OiTqYOaNkTN/imHzdQfC0e1FXBJPQnNs3bbL7H/WeFxfn1j8aJxIe EBsHYqzMA==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lezfI-0073fg-PF; Fri, 07 May 2021 12:33:09 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lezfE-0073fL-EQ for linux-arm-kernel@desiato.infradead.org; Fri, 07 May 2021 12:33:04 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; 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; bh=B4OtqkGn285R60YiVqH6q3onTS7Lt7KKKKLOjRmOeV4=; b=vdBcy4BsBOwtmFGm4HvmsXh5lq Nxn/PqW0JVWr7u+RcByoMsyBKfGxvGwBIx6MpO9ojMSTQtIA+5lGIHnpc26rGsf9hU1fcPs73sRwa 5lcDoaGNFwJ0zXWD/0IrgIwVZJowgwSM7VyPKpr0fvejvlO6xiKBhAqjZQ1kylAwVesVBXeGdmed4 OME1unyA3iqAMTpYboLsSRR8VUY5MCF8hrg56MpUOgZmc/YR7hjgiqRuheXvkM91/0zIX86XbAcGC qB/hDoSnvnzIMjVb5TtoRS2jswsNW4aWDItW5kCy1xVCGIDKyBQ3xFVQKTD8Sy3Vd0P0EKvldQv85 0iHzW8OA==; Received: from pandora.armlinux.org.uk ([2001:4d48:ad52:32c8:5054:ff:fe00:142]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lezfB-006qqs-Ow for linux-arm-kernel@lists.infradead.org; Fri, 07 May 2021 12:33:03 +0000 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=B4OtqkGn285R60YiVqH6q3onTS7Lt7KKKKLOjRmOeV4=; b=ZVM8/wMyekdiVYbyNXTg1uy4i Jl9IXPuzvxmeenmYLQI3/GzdtqOmodJRHf3id3FjDcg0GLbXtEyCBabEt7NX8KPj1fc3wRhfdH7/b pDaOUqdSLBtQ6Hc+sESBUbdYJYuIIwCBjv39DEa8RxSA51brI5orDHfPHCVTGPuQ/H+dEgfhfyJ+s cOvWVc6JVxK6B85MVUKbK9YrNll44QU623fa3W3oYDP97SzMAUoBe9VciVWx4RSPWRCX2vgc2z5yV faklLezAiSxTrdHCXSGc22xLy5WZtprqEgqqdnUx3QVJLiekKU+0B/MFqp7iQK1GHnFSdbxcoY/MT zuuAASpAg==; Received: from shell.armlinux.org.uk ([fd8f:7570:feb6:1:5054:ff:fe00:4ec]:43756) by pandora.armlinux.org.uk with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lezdA-0003iW-2O; Fri, 07 May 2021 13:30:56 +0100 Received: from linux by shell.armlinux.org.uk with local (Exim 4.92) (envelope-from ) id 1lezd9-0005lq-GX; Fri, 07 May 2021 13:30:55 +0100 Date: Fri, 7 May 2021 13:30:55 +0100 From: Russell King - ARM Linux admin To: Jessica Yu Cc: Peter Zijlstra , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] ARM: module: treat exit sections the same as init sections when !CONFIG_MODULE_UNLOAD Message-ID: <20210507123054.GD1336@shell.armlinux.org.uk> References: <20210507121322.6441-1-jeyu@kernel.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20210507121322.6441-1-jeyu@kernel.org> User-Agent: Mutt/1.10.1 (2018-07-13) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210507_053301_823073_985966E0 X-CRM114-Status: GOOD ( 16.10 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Fri, May 07, 2021 at 02:13:22PM +0200, Jessica Yu wrote: > 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. ... > Previously, the module loader never loaded the exit sections in the first > place when CONFIG_MODULE_UNLOAD=n. Commit 33121347fb1c ("module: treat exit > sections the same as init sections when !CONFIG_MODULE_UNLOAD") addressed > the issue by having the module loader load the exit sections and then making > __exit identify as __init for !MODULE_UNLOAD. Then, since they are treated > like init sections, they will be also discarded after init. > > That commit satisfied the above requirements for jump_labels and > static_calls by modifying the checks in the core module_init_section() > function in kernel/module.c to include exit sections. However, ARM > overrides these and implements their own module_{init,exit}_section() > functions. Add a similar check for exit sections to ARM's > module_init_section() function so that all arches are on the same page. Shouldn't the module core code itself be doing: module_init_section(name) || module_exit_section(name) itself when CONFIG_MODULE_UNLOAD is not set, rather than pushing this logic down into every module_init_section() implementation? -- RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last! _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel