lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-Id: <47874243.76E4.0078.0@novell.com>
Date:	Fri, 11 Jan 2008 09:17:39 +0000
From:	"Jan Beulich" <jbeulich@...ell.com>
To:	<linux-kernel@...r.kernel.org>
Cc:	"Ingo Molnar" <mingo@...e.hu>,
	"Linus Torvalds" <torvalds@...ux-foundation.org>
Subject: [PATCH] make .tracedata a normal part of RODATA()

.. allowing it to be write-protected just as other read-only data
under CONFIG_DEBUG_RODATA.

Signed-off-by: Jan Beulich <jbeulich@...ell.com>
Cc: Linus Torvalds <torvalds@...ux-foundation.org>
Cc: Ingo Molnar <mingo@...e.hu>

---
 arch/x86/kernel/vmlinux_32.lds.S  |    7 -------
 arch/x86/kernel/vmlinux_64.lds.S  |    7 -------
 drivers/base/power/trace.c        |    2 +-
 include/asm-generic/vmlinux.lds.h |   14 ++++++++++++++
 include/asm-x86/resume-trace_32.h |    2 +-
 include/asm-x86/resume-trace_64.h |    4 ++--
 include/linux/resume-trace.h      |    2 +-
 7 files changed, 19 insertions(+), 19 deletions(-)

--- linux-2.6.24-rc7/arch/x86/kernel/vmlinux_32.lds.S	2008-01-10 16:53:55.000000000 +0100
+++ 2.6.24-rc7-resume-trace-rodata/arch/x86/kernel/vmlinux_32.lds.S	2007-12-18 16:36:00.000000000 +0100
@@ -64,13 +64,6 @@ SECTIONS
 
   BUG_TABLE :text
 
-  . = ALIGN(4);
-  .tracedata : AT(ADDR(.tracedata) - LOAD_OFFSET) {
-  	__tracedata_start = .;
-	*(.tracedata)
-  	__tracedata_end = .;
-  }
-
   RODATA
 
   /* writeable */
--- linux-2.6.24-rc7/arch/x86/kernel/vmlinux_64.lds.S	2008-01-10 16:53:55.000000000 +0100
+++ 2.6.24-rc7-resume-trace-rodata/arch/x86/kernel/vmlinux_64.lds.S	2007-12-20 16:08:56.000000000 +0100
@@ -54,13 +54,6 @@ SECTIONS
 
   RODATA
 
-  . = ALIGN(4);
-  .tracedata : AT(ADDR(.tracedata) - LOAD_OFFSET) {
-  	__tracedata_start = .;
-	*(.tracedata)
-  	__tracedata_end = .;
-  }
-
   . = ALIGN(PAGE_SIZE);        /* Align data segment to page size boundary */
 				/* Data */
   .data : AT(ADDR(.data) - LOAD_OFFSET) {
--- linux-2.6.24-rc7/drivers/base/power/trace.c	2008-01-10 16:54:00.000000000 +0100
+++ 2.6.24-rc7-resume-trace-rodata/drivers/base/power/trace.c	2007-12-18 16:30:48.000000000 +0100
@@ -153,7 +153,7 @@ EXPORT_SYMBOL(set_trace_device);
  * it's not any guarantee, but it's a high _likelihood_ that
  * the match is valid).
  */
-void generate_resume_trace(void *tracedata, unsigned int user)
+void generate_resume_trace(const void *tracedata, unsigned int user)
 {
 	unsigned short lineno = *(unsigned short *)tracedata;
 	const char *file = *(const char **)(tracedata + 2);
--- linux-2.6.24-rc7/include/asm-generic/vmlinux.lds.h	2008-01-10 16:55:01.000000000 +0100
+++ 2.6.24-rc7-resume-trace-rodata/include/asm-generic/vmlinux.lds.h	2007-12-19 12:31:00.000000000 +0100
@@ -57,6 +57,8 @@
 		VMLINUX_SYMBOL(__end_rio_route_ops) = .;		\
 	}								\
 									\
+	TRACEDATA							\
+									\
 	/* Kernel symbol table: Normal symbols */			\
 	__ksymtab         : AT(ADDR(__ksymtab) - LOAD_OFFSET) {		\
 		VMLINUX_SYMBOL(__start___ksymtab) = .;			\
@@ -229,6 +231,18 @@
 		__stop___bug_table = .;					\
 	}
 
+#ifdef CONFIG_PM_TRACE
+#define TRACEDATA							\
+	. = ALIGN(4);							\
+	.tracedata : AT(ADDR(.tracedata) - LOAD_OFFSET) {		\
+	  	__tracedata_start = .;					\
+		*(.tracedata)						\
+	  	__tracedata_end = .;					\
+	}
+#else
+#define TRACEDATA
+#endif
+
 #define NOTES								\
 	.notes : AT(ADDR(.notes) - LOAD_OFFSET) {			\
 		VMLINUX_SYMBOL(__start_notes) = .;			\
--- linux-2.6.24-rc7/include/asm-x86/resume-trace_32.h	2008-01-10 16:55:10.000000000 +0100
+++ 2.6.24-rc7-resume-trace-rodata/include/asm-x86/resume-trace_32.h	2007-12-18 16:31:48.000000000 +0100
@@ -1,6 +1,6 @@
 #define TRACE_RESUME(user) do {					\
 	if (pm_trace_enabled) {					\
-		void *tracedata;				\
+		const void *tracedata;				\
 		asm volatile("movl $1f,%0\n"			\
 			".section .tracedata,\"a\"\n"		\
 			"1:\t.word %c1\n"			\
--- linux-2.6.24-rc7/include/asm-x86/resume-trace_64.h	2008-01-10 16:55:10.000000000 +0100
+++ 2.6.24-rc7-resume-trace-rodata/include/asm-x86/resume-trace_64.h	2007-12-19 12:00:47.000000000 +0100
@@ -1,7 +1,7 @@
 #define TRACE_RESUME(user) do {					\
 	if (pm_trace_enabled) {					\
-		void *tracedata;				\
-		asm volatile("movq $1f,%0\n"			\
+		const void *tracedata;				\
+		asm volatile("leaq 1f(%rip),%0\n"		\
 			".section .tracedata,\"a\"\n"		\
 			"1:\t.word %c1\n"			\
 			"\t.quad %c2\n"				\
--- linux-2.6.24-rc7/include/linux/resume-trace.h	2007-10-09 22:31:38.000000000 +0200
+++ 2.6.24-rc7-resume-trace-rodata/include/linux/resume-trace.h	2007-12-18 16:31:30.000000000 +0100
@@ -8,7 +8,7 @@ extern int pm_trace_enabled;
 
 struct device;
 extern void set_trace_device(struct device *);
-extern void generate_resume_trace(void *tracedata, unsigned int user);
+extern void generate_resume_trace(const void *tracedata, unsigned int user);
 
 #define TRACE_DEVICE(dev) do { \
 	if (pm_trace_enabled) \


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ