Skip to contentSkip to conversation

proper bounds check in do_set_gdt entry point

PATCH In review Chris Wright 2 participants 4 messages Jun 27, 2005

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 proper bounds check in do_set_gdt entry point

Unless I missed something, not bounds checking entries in do_set_gdt is a security hole.

xen/arch/x86/mm.c +3 -0
@@ -2442,6 +2442,9 @@ long do_set_gdt(unsigned long *frame_lis
     unsigned long frames[16];
     long ret;
 
+    if ( entries > FIRST_RESERVED_GDT_ENTRY )
+        return -EINVAL;
+
     if ( copy_from_user(frames, frame_list, nr_pages * sizeof(unsigned long)) )
         return -EFAULT;
#1 lore raw
Quoted 4 lines · Chris Wright

Unless I missed something, not bounds checking entries in do_set_gdt is a security hole.

The check happens in set_gdt(). do_set_gdt is just a wrapper with a copy_from_user plus conditional tlb flush.

-- Keir

#2 lore raw
Quoted 10 lines · * Keir Fraser ([email protected]) wrote:
Quoted 4 lines · Chris Wright

Unless I missed something, not bounds checking entries in do_set_gdt is a security hole.

The check happens in set_gdt(). do_set_gdt is just a wrapper with a copy_from_user plus conditional tlb flush.

I know, but copy_from_user has no sane limits. This is stack smash. -chris

#3 lore raw
Quoted 5 lines · Chris Wright
Quoted 2 lines

The check happens in set_gdt(). do_set_gdt is just a wrapper with a copy_from_user plus conditional tlb flush.

I know, but copy_from_user has no sane limits. This is stack smash. -chris

Good point.

-- Keir