diff options
Diffstat (limited to 'arch/um/sys-i386')
-rw-r--r-- | arch/um/sys-i386/ldt.c | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/arch/um/sys-i386/ldt.c b/arch/um/sys-i386/ldt.c index 17746b4c08f..0cdfd4481d5 100644 --- a/arch/um/sys-i386/ldt.c +++ b/arch/um/sys-i386/ldt.c @@ -16,6 +16,8 @@ #include "choose-mode.h" #include "kern.h" #include "mode_kern.h" +#include "proc_mm.h" +#include "os.h" 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; long page, err=0; void *addr = NULL; + struct proc_mm_op copy; - memset(&desc, 0, sizeof(desc)); if(!ptrace_ldt) init_MUTEX(&new_mm->ldt.semaphore); if(!from_mm){ + memset(&desc, 0, sizeof(desc)); /* * 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; + + 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 * modify_ldt(READLDT), if PTRACE_LDT isn't available, * 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); } + out: return err; } |