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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 02001C83F32 for ; Thu, 31 Aug 2023 11:12:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346078AbjHaLMY (ORCPT ); Thu, 31 Aug 2023 07:12:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42144 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345956AbjHaLMW (ORCPT ); Thu, 31 Aug 2023 07:12:22 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B9C1DCFF for ; Thu, 31 Aug 2023 04:12:02 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 9B11A63BED for ; Thu, 31 Aug 2023 11:12:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 81E3FC433B7; Thu, 31 Aug 2023 11:12:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1693480322; bh=LQmF+6tqDC2r3iKIkFnEpyDfbYJoWXBAZz4pEd03Inc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=q6hYo5crzcE9dZaS83KwdrskTAi3plDCwIiJ/dVgTMjOiEG+3jM4C1EXL+fuBZXsR CPU76cIXT0p8iwqtXx0DaL/wdQ0C4ayKed97lPWT5vFuG+ZSRD7heWCtg4nbwslXHJ jhjOgP/1VZtf7FaORsjCZuniaMt29BDWx5t7C148= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, James Morse , Luis Chamberlain Subject: [PATCH 6.1 05/10] ARM: module: Use module_init_layout_section() to spot init sections Date: Thu, 31 Aug 2023 13:10:45 +0200 Message-ID: <20230831110831.269371954@linuxfoundation.org> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20230831110831.079963475@linuxfoundation.org> References: <20230831110831.079963475@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org 6.1-stable review patch. If anyone has any objections, please let me know. ------------------ From: James Morse commit a6846234f45801441f0e31a8b37f901ef0abd2df upstream. Today module_frob_arch_sections() spots init sections from their 'init' prefix, and uses this to keep the init PLTs separate from the rest. get_module_plt() uses within_module_init() to determine if a location is in the init text or not, but this depends on whether core code thought this was an init section. Naturally the logic is different. module_init_layout_section() groups the init and exit text together if module unloading is disabled, as the exit code will never run. The result is kernels with this configuration can't load all their modules because there are not enough PLTs for the combined init+exit section. A previous patch exposed module_init_layout_section(), use that so the logic is the same. Fixes: 055f23b74b20 ("module: check for exit sections in layout_sections() instead of module_init_section()") Cc: stable@vger.kernel.org Signed-off-by: James Morse Signed-off-by: Luis Chamberlain Signed-off-by: Greg Kroah-Hartman --- arch/arm/kernel/module-plts.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/arch/arm/kernel/module-plts.c +++ b/arch/arm/kernel/module-plts.c @@ -256,7 +256,7 @@ int module_frob_arch_sections(Elf_Ehdr * /* sort by type and symbol index */ sort(rels, numrels, sizeof(Elf32_Rel), cmp_rel, NULL); - if (strncmp(secstrings + dstsec->sh_name, ".init", 5) != 0) + if (!module_init_layout_section(secstrings + dstsec->sh_name)) core_plts += count_plts(syms, dstsec->sh_addr, rels, numrels, s->sh_info); else