[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1245156929-30395-8-git-send-email-ptesarik@suse.cz>
Date: Tue, 16 Jun 2009 14:55:27 +0200
From: Petr Tesarik <ptesarik@...e.cz>
To: LKML <linux-kernel@...r.kernel.org>
Cc: Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>,
"H. Peter Anvin" <hpa@...or.com>, Andi Kleen <andi@...stfloor.org>,
Roland McGrath <roland@...hat.com>,
Petr Tesarik <ptesarik@...e.cz>
Subject: [PATCH v3 7/9] x86: mark writable vDSO sections as broken
The vDSO is mapped read-only into the process' address space, so
any write accesses to it are broken and would segfault.
Additionally, if there is any uninitialized data, the vDSO setup
code does not allocate any space for it, so this is doubly broken.
The .dynbss section is a place to put symbols which are defined by
dynamic objects, are referenced by regular objects, and are not
functions. Space for these objects is allocated in the process image,
and the dynamic linker copies the object data (using a copy relocation).
So, there should never ever be a .dynbss section in a shared object
(and GNU binutils can't produce one, for sure), but then we can place
it into .broken, too.
As a side effect, the .data section now only contains the Global Offset
Table. Give it a more appropriate name for that.
Signed-off-by: Petr Tesarik <ptesarik@...e.cz>
---
arch/x86/vdso/vdso-layout.lds.S | 17 +++++++++++------
1 files changed, 11 insertions(+), 6 deletions(-)
diff --git a/arch/x86/vdso/vdso-layout.lds.S b/arch/x86/vdso/vdso-layout.lds.S
index 74fc5ae..53317a6 100644
--- a/arch/x86/vdso/vdso-layout.lds.S
+++ b/arch/x86/vdso/vdso-layout.lds.S
@@ -48,13 +48,8 @@ SECTIONS
.rodata : {
*(.rodata*)
} :text
- .data : {
- *(.data*)
+ .got : {
*(.got.plt) *(.got)
- *(.gnu.linkonce.d.*)
- *(.bss*)
- *(.dynbss*)
- *(.gnu.linkonce.b.*)
}
/*
@@ -76,6 +71,16 @@ SECTIONS
*/
.broken : {
/*
+ * The vDSO is mapped read-only, so any writable
+ * sections are broken (and will segfault at runtime).
+ * Additionally, space for uninitialized data is not
+ * even allocated by the vDSO setup code.
+ */
+ *(.data* .gnu.linkonce.d.*)
+ *(.bss* .gnu.linkonce.b.*)
+ *(.dynbss*)
+
+ /*
* Code in the Procedure Linkage Table will segfault.
*/
*(.plt)
--
1.6.0.2
--
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