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 A5B9829CE7; Wed, 2 Oct 2024 13:31:25 +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=1727875885; cv=none; b=STzdHG6lTeH+Qq/CSpDaxdGDBWnxBZ+mMSVYMXH8SQodwl6l+fYwroh1Ezez16iVSWjmH+LNtoKkfkff+TB+nmb2khWQJrcg9kXHV5rt+IrDqNxbVuzlIlyTIZ7mKg9A52xoPDBKQOCx03ZW3+wEi+isDIEDmyRglwK6gX7tzYE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727875885; c=relaxed/simple; bh=KKiLTEID2XNUwJInraLyZw2yV+YLKSoozWy6Fk1RbF4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=pbLZ2a7zKJtBYd32bPiFw8W+8Yb7O/h4vT+rnYWUYE+yPbpAYkjQdy0QHkiRpEib1sfcEnXivFFWj0528SY4vZczSeylah5Fnlkw5csN5jGO3nCgcS93je5cWJRG+jmmTEf0bi92ZFOmyI1l1U8WtqrnbHb3VMQMQbNLYkjk+74= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=QDK++Yi5; 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="QDK++Yi5" Received: by smtp.kernel.org (Postfix) with ESMTPSA id D91F4C4CEC5; Wed, 2 Oct 2024 13:31:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1727875885; bh=KKiLTEID2XNUwJInraLyZw2yV+YLKSoozWy6Fk1RbF4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QDK++Yi59F9Jsr2z/X/vuaGY970FkdrddXv5ymD3ySYPXIo0Yehlm+sHP8CXaEQMK 0cimEU+/4fdh2zUkShgCGa0WmeBgiQO3osrQnhO0GN5QErG5+a64Lj3d5LtLvOse2S vHLYVQJcxhyYB971F8DdmmA3rUfhOr+vSRwHXp20= 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.11 223/695] powerpc/8xx: Fix initial memory mapping Date: Wed, 2 Oct 2024 14:53:41 +0200 Message-ID: <20241002125831.358698513@linuxfoundation.org> X-Mailer: git-send-email 2.46.2 In-Reply-To: <20241002125822.467776898@linuxfoundation.org> References: <20241002125822.467776898@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.11-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 388bba0ab3e7d..15d918dce27d0 100644 --- a/arch/powerpc/mm/nohash/8xx.c +++ b/arch/powerpc/mm/nohash/8xx.c @@ -150,11 +150,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