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 7AB981474BC; Wed, 2 Oct 2024 14:32:24 +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=1727879544; cv=none; b=SNmlfaETctjpLjSCUWnQfOMLmCPEvwx8ssM/DNPjS8E4lwnaqHhoW2Hb/ZO7xf9FkpwQhfU+X92lTiy7ooZVnbRCEIC33LaSd4fduqb/kaZ5X5Q+vGJFrsvL6CA/8HyoUyF8du89/MLTbKI3BmvX8OJgiFG4g6ei0QRkJ2f1jao= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727879544; c=relaxed/simple; bh=UKZrsZwHGKlnJ7qwLSYtmZ94gIlIb5+wWIpZ1xywPzI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=P0IGpNZHLRdge8F0m6IpvPb36XUEqOdhfWJbMNvuTkdye0KmFlezhV24FBWXa4kt5jsNlTfJTxp87+QIfY0gB12YEaULMuIwt9B4/WCDYBxDZGLUW32OE0K1ywwfQjzWBGvawDPrXN0TGBec5aSOh/r1Mi3YLxhPwfVc+6P3GSo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=aqBa0VvJ; 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="aqBa0VvJ" Received: by smtp.kernel.org (Postfix) with ESMTPSA id AC253C4CEC2; Wed, 2 Oct 2024 14:32:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1727879544; bh=UKZrsZwHGKlnJ7qwLSYtmZ94gIlIb5+wWIpZ1xywPzI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aqBa0VvJAgxalgGV1FWoA6Dj6fx8yqoaqvugsJNQrxcJD+RA7nZ1jwbmrQem8xoV9 cC/XXMQlnyoAJ+yGilnPMA/YMYi3J1GwMzD38ad8Qfl0KzUbckdJzk2Y/fOXbjNSOg 0EDuDwCJL49z7fccB3g7RlUDnjecRYfr+JN/gwis= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Christophe Leroy , Michael Ellerman , Sasha Levin Subject: [PATCH 6.6 155/538] powerpc/8xx: Fix initial memory mapping Date: Wed, 2 Oct 2024 14:56:34 +0200 Message-ID: <20241002125758.372673243@linuxfoundation.org> X-Mailer: git-send-email 2.46.2 In-Reply-To: <20241002125751.964700919@linuxfoundation.org> References: <20241002125751.964700919@linuxfoundation.org> User-Agent: quilt/0.67 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: Christophe Leroy [ Upstream commit f9f2bff64c2f0dbee57be3d8c2741357ad3d05e6 ] Commit cf209951fa7f ("powerpc/8xx: Map linear memory with huge pages") introduced an initial mapping of kernel TEXT using PAGE_KERNEL_TEXT, but the pages that contain kernel TEXT may also contain kernel RODATA, and depending on selected debug options PAGE_KERNEL_TEXT may be either RWX or ROX. RODATA must be writable during init because it also contains ro_after_init data. So use PAGE_KERNEL_X instead to be sure it is RWX. Fixes: cf209951fa7f ("powerpc/8xx: Map linear memory with huge pages") Signed-off-by: Christophe Leroy Signed-off-by: Michael Ellerman Link: https://msgid.link/dac7a828d8497c4548c91840575a706657baa4f1.1724173828.git.christophe.leroy@csgroup.eu Signed-off-by: Sasha Levin --- arch/powerpc/mm/nohash/8xx.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/powerpc/mm/nohash/8xx.c b/arch/powerpc/mm/nohash/8xx.c index 3245016302787..a947dff35d651 100644 --- a/arch/powerpc/mm/nohash/8xx.c +++ b/arch/powerpc/mm/nohash/8xx.c @@ -149,11 +149,11 @@ unsigned long __init mmu_mapin_ram(unsigned long base, unsigned long top) mmu_mapin_immr(); - mmu_mapin_ram_chunk(0, boundary, PAGE_KERNEL_TEXT, true); + mmu_mapin_ram_chunk(0, boundary, PAGE_KERNEL_X, true); if (debug_pagealloc_enabled_or_kfence()) { top = boundary; } else { - mmu_mapin_ram_chunk(boundary, einittext8, PAGE_KERNEL_TEXT, true); + mmu_mapin_ram_chunk(boundary, einittext8, PAGE_KERNEL_X, true); mmu_mapin_ram_chunk(einittext8, top, PAGE_KERNEL, true); } -- 2.43.0