this repo has no description
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Add a quirk to make thread ports always odd (libplatform expects that)

+27 -9
+18 -7
src/lkm/ipc_space.c
··· 129 129 return 0; 130 130 } 131 131 132 - mach_msg_return_t ipc_space_make_send(ipc_namespace_t* space, darling_mach_port_t* port, bool once, mach_port_name_t* name_out) 132 + mach_msg_return_t ipc_space_make_send_odd(ipc_namespace_t* space, darling_mach_port_t* port, bool once, mach_port_name_t* name_out, bool odd) 133 133 { 134 134 mach_msg_return_t ret; 135 135 struct mach_port_right* right = NULL; 136 - int id; 136 + int id, search_start = 1; 137 137 138 138 mutex_lock(&space->mutex); 139 139 ··· 163 163 goto err; 164 164 } 165 165 166 - id = idr_alloc(&space->names, right, 1, -1, GFP_KERNEL); 167 - if (id < 0) 166 + do 168 167 { 169 - ret = KERN_RESOURCE_SHORTAGE; 170 - goto err; 171 - } 168 + id = idr_alloc(&space->names, right, search_start, -1, GFP_KERNEL); 169 + if (id < 0) 170 + { 171 + ret = KERN_RESOURCE_SHORTAGE; 172 + goto err; 173 + } 174 + 175 + if (odd && !(id & 1)) 176 + { 177 + idr_remove(&space->names, id); 178 + search_start = id+1; 179 + } 180 + else 181 + odd = false; 182 + } while (odd); 172 183 173 184 *name_out = id; 174 185
+8 -1
src/lkm/ipc_space.h
··· 62 62 63 63 /* 64 64 * Locks and unlocks the space. Expects the port to be locked. 65 + * 66 + * Some userspace code expects certain right numbers to be odd (e.g. thread ports). 65 67 */ 66 - mach_msg_return_t ipc_space_make_send(ipc_namespace_t* space, darling_mach_port_t* port, bool once, mach_port_name_t* name_out); 68 + mach_msg_return_t ipc_space_make_send_odd(ipc_namespace_t* space, darling_mach_port_t* port, bool once, mach_port_name_t* name_out, bool odd); 69 + 70 + inline static mach_msg_return_t ipc_space_make_send(ipc_namespace_t* space, darling_mach_port_t* port, bool once, mach_port_name_t* name_out) 71 + { 72 + return ipc_space_make_send_odd(space, port, once, name_out, false); 73 + } 67 74 68 75 /* 69 76 * Inserts existing right into given namespace.
+1 -1
src/lkm/traps.c
··· 330 330 331 331 ipc_port_unlock(task->task_self); 332 332 333 - ret = ipc_space_make_send(&task->namespace, thread_port, false, &name); 333 + ret = ipc_space_make_send_odd(&task->namespace, thread_port, false, &name, true); 334 334 335 335 if (ret == KERN_SUCCESS) 336 336 return name;