linux_emul.c (416ba5c74546f32a993436a99516d35008e9f384) | linux_emul.c (23e8912c6087b3b6690566258c3a06f55a51eb2c) |
---|---|
1/*- 2 * Copyright (c) 2006 Roman Divacky 3 * Copyright (c) 2013 Dmitry Chagin 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: --- 31 unchanged lines hidden (view full) --- 40#include <sys/mutex.h> 41#include <sys/sx.h> 42#include <sys/proc.h> 43#include <sys/syscallsubr.h> 44#include <sys/sysent.h> 45 46#include <compat/linux/linux_emul.h> 47#include <compat/linux/linux_misc.h> | 1/*- 2 * Copyright (c) 2006 Roman Divacky 3 * Copyright (c) 2013 Dmitry Chagin 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: --- 31 unchanged lines hidden (view full) --- 40#include <sys/mutex.h> 41#include <sys/sx.h> 42#include <sys/proc.h> 43#include <sys/syscallsubr.h> 44#include <sys/sysent.h> 45 46#include <compat/linux/linux_emul.h> 47#include <compat/linux/linux_misc.h> |
48#include <compat/linux/linux_persona.h> |
|
48#include <compat/linux/linux_util.h> 49 50 51/* 52 * This returns reference to the thread emuldata entry (if found) 53 * 54 * Hold PROC_LOCK when referencing emuldata from other threads. 55 */ --- 66 unchanged lines hidden (view full) --- 122 em->pdeath_signal = 0; 123 em->robust_futexes = NULL; 124 em->child_clear_tid = NULL; 125 em->child_set_tid = NULL; 126 127 /* epoll should be destroyed in a case of exec. */ 128 pem = pem_find(p); 129 KASSERT(pem != NULL, ("proc_exit: proc emuldata not found.\n")); | 49#include <compat/linux/linux_util.h> 50 51 52/* 53 * This returns reference to the thread emuldata entry (if found) 54 * 55 * Hold PROC_LOCK when referencing emuldata from other threads. 56 */ --- 66 unchanged lines hidden (view full) --- 123 em->pdeath_signal = 0; 124 em->robust_futexes = NULL; 125 em->child_clear_tid = NULL; 126 em->child_set_tid = NULL; 127 128 /* epoll should be destroyed in a case of exec. */ 129 pem = pem_find(p); 130 KASSERT(pem != NULL, ("proc_exit: proc emuldata not found.\n")); |
130 | 131 pem->persona = 0; |
131 if (pem->epoll != NULL) { 132 emd = pem->epoll; 133 pem->epoll = NULL; 134 free(emd, M_EPOLL); 135 } 136 } 137 138} --- 76 unchanged lines hidden (view full) --- 215 return (0); 216} 217 218void 219linux_proc_exec(void *arg __unused, struct proc *p, struct image_params *imgp) 220{ 221 struct thread *td = curthread; 222 struct thread *othertd; | 132 if (pem->epoll != NULL) { 133 emd = pem->epoll; 134 pem->epoll = NULL; 135 free(emd, M_EPOLL); 136 } 137 } 138 139} --- 76 unchanged lines hidden (view full) --- 216 return (0); 217} 218 219void 220linux_proc_exec(void *arg __unused, struct proc *p, struct image_params *imgp) 221{ 222 struct thread *td = curthread; 223 struct thread *othertd; |
224#if defined(__amd64__) 225 struct linux_pemuldata *pem; 226#endif |
|
223 224 /* 225 * In a case of execing from linux binary properly detach 226 * other threads from the user space. 227 */ 228 if (__predict_false(SV_PROC_ABI(p) == SV_ABI_LINUX)) { 229 FOREACH_THREAD_IN_PROC(p, othertd) { 230 if (td != othertd) --- 7 unchanged lines hidden (view full) --- 238 */ 239 if (__predict_false((imgp->sysent->sv_flags & SV_ABI_MASK) == 240 SV_ABI_LINUX)) { 241 242 if (SV_PROC_ABI(p) == SV_ABI_LINUX) 243 linux_proc_init(td, NULL, 0); 244 else 245 linux_proc_init(td, td, 0); | 227 228 /* 229 * In a case of execing from linux binary properly detach 230 * other threads from the user space. 231 */ 232 if (__predict_false(SV_PROC_ABI(p) == SV_ABI_LINUX)) { 233 FOREACH_THREAD_IN_PROC(p, othertd) { 234 if (td != othertd) --- 7 unchanged lines hidden (view full) --- 242 */ 243 if (__predict_false((imgp->sysent->sv_flags & SV_ABI_MASK) == 244 SV_ABI_LINUX)) { 245 246 if (SV_PROC_ABI(p) == SV_ABI_LINUX) 247 linux_proc_init(td, NULL, 0); 248 else 249 linux_proc_init(td, td, 0); |
250#if defined(__amd64__) 251 /* 252 * An IA32 executable which has executable stack will have the 253 * READ_IMPLIES_EXEC personality flag set automatically. 254 */ 255 if (SV_PROC_FLAG(td->td_proc, SV_ILP32) && 256 imgp->stack_prot & VM_PROT_EXECUTE) { 257 pem = pem_find(p); 258 pem->persona |= LINUX_READ_IMPLIES_EXEC; 259 } 260#endif |
|
246 } 247} 248 249void 250linux_thread_dtor(void *arg __unused, struct thread *td) 251{ 252 struct linux_emuldata *em; 253 --- 32 unchanged lines hidden --- | 261 } 262} 263 264void 265linux_thread_dtor(void *arg __unused, struct thread *td) 266{ 267 struct linux_emuldata *em; 268 --- 32 unchanged lines hidden --- |