|
@@ -16,6 +16,8 @@
|
|
#include "choose-mode.h"
|
|
#include "choose-mode.h"
|
|
#include "kern.h"
|
|
#include "kern.h"
|
|
#include "mode_kern.h"
|
|
#include "mode_kern.h"
|
|
|
|
+#include "proc_mm.h"
|
|
|
|
+#include "os.h"
|
|
|
|
|
|
extern int modify_ldt(int func, void *ptr, unsigned long bytecount);
|
|
extern int modify_ldt(int func, void *ptr, unsigned long bytecount);
|
|
|
|
|
|
@@ -456,13 +458,14 @@ long init_new_ldt(struct mmu_context_skas * new_mm,
|
|
int i;
|
|
int i;
|
|
long page, err=0;
|
|
long page, err=0;
|
|
void *addr = NULL;
|
|
void *addr = NULL;
|
|
|
|
+ struct proc_mm_op copy;
|
|
|
|
|
|
- memset(&desc, 0, sizeof(desc));
|
|
|
|
|
|
|
|
if(!ptrace_ldt)
|
|
if(!ptrace_ldt)
|
|
init_MUTEX(&new_mm->ldt.semaphore);
|
|
init_MUTEX(&new_mm->ldt.semaphore);
|
|
|
|
|
|
if(!from_mm){
|
|
if(!from_mm){
|
|
|
|
+ memset(&desc, 0, sizeof(desc));
|
|
/*
|
|
/*
|
|
* We have to initialize a clean ldt.
|
|
* We have to initialize a clean ldt.
|
|
*/
|
|
*/
|
|
@@ -494,8 +497,26 @@ long init_new_ldt(struct mmu_context_skas * new_mm,
|
|
}
|
|
}
|
|
}
|
|
}
|
|
new_mm->ldt.entry_count = 0;
|
|
new_mm->ldt.entry_count = 0;
|
|
|
|
+
|
|
|
|
+ goto out;
|
|
}
|
|
}
|
|
- else if (!ptrace_ldt) {
|
|
|
|
|
|
+
|
|
|
|
+ if(proc_mm){
|
|
|
|
+ /* We have a valid from_mm, so we now have to copy the LDT of
|
|
|
|
+ * from_mm to new_mm, because using proc_mm an new mm with
|
|
|
|
+ * an empty/default LDT was created in new_mm()
|
|
|
|
+ */
|
|
|
|
+ copy = ((struct proc_mm_op) { .op = MM_COPY_SEGMENTS,
|
|
|
|
+ .u =
|
|
|
|
+ { .copy_segments =
|
|
|
|
+ from_mm->id.u.mm_fd } } );
|
|
|
|
+ i = os_write_file(new_mm->id.u.mm_fd, ©, sizeof(copy));
|
|
|
|
+ if(i != sizeof(copy))
|
|
|
|
+ printk("new_mm : /proc/mm copy_segments failed, "
|
|
|
|
+ "err = %d\n", -i);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if(!ptrace_ldt) {
|
|
/* Our local LDT is used to supply the data for
|
|
/* Our local LDT is used to supply the data for
|
|
* modify_ldt(READLDT), if PTRACE_LDT isn't available,
|
|
* modify_ldt(READLDT), if PTRACE_LDT isn't available,
|
|
* i.e., we have to use the stub for modify_ldt, which
|
|
* i.e., we have to use the stub for modify_ldt, which
|
|
@@ -524,6 +545,7 @@ long init_new_ldt(struct mmu_context_skas * new_mm,
|
|
up(&from_mm->ldt.semaphore);
|
|
up(&from_mm->ldt.semaphore);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ out:
|
|
return err;
|
|
return err;
|
|
}
|
|
}
|
|
|
|
|