From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5FDA42EFDBD; Thu, 3 Jul 2025 15:10:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751555445; cv=none; b=DPJZ0mHytdtqYLDHIZJhrcTV9ki4LpVW5+gng5buDOpaBW+O0lI5RTCMY2yPitWRAxiFYOYeoUYMFDaUGoMCB6hvuEz+4akET6YOFWL7ggjB9IPA6HKaNFT2bECb4nvvqGTULuFjMvsKad9sBixwHMynY5dDDqH2aL9Bv6HIAds= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751555445; c=relaxed/simple; bh=F1d2qU9NhdMQI8txaQlAn8YifHyYHjqUf47rRK/nRWo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=DOtnujdDFxpOGHOptPGLSpWnx9TzwMcdwbpuSbuNEUwEX7mRqXGmuZ5gl2xMDpH9zy6FTXWh+6AVqVDmgNr59SkLHARAu7T4GEuvxATM+kL5iqTjbbDkL6nT3eTYBpqQpDQtXxh0hLnxeJS3qXPc6tMb316ECv5CbptlgGy09jc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=jMroLGef; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="jMroLGef" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 93AC2C4CEE3; Thu, 3 Jul 2025 15:10:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1751555444; bh=F1d2qU9NhdMQI8txaQlAn8YifHyYHjqUf47rRK/nRWo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jMroLGefFffMp2iJhvQiSNR3qJYVhZFGuGeEJxmNSVV7DppzlRtxrcJNxI1Njmju6 pFn0D95AV+p87vShhNKS4fyvfLUPS32RQbTNAPkFBLF2jls5Gd9eNsVKO03wP4n1GU AyEVB4ohezaAFE614EWRs3xw6Flg366QtihgD4Bg= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, FUJITA Tomonori , Jarkko Sakkinen , Miguel Ojeda , Sasha Levin Subject: [PATCH 6.6 016/139] rust: module: place cleanup_module() in .exit.text section Date: Thu, 3 Jul 2025 16:41:19 +0200 Message-ID: <20250703143941.813026063@linuxfoundation.org> X-Mailer: git-send-email 2.50.0 In-Reply-To: <20250703143941.182414597@linuxfoundation.org> References: <20250703143941.182414597@linuxfoundation.org> User-Agent: quilt/0.68 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.6-stable review patch. If anyone has any objections, please let me know. ------------------ From: FUJITA Tomonori [ Upstream commit 249c3a0e53acefc2b06d3b3e1fc28fb2081f878d ] Place cleanup_module() in .exit.text section. Currently, cleanup_module() is likely placed in the .text section. It's inconsistent with the layout of C modules, where cleanup_module() is placed in .exit.text. [ Boqun asked for an example of how the section changed to be put in the log. Tomonori provided the following examples: C module: $ objdump -t ~/build/x86/drivers/block/loop.o|grep clean 0000000000000000 l O .exit.data 0000000000000008 __UNIQUE_ID___addressable_cleanup_module412 0000000000000000 g F .exit.text 000000000000009c cleanup_module Rust module without this patch: $ objdump -t ~/build/x86/samples/rust/rust_minimal.o|grep clean 00000000000002b0 g F .text 00000000000000c6 cleanup_module 0000000000000000 g O .exit.data 0000000000000008 _R...___UNIQUE_ID___addressable_cleanup_module Rust module with this patch: $ objdump -t ~/build/x86/samples/rust/rust_minimal.o|grep clean 0000000000000000 g F .exit.text 00000000000000c6 cleanup_module 0000000000000000 g O .exit.data 0000000000000008 _R...___UNIQUE_ID___addressable_cleanup_module - Miguel ] Signed-off-by: FUJITA Tomonori Acked-by: Jarkko Sakkinen Link: https://lore.kernel.org/r/20250308044506.14458-1-fujita.tomonori@gmail.com Signed-off-by: Miguel Ojeda Signed-off-by: Sasha Levin --- rust/macros/module.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/rust/macros/module.rs b/rust/macros/module.rs index 7dee348ef0cc8..7614a7198ce20 100644 --- a/rust/macros/module.rs +++ b/rust/macros/module.rs @@ -249,6 +249,7 @@ pub(crate) fn module(ts: TokenStream) -> TokenStream { #[cfg(MODULE)] #[doc(hidden)] #[no_mangle] + #[link_section = \".exit.text\"] pub extern \"C\" fn cleanup_module() {{ // SAFETY: // - This function is inaccessible to the outside due to the double -- 2.39.5