Index: linux-2.6.16/arch/um/sys-i386/ldt.c
===================================================================
--- linux-2.6.16.orig/arch/um/sys-i386/ldt.c	2006-03-23 20:31:50.000000000 -0500
+++ linux-2.6.16/arch/um/sys-i386/ldt.c	2006-03-23 20:33:27.000000000 -0500
@@ -194,8 +194,6 @@ static long read_ldt_from_host(void __us
 	return res;
 }
 
-static DECLARE_MUTEX(ldt_sem);
-
 /*
  * In skas mode, we hold our own ldt data in UML.
  * Thus, the code implementing sys_modify_ldt_skas
@@ -224,7 +222,7 @@ static int read_ldt(void __user * ptr, u
 		return read_ldt_from_host(ptr, bytecount);
 	}
 
-	down(&ldt_sem);
+	down(&ldt->semaphore);
 	if(ldt->entry_count <= LDT_DIRECT_ENTRIES){
 		size = LDT_ENTRY_SIZE*LDT_DIRECT_ENTRIES;
 		if(size > bytecount)
@@ -248,7 +246,7 @@ static int read_ldt(void __user * ptr, u
 			ptr += size;
 		}
 	}
-	up(&ldt_sem);
+	up(&ldt->semaphore);
 
 	if(bytecount == 0 || err == -EFAULT)
 		goto out;
@@ -305,7 +303,7 @@ static int write_ldt(void __user * ptr, 
 	}
 
         if(!ptrace_ldt)
-                down(&ldt_sem);
+                down(&ldt->semaphore);
 
 	err = write_ldt_entry(mm_idp, func, &ldt_info, &addr, 1);
 	if(err)
@@ -365,7 +363,7 @@ static int write_ldt(void __user * ptr, 
 	err = 0;
 
 out_unlock:
-	up(&ldt_sem);
+	up(&ldt->semaphore);
 out:
 	return err;
 }
@@ -460,6 +458,9 @@ long init_new_ldt(struct mmu_context_ska
 	struct proc_mm_op copy;
 
 
+	if(!ptrace_ldt)
+		init_MUTEX(&new_mm->ldt.semaphore);
+
 	if(!from_mm){
 		memset(&desc, 0, sizeof(desc));
 		/*
@@ -518,7 +519,7 @@ long init_new_ldt(struct mmu_context_ska
 		 * i.e., we have to use the stub for modify_ldt, which
 		 * can't handle the big read buffer of up to 64kB.
 		 */
-		down(&ldt_sem);
+		down(&from_mm->ldt.semaphore);
 		if(from_mm->ldt.entry_count <= LDT_DIRECT_ENTRIES){
 			memcpy(new_mm->ldt.u.entries, from_mm->ldt.u.entries,
 			       sizeof(new_mm->ldt.u.entries));
@@ -538,7 +539,7 @@ long init_new_ldt(struct mmu_context_ska
 			}
 		}
 		new_mm->ldt.entry_count = from_mm->ldt.entry_count;
-		up(&ldt_sem);
+		up(&from_mm->ldt.semaphore);
 	}
 
     out:
Index: linux-2.6.16/include/asm-um/ldt-i386.h
===================================================================
--- linux-2.6.16.orig/include/asm-um/ldt-i386.h	2006-03-23 20:31:50.000000000 -0500
+++ linux-2.6.16/include/asm-um/ldt-i386.h	2006-03-23 20:33:27.000000000 -0500
@@ -8,7 +8,7 @@
 #ifndef __ASM_LDT_I386_H
 #define __ASM_LDT_I386_H
 
-#include "asm/page.h"
+#include "asm/semaphore.h"
 #include "asm/arch/ldt.h"
 
 struct mmu_context_skas;
@@ -31,6 +31,7 @@ struct ldt_entry {
 
 typedef struct uml_ldt {
 	int entry_count;
+	struct semaphore semaphore;
 	union {
 		struct ldt_entry * pages[LDT_PAGES_MAX];
 		struct ldt_entry entries[LDT_DIRECT_ENTRIES];
Index: linux-2.6.16/include/asm-um/ldt-x86_64.h
===================================================================
--- linux-2.6.16.orig/include/asm-um/ldt-x86_64.h	2006-03-23 20:31:50.000000000 -0500
+++ linux-2.6.16/include/asm-um/ldt-x86_64.h	2006-03-23 20:33:27.000000000 -0500
@@ -8,9 +8,8 @@
 #ifndef __ASM_LDT_X86_64_H
 #define __ASM_LDT_X86_64_H
 
+#include "asm/semaphore.h"
 #include "asm/arch/ldt.h"
-#include "asm/types.h"
-#include "asm/page.h"
 
 struct mmu_context_skas;
 extern void ldt_host_info(void);
@@ -32,6 +31,7 @@ struct ldt_entry {
 
 typedef struct uml_ldt {
 	int entry_count;
+	struct semaphore semaphore;
 	union {
 		struct ldt_entry * pages[LDT_PAGES_MAX];
 		struct ldt_entry entries[LDT_DIRECT_ENTRIES];
