Changeset View
Changeset View
Standalone View
Standalone View
sys/compat/linux/linux_emul.c
| Show First 20 Lines • Show All 285 Lines • ▼ Show 20 Lines | if (SV_CURPROC_ABI() != SV_ABI_LINUX) { | ||||
| free(pem, M_LINUX); | free(pem, M_LINUX); | ||||
| } | } | ||||
| return (EJUSTRETURN); | return (EJUSTRETURN); | ||||
| } | } | ||||
| void | void | ||||
| linux_proc_exec(void *arg __unused, struct proc *p, struct image_params *imgp) | linux_proc_exec(void *arg __unused, struct proc *p, struct image_params *imgp) | ||||
| { | { | ||||
| struct thread *td = curthread; | struct thread *td; | ||||
| struct thread *othertd; | struct thread *othertd; | ||||
| #if defined(__amd64__) | #if defined(__amd64__) | ||||
| struct linux_pemuldata *pem; | struct linux_pemuldata *pem; | ||||
| #endif | #endif | ||||
| /* | td = curthread; | ||||
| * In a case of execing from Linux binary properly detach | |||||
| * other threads from the user space. | |||||
| */ | |||||
| if (__predict_false(SV_PROC_ABI(p) == SV_ABI_LINUX)) { | |||||
| FOREACH_THREAD_IN_PROC(p, othertd) { | |||||
| if (td != othertd) | |||||
| (p->p_sysent->sv_thread_detach)(othertd); | |||||
| } | |||||
| } | |||||
| /* | /* | ||||
| * In a case of execing to Linux binary we create Linux | * In a case of execing to Linux binary we create Linux | ||||
| * emuldata thread entry. | * emuldata thread entry. | ||||
| */ | */ | ||||
| if (__predict_false((imgp->sysent->sv_flags & SV_ABI_MASK) == | if (__predict_false((imgp->sysent->sv_flags & SV_ABI_MASK) == | ||||
| SV_ABI_LINUX)) { | SV_ABI_LINUX)) { | ||||
| if (SV_PROC_ABI(p) == SV_ABI_LINUX) { | |||||
markj: I don't really understand. proc->p_sysent is set after the call to exec_new_vmspace(), so in… | |||||
kibAuthorUnsubmitted Done Inline ActionsYes, I did it in wrong branch of if(). kib: Yes, I did it in wrong branch of if(). | |||||
| if (SV_PROC_ABI(p) == SV_ABI_LINUX) | |||||
| linux_proc_init(td, NULL, 0); | linux_proc_init(td, NULL, 0); | ||||
| else | FOREACH_THREAD_IN_PROC(td->td_proc, othertd) { | ||||
| if (othertd != td) { | |||||
| linux_proc_init(td, othertd, | |||||
markjUnsubmitted Done Inline ActionsI think this deserves a comment. markj: I think this deserves a comment. | |||||
| LINUX_CLONE_THREAD); | |||||
| } | |||||
| } | |||||
| } else { | |||||
| linux_proc_init(td, td, 0); | linux_proc_init(td, td, 0); | ||||
| } | |||||
| #if defined(__amd64__) | #if defined(__amd64__) | ||||
| /* | /* | ||||
| * An IA32 executable which has executable stack will have the | * An IA32 executable which has executable stack will have the | ||||
| * READ_IMPLIES_EXEC personality flag set automatically. | * READ_IMPLIES_EXEC personality flag set automatically. | ||||
| */ | */ | ||||
| if (SV_PROC_FLAG(td->td_proc, SV_ILP32) && | if (SV_PROC_FLAG(td->td_proc, SV_ILP32) && | ||||
| imgp->stack_prot & VM_PROT_EXECUTE) { | imgp->stack_prot & VM_PROT_EXECUTE) { | ||||
| pem = pem_find(p); | pem = pem_find(p); | ||||
| ▲ Show 20 Lines • Show All 43 Lines • Show Last 20 Lines | |||||
I don't really understand. proc->p_sysent is set after the call to exec_new_vmspace(), so in the case where a non-Linux process execs a Linux binary, won't this check be false?