Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4e4eee0e authored by Mathieu Desnoyers's avatar Mathieu Desnoyers Committed by Ingo Molnar
Browse files

x86: enhance DEBUG_RODATA support for hotplug and kprobes



Standardize DEBUG_RODATA, removing special cases for hotplug and kprobes.

Signed-off-by: default avatarMathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
Cc: Andi Kleen <andi@firstfloor.org>
Cc: pageexec@freemail.hu
Cc: akpm@linux-foundation.org
CC: Andi Kleen <andi@firstfloor.org>
CC: pageexec@freemail.hu
CC: H. Peter Anvin <hpa@zytor.com>
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
parent e587cadd
Loading
Loading
Loading
Loading
+8 −16
Original line number Original line Diff line number Diff line
@@ -723,12 +723,6 @@ void mark_rodata_ro(void)
	unsigned long start = PFN_ALIGN(_text);
	unsigned long start = PFN_ALIGN(_text);
	unsigned long size = PFN_ALIGN(_etext) - start;
	unsigned long size = PFN_ALIGN(_etext) - start;


#ifndef CONFIG_KPROBES
#ifdef CONFIG_HOTPLUG_CPU
	/* It must still be possible to apply SMP alternatives. */
	if (num_possible_cpus() <= 1)
#endif
	{
	set_pages_ro(virt_to_page(start), size >> PAGE_SHIFT);
	set_pages_ro(virt_to_page(start), size >> PAGE_SHIFT);
	printk(KERN_INFO "Write protecting the kernel text: %luk\n",
	printk(KERN_INFO "Write protecting the kernel text: %luk\n",
		size >> 10);
		size >> 10);
@@ -740,8 +734,6 @@ void mark_rodata_ro(void)


	printk(KERN_INFO "Testing CPA: write protecting again\n");
	printk(KERN_INFO "Testing CPA: write protecting again\n");
	set_pages_ro(virt_to_page(start), size>>PAGE_SHIFT);
	set_pages_ro(virt_to_page(start), size>>PAGE_SHIFT);
#endif
	}
#endif
#endif
	start += size;
	start += size;
	size = (unsigned long)__end_rodata - start;
	size = (unsigned long)__end_rodata - start;
+2 −18
Original line number Original line Diff line number Diff line
@@ -635,24 +635,7 @@ EXPORT_SYMBOL_GPL(rodata_test_data);


void mark_rodata_ro(void)
void mark_rodata_ro(void)
{
{
	unsigned long start = (unsigned long)_stext, end;
	unsigned long start = PFN_ALIGN(_stext), end = PFN_ALIGN(__end_rodata);

#ifdef CONFIG_HOTPLUG_CPU
	/* It must still be possible to apply SMP alternatives. */
	if (num_possible_cpus() > 1)
		start = (unsigned long)_etext;
#endif

#ifdef CONFIG_KPROBES
	start = (unsigned long)__start_rodata;
#endif

	end = (unsigned long)__end_rodata;
	start = (start + PAGE_SIZE - 1) & PAGE_MASK;
	end &= PAGE_MASK;
	if (end <= start)
		return;



	printk(KERN_INFO "Write protecting the kernel read-only data: %luk\n",
	printk(KERN_INFO "Write protecting the kernel read-only data: %luk\n",
	       (end - start) >> 10);
	       (end - start) >> 10);
@@ -675,6 +658,7 @@ void mark_rodata_ro(void)
	set_memory_ro(start, (end-start) >> PAGE_SHIFT);
	set_memory_ro(start, (end-start) >> PAGE_SHIFT);
#endif
#endif
}
}

#endif
#endif


#ifdef CONFIG_BLK_DEV_INITRD
#ifdef CONFIG_BLK_DEV_INITRD