linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Heiko Carstens <heiko.carstens@de.ibm.com>
From: Heiko Carstens <heiko.carstens@de.ibm.com>
To: linux-mm@kvack.org
Cc: Carsten Otte <cotte@de.ibm.com>,
	Martin Schwidefsky <schwidefsky@de.ibm.com>,
	KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Subject: [PATCH/RFC 3/5] make rodata section read-only again
Date: Mon, 4 Dec 2006 14:39:34 +0100	[thread overview]
Message-ID: <20061204133934.GE9209@osiris.boeblingen.de.ibm.com> (raw)
In-Reply-To: <20061204133132.GB9209@osiris.boeblingen.de.ibm.com>

Make sure the rodata section is read only again.

Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
---
 arch/s390/mm/init.c |   21 +++++++++++++++++++++
 1 files changed, 21 insertions(+)

Index: linux-2.6.19-rc6-mm2/arch/s390/mm/init.c
===================================================================
--- linux-2.6.19-rc6-mm2.orig/arch/s390/mm/init.c
+++ linux-2.6.19-rc6-mm2/arch/s390/mm/init.c
@@ -84,6 +84,26 @@ void show_mem(void)
         printk("%d pages swap cached\n",cached);
 }
 
+static __init void setup_ro_region(void)
+{
+	pgd_t *pgd;
+	pmd_t *pmd;
+	pte_t *pte;
+	pte_t new_pte;
+	unsigned long address, end;
+
+	address = ((unsigned long)&__start_rodata) & PAGE_MASK;
+	end = PFN_ALIGN((unsigned long)&__end_rodata);
+
+	for (; address < end; address += PAGE_SIZE) {
+		pgd = pgd_offset_k(address);
+		pmd = pmd_offset(pgd, address);
+		pte = pte_offset_kernel(pmd, address);
+		new_pte = mk_pte_phys(address, __pgprot(_PAGE_RO));
+		set_pte(pte, new_pte);
+	}
+}
+
 extern unsigned long __initdata zholes_size[];
 extern void vmem_map_init(void);
 /*
@@ -110,6 +130,7 @@ void __init paging_init(void)
 		pmd_clear((pmd_t *)(pg_dir + i));
 #endif
 	vmem_map_init();
+	setup_ro_region();
 
 	S390_lowcore.kernel_asce = pgdir_k;
 

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  parent reply	other threads:[~2006-12-04 13:39 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-12-04 13:31 [PATCH/RFC 0/5] vmemmap for s390 take 2 Heiko Carstens
2006-12-04 13:35 ` [PATCH/RFC 1/5] Memory detection fixes Heiko Carstens, Heiko Carstens
2006-12-04 13:36 ` [PATCH/RFC 2/5] basic vmemmap support Heiko Carstens, Heiko Carstens
2006-12-04 13:39 ` Heiko Carstens, Heiko Carstens [this message]
2006-12-04 13:40 ` [PATCH/RFC 4/5] vmem shared memory hotplug support Heiko Carstens, Heiko Carstens
2006-12-04 13:46   ` Heiko Carstens
2006-12-04 13:41 ` [PATCH/RFC 5/5] convert extmem to new interface Heiko Carstens, Heiko Carstens

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20061204133934.GE9209@osiris.boeblingen.de.ibm.com \
    --to=heiko.carstens@de.ibm.com \
    --cc=cotte@de.ibm.com \
    --cc=kamezawa.hiroyu@jp.fujitsu.com \
    --cc=linux-mm@kvack.org \
    --cc=schwidefsky@de.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox