All of lore.kernel.org
 help / color / mirror / Atom feed
* Using x86 segments against NULL pointer deference exploit
@ 2009-11-06 12:59 castet.matthieu
  2009-11-06 13:13 ` Alan Cox
                   ` (3 more replies)
  0 siblings, 4 replies; 12+ messages in thread
From: castet.matthieu @ 2009-11-06 12:59 UTC (permalink / raw)
  To: linux-kernel

Hi,

I am wondering why we can't set the KERNEL_DS data segment to not contain the
first page, ie changing it from R/W flat model to R/W expand down from
0xffffffff to 4096.

The modification seems simple : change GDT_ENTRY_KERNEL_DS [1], and some
modification for syscall entry point that doesn't support segment (sysenter).

The drawback of this it that the kernel can't access anymore data in the first
segment. Is it needed for application like wine or dosemu ?


Regards,

Matthieu

PS : why x86_64 segment got access bit set and x86_32 doesn't ?

[1]
something like
diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c
index cc25c2b..898a569 100644
--- a/arch/x86/kernel/cpu/common.c
+++ b/arch/x86/kernel/cpu/common.c
@@ -101,7 +101,7 @@ DEFINE_PER_CPU_PAGE_ALIGNED(struct gdt_page, gdt_page) = {
.gdt = {
 	[GDT_ENTRY_DEFAULT_USER_CS]	= GDT_ENTRY_INIT(0xa0fb, 0, 0xfffff),
 #else
 	[GDT_ENTRY_KERNEL_CS]		= GDT_ENTRY_INIT(0xc09a, 0, 0xfffff),
-	[GDT_ENTRY_KERNEL_DS]		= GDT_ENTRY_INIT(0xc092, 0, 0xfffff),
+	[GDT_ENTRY_KERNEL_DS]		= GDT_ENTRY_INIT(0xc096, 0, 0x00001),
 	[GDT_ENTRY_DEFAULT_USER_CS]	= GDT_ENTRY_INIT(0xc0fa, 0, 0xfffff),
 	[GDT_ENTRY_DEFAULT_USER_DS]	= GDT_ENTRY_INIT(0xc0f2, 0, 0xfffff),
 	/*

^ permalink raw reply related	[flat|nested] 12+ messages in thread
[parent not found: <dDwJH-3PE-7@gated-at.bofh.it>]

end of thread, other threads:[~2009-11-11 14:12 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-11-06 12:59 Using x86 segments against NULL pointer deference exploit castet.matthieu
2009-11-06 13:13 ` Alan Cox
2009-11-06 20:35   ` matthieu castet
2009-11-09  6:30     ` H. Peter Anvin
2009-11-06 20:18 ` Andi Kleen
2009-11-08 14:38   ` matthieu castet
2009-11-08 19:41     ` Andi Kleen
2009-11-06 20:58 ` Jiri Kosina
2009-11-06 22:54 ` H. Peter Anvin
2009-11-07 10:20   ` Jiri Kosina
     [not found] <dDwJH-3PE-7@gated-at.bofh.it>
2009-11-10 16:46 ` Markku Savela
2009-11-11 14:11   ` Jiri Kosina

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.