FAILED: patch "[PATCH] powerpc/8xx: Fix STRICT_KERNEL_RWX startup test failure" failed to apply to 5.4-stable tree
Subsystems (2)
[email protected]
maintainerThe patch below does not apply to the 5.4-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From b61c38baa98056d4802ff5be5cfb979efc2d0f7a Mon Sep 17 00:00:00 2001
From: Christophe Leroy <[email protected]>
Date: Mon, 20 Apr 2020 05:37:42 +0000
Subject: [PATCH] powerpc/8xx: Fix STRICT_KERNEL_RWX startup test failure
WRITE_RO lkdtm test works.
But when selecting CONFIG_DEBUG_RODATA_TEST, the kernel reports
rodata_test: test data was not read only
This is because when rodata test runs, there are still old entries in TLB.
Flush TLB after setting kernel pages RO or NX.
arch/powerpc/mm/nohash/8xx.c +3 -0
@@ -185,6 +185,7 @@ void mmu_mark_initmem_nx(void)mmu_mapin_ram_chunk (etext8, einittext8,PAGE_KERNEL ); } } +_tlbil_all (); }#ifdef CONFIG_STRICT_KERNEL_RWX
@@ -199,6 +200,8 @@ void mmu_mark_rodata_ro(void) ~(LARGE_PAGE_SIZE_8M - 1)));mmu_patch_addis (&patch__dtlbmiss_romem_top, -__pa (_sinittext)); +_tlbil_all (); +/* Update page tables for PTDUMP and BDI */ mmu_mapin_ram_chunk (0 , sinittext,__pgprot (0 ));mmu_mapin_ram_chunk (0 , etext,PAGE_KERNEL_ROX );