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=1796383956; b=vc3vYEhL89aLMl+aDC0Lsnmv+AI8roHZAWtHtqWzLDm4VQzMHzE5DOnIcOxx7hcacGql 7WHL34Z7PWWR/IvmUDi8DL2wAA+Pm7cnRDe8W9Tg3FdsWZgFVsj5OI7aMRaKXs0DQc0Ev 0wcShGkTcFPRKOdCmf6z01u7v8xxzqTGc1scQSj7/AfldnfEK5+LNUbTMBWLA5/XA8EXq 71PA1aeRUn8qQ/54DHO6oyufk7tUuoZu/uvNhxUSmuqdzXzbelWpH9VQ3oFhA58Cv8Z9K dAUKdgT2zsFN/iBzGZFuUgXRTIqZ0pVDd97lVFi8uctBTohK7HTqSk1H3BHR+jWSQqA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796383956; 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=TjBOdFhORatN6/mjTGbSLQvh809BZA40liJ3GPqRyr8=; b=HmBtg1kRWGhF8f3snJUGd7KTMYjkIbwYjrj6C/kasfigfrIZzc/jgL/oTOVtX0QBqXoQ OVYuhy4UMfPWf8Gmv4V/ipwypMcxpCV39AvTS4HUUStrpHi8J/ECpxrUPNRoMCWmW/PDO L/Qj+avFNvcL/sRxkSp3IGo10rQ9IduF7F3eDDDPRxubC++MuZsG13WsP3cCHDrUqlSaE 3+Mry8qWu3mt+XexbFbS4j3WC54UJ7bYixRMjC+8aNUrGbPDXqBf6sKlm6WBlAZX+YUiI iElFxZBp80ohRs5QEDuZHkWT75UVROV+LLhwwovqZ0Y14YKWfb38Ou1NILZSNfVM+SQ== 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=z62U63tP; 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 1B317606A339; Fri, 4 Dec 2026 11:32:36 +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=z62U63tP Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4E3A01F0092C; Fri, 4 Dec 2026 11:32:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796383955; bh=TjBOdFhORatN6/mjTGbSLQvh809BZA40liJ3GPqRyr8=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=z62U63tPdLkfuVCxHniXUiIOHElGQ1cZubgPnAVRCYdUbebQhz5TIFwTTEmwSmOxo 5Z9DM26NfdA+NXQzLjRCB02V+4GtQviCfRxmI/oERErH/em3dRb+wQ7uXKuEn4Y+Ih T+iCf7ssTyYFaTdRaePHJf7QDa+JZ2utDxg/Dny8= 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.12 436/555] powerpc32/modules: Reserve a PLT entry for ftrace_regs_caller Date: Fri, 4 Dec 2026 19:07:59 +0900 Message-ID: <20261204100626.191268342@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100603.988357525@linuxfoundation.org> References: <20261204100603.988357525@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: stable@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.12-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; }