From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796389499; b=W6U0lQ4WuQ2/vFpTUTYI7tQRJqgtnyWIqlZqrRePzeq1RI73Zs1fQYOjHcxg3yjnpJfB Cl2XUxloViMBU0+j3Qs58ZkLgIJIgN5SScfVktUuKN+Xmulk1rO+qxdAL67hfMN4vSB/5 hQWw8+c5/XeEH/1wfsPQ/fsA1Gjx0r3t14ubBb0iOWy6XEG9VVyD1ECgbFk07KHJ+lmvK IVaPqUW3J/HxYVHOxVbXTrOd/9b0VNwntYl5w7rh10VL7apf7qf+QhAYCfdPgHE+WRCM5 IgPpgjiiTepSv2b3HTmVZ2UsSZ80uRnzRB3MDnTZnjFRD/ITMJcM5Upzr4kvd5X6RfQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796389499; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:User-Agent:X-stable:X-Patchwork-Hint: MIME-Version:Content-Transfer-Encoding; bh=BXiWVoWTbc2kvqLNuFpQ7BNrfR0touljvem/JuxbDCY=; b=G+DTny1Tb5+9pP6YeLNX55hAEDBEaLwadZuCI6RwAkXY2afJISFzAoLEYKnhK13S28yV y725A0R0mHHX9klMWW8C93AsfZ0HpNJSj3mb4cDAxo/7pqaqJArfK8dbiSpjDcT/YVMDC 5HLnxP3tyap26GaOZhyePcA6GGxU3ozMfT4ZD/4pmzmtyMY6qmC7LDmKPQ6CbCb7E9HsR feLI6/ZiZCuyrn1/8VGWDcdj64C3kBBMBkHTKp8wNNAs8TrY7ZIyFAlX64AX0X/oCDJo0 AyCZa4brULYKoipYWOkEno0TznpWerJnxmCNQCOPOZlKQWz9WPv8Lrvefw4pHSIVrZg== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b="P/kprjBr"; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 85D22606A32C; Fri, 4 Dec 2026 13:04:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=P/kprjBr Received: by smtp.kernel.org (Postfix) with ESMTPSA id 706D51F000C2; Fri, 4 Dec 2026 13:04:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796389498; bh=BXiWVoWTbc2kvqLNuFpQ7BNrfR0touljvem/JuxbDCY=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=P/kprjBrXA2QfRWQ4vqWfu/aEpHKc/eGDB3Jj/MgPQFkTOwoFN2gm7y67it1R3Gp+ H9WZLJuNnRxxgVJrAIqiPsSCrKl1lBOR6/9BEetl7q1AJ37aLZ5FI8YgJ3mF6IpCkT tABLhYvViMFTTITb0J3wQCNZovKRBd01zOtBQUK0= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Bradley Morgan , "Christophe Leroy (CS GROUP)" , Madhavan Srinivasan Subject: [PATCH 6.1 0977/1059] powerpc32/modules: Reserve a PLT entry for ftrace_regs_caller Date: Fri, 4 Dec 2026 19:08:28 +0900 Message-ID: <20261204100709.317248622@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100643.980430235@linuxfoundation.org> References: <20261204100643.980430235@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: patches@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.1-stable review patch. If anyone has any objections, please let me know. ------------------ From: Bradley Morgan commit dc6eb6f08be536223e8289c7a8b1f515b1355721 upstream. Commit 7dfbfb87c243 ("powerpc/ftrace: Activate HAVE_DYNAMIC_FTRACE_WITH_REGS on PPC32") made count_relocs() undercount the PLT entries the loader consumes: module_finalize_ftrace() now creates two trampolines (mod->arch.tramp for ftrace_caller() and mod->arch.tramp_regs for ftrace_regs_caller()), while count_relocs() reserves only one entry for ftrace. So the core .plt ends up one ppc_plt_entry (16 bytes) short. The walk in do_plt_call() scans for a free slot with "while (entry->jump[0])" and has no bound check, so once the last reserved slot is used up, the walk steps past the end of the section and patch_instruction() writes the 4-instruction trampoline into whatever module memory follows the .plt. Count the second entry, mirroring what module_64.c does for the same pair of stubs. Signed-off-by: Bradley Morgan Fixes: 7dfbfb87c243 ("powerpc/ftrace: Activate HAVE_DYNAMIC_FTRACE_WITH_REGS on PPC32") Reviewed-by: Christophe Leroy (CS GROUP) Cc: stable@vger.kernel.org Signed-off-by: Madhavan Srinivasan Link: https://patch.msgid.link/20260923175631.235276-1-brads@mainlining.org Signed-off-by: Greg Kroah-Hartman --- arch/powerpc/kernel/module_32.c | 3 +++ 1 file changed, 3 insertions(+) --- a/arch/powerpc/kernel/module_32.c +++ b/arch/powerpc/kernel/module_32.c @@ -41,6 +41,9 @@ static unsigned int count_relocs(const E #ifdef CONFIG_DYNAMIC_FTRACE _count_relocs++; /* add one for ftrace_caller */ +#ifdef CONFIG_DYNAMIC_FTRACE_WITH_REGS + _count_relocs++; /* add one for ftrace_regs_caller */ +#endif #endif return _count_relocs; }