[PATCH] powerpc/vdso: Mark the vDSO code read-only after init

Christophe Leroy posted 1 patch 1 year ago
arch/powerpc/kernel/vdso32_wrapper.S | 2 +-
arch/powerpc/kernel/vdso64_wrapper.S | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
[PATCH] powerpc/vdso: Mark the vDSO code read-only after init
Posted by Christophe Leroy 1 year ago
VDSO text is fixed-up during init so it can't be const,
but it can be read-only after init.

Do the same as x86 in commit 018ef8dcf3de ("x86/vdso: Mark the vDSO
code read-only after init") and arm in commit 11bf9b865898 ("ARM/vdso:
Mark the vDSO code read-only after init"), move it into
ro_after_init section.

Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
---
 arch/powerpc/kernel/vdso32_wrapper.S | 2 +-
 arch/powerpc/kernel/vdso64_wrapper.S | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/powerpc/kernel/vdso32_wrapper.S b/arch/powerpc/kernel/vdso32_wrapper.S
index 10f92f265d51..20bca3548b44 100644
--- a/arch/powerpc/kernel/vdso32_wrapper.S
+++ b/arch/powerpc/kernel/vdso32_wrapper.S
@@ -2,7 +2,7 @@
 #include <linux/linkage.h>
 #include <asm/page.h>
 
-	__PAGE_ALIGNED_DATA
+	.section ".data..ro_after_init", "aw"
 
 	.globl vdso32_start, vdso32_end
 	.balign PAGE_SIZE
diff --git a/arch/powerpc/kernel/vdso64_wrapper.S b/arch/powerpc/kernel/vdso64_wrapper.S
index 839d1a61411d..1912936fa227 100644
--- a/arch/powerpc/kernel/vdso64_wrapper.S
+++ b/arch/powerpc/kernel/vdso64_wrapper.S
@@ -2,7 +2,7 @@
 #include <linux/linkage.h>
 #include <asm/page.h>
 
-	__PAGE_ALIGNED_DATA
+	.section ".data..ro_after_init", "aw"
 
 	.globl vdso64_start, vdso64_end
 	.balign PAGE_SIZE
-- 
2.47.0
Re: [PATCH] powerpc/vdso: Mark the vDSO code read-only after init
Posted by Madhavan Srinivasan 11 months, 2 weeks ago
On Sat, 14 Dec 2024 12:09:31 +0100, Christophe Leroy wrote:
> VDSO text is fixed-up during init so it can't be const,
> but it can be read-only after init.
> 
> Do the same as x86 in commit 018ef8dcf3de ("x86/vdso: Mark the vDSO
> code read-only after init") and arm in commit 11bf9b865898 ("ARM/vdso:
> Mark the vDSO code read-only after init"), move it into
> ro_after_init section.
> 
> [...]

Applied to powerpc/next.

[1/1] powerpc/vdso: Mark the vDSO code read-only after init
      https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git/commit/?h=next&id=9fa9712644e04c4fd4de7e2d999edde3c9316823 

Thanks