Skip to contentSkip to conversation

kill default_ldt

PATCH In review Jeremy Fitzhardinge 2 participants 2 messages Aug 18, 2006

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 kill default_ldt

The default LDT is completely unused now that iBCS is no longer supported, so get rid of it.

===================================================================

arch/i386/kernel/ldt.c +0 -0
diff -r 121e0e54cca8 arch/i386/kernel/ldt.c
@@ -160,16 +160,14 @@ static int read_default_ldt(void __user {
	int err;
	unsigned long size;

- void *address;

	err = 0;
-	address = &default_ldt[0];
	size = 5*sizeof(struct desc_struct);
	if (size > bytecount)
		size = bytecount;

	err = size;
-	if (copy_to_user(ptr, address, size))
+	if (clear_user(ptr, size))
		err = -EFAULT;

	return err;
arch/i386/kernel/traps.c +0 -0
diff -r 121e0e54cca8 arch/i386/kernel/traps.c
@@ -58,9 +58,6 @@

#include "mach_traps.h"

asmlinkage int system_call(void);
-
-struct desc_struct default_ldt[] = { { 0, 0 }, { 0, 0 }, { 0, 0 },
- { 0, 0 }, { 0, 0 } };

/* Do we ignore FPU interrupts ? */
char ignore_fpu_irq = 0;

include/asm-i386/desc.h +0 -0
diff -r 121e0e54cca8 include/asm-i386/desc.h
@@ -33,11 +33,6 @@ static inline struct desc_struct *get_cp
	return (struct desc_struct *)per_cpu(cpu_gdt_descr, cpu).address;
}

-/*
- * This is the ldt that every process will get unless we need
- * something other than this.
- */
-extern struct desc_struct default_ldt[];
extern struct desc_struct idt_table[];
extern void set_intr_gate(unsigned int irq, void * addr);

@@ -159,7 +154,7 @@ static inline void clear_LDT(void)

{
	int cpu = get_cpu();

- set_ldt_desc(cpu, &default_ldt[0], 5);

+	set_ldt_desc(cpu, NULL, 0);
	load_LDT_desc();
	put_cpu();
}
@@ -172,10 +167,8 @@ static inline void load_LDT_nolock(mm_co
	void *segments = pc->ldt;
	int count = pc->size;

- if (likely(!count)) {
- segments = &default_ldt[0];
- count = 5;
- }
+ if (likely(!count))

+		segments = NULL;
		
	set_ldt_desc(cpu, segments, count);
	load_LDT_desc();
#1 lore raw
Quoted 2 lines · Jeremy Fitzhardinge

The default LDT is completely unused now that iBCS is no longer supported, so get rid of it.

Thanks, looks good.

-Andi