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=1796382562; b=Bl8qb6oZ0AjA5mMHKeDTX8EsFmve8L3WO5mrFc3pEgLIhYbUnOZa+KJpcE5j5g3xu7Wz t56FmuOdnFUlXqBgnyCY2V+2ucwv++bZD5I8j/LKvuZPXvbWjFvyskz1oArxRoPYHZZcn /t68LXg+4El7xxWaXEO+QXEeFHDaanc/xEZl3O6eFsh4wJYMa6aCZf4SjPTbkos1aEATq Tf6+nluSroaNBwa84v8+VjFgUMf08zJJklE67uDso6ih5GPkv6UAWmrx0X5AdMbnJWNNl 43BBb2MNyjzrkeiwjbrUhs79EAmsUb5fJShFS2RwWtMGFVsxwIHFp3oHvHupUMuPprw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796382562; 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=l58Fvesbztyfd/HOcqaMrXWiNX+/uhSX2dTnYpJD8I8=; b=IjFgBg6RqbKudm+BftJsu4dkP8Y1YbkijhvI/OxQ2oNXWKT9HFmVhDfs6VKf30laMMGG qEzl1SW2JgcblbAlg1z/AIeRszuT9oBN01baPvKMqmgUFcaLHcqdDCtz/+90NomI3BZXS O80QSyzP5epJdJaFih+8TFFWq4l/kFftzt8h65C+NPkpjmciRfD8Keq6QaXIePLxPj9uk teR24Zik8ZXY2K5KvbFUREk/EoLywUvHxUXxCCDHCOLA8DaZu4Dx2sFiaQ4PUnDipsnnx OGTDO+GafxaLEZDm3e6l1tS3uyKmF/+KYDHEjntoQfI3fmSjssI/SPN1H6RgzEv04RQ== 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=LwzgOkH2; 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 BDBEC606A333; Fri, 4 Dec 2026 11:09:22 +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=LwzgOkH2 Received: by smtp.kernel.org (Postfix) with ESMTPSA id DCD621F00897; Fri, 4 Dec 2026 11:09:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796382562; bh=l58Fvesbztyfd/HOcqaMrXWiNX+/uhSX2dTnYpJD8I8=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=LwzgOkH23hv17/qOe/ycTb+ijy2pEMyOjzQdHbkmzOdLW7+Z00LDb2KKFe/plnu64 N7NToAj3mI17vZiVH4YiO3OuHbALLtyjkY36vd1pzsybCPMdWYBQJGJb6EL+qx+nvB 84wBLv/fdaxOsnmi5AvTiVmv4LmmHRk7/In5iIeE= 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.18 508/703] powerpc32/modules: Reserve a PLT entry for ftrace_regs_caller Date: Fri, 4 Dec 2026 19:06:47 +0900 Message-ID: <20261204100641.311511456@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100627.522266145@linuxfoundation.org> References: <20261204100627.522266145@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.18-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; }