X-Git-Url: https://git.saurik.com/apple/xnu.git/blobdiff_plain/3e170ce000f1506b7b5d2c5c7faec85ceabb573d..d9a64523371fa019c4575bb400cbbc3a50ac9903:/osfmk/atm/atm.c?ds=sidebyside diff --git a/osfmk/atm/atm.c b/osfmk/atm/atm.c index 6ce1a1e71..fcf59e3d3 100644 --- a/osfmk/atm/atm.c +++ b/osfmk/atm/atm.c @@ -68,11 +68,11 @@ queue_head_t atm_values_list; ipc_voucher_attr_control_t voucher_attr_control; /* communication channel from ATM to voucher system */ static zone_t atm_value_zone, atm_descriptors_zone, atm_link_objects_zone; -static aid_t get_aid(); -static mach_atm_subaid_t get_subaid(); +static aid_t get_aid(void); +static mach_atm_subaid_t get_subaid(void); static atm_value_t atm_value_alloc_init(aid_t); static void atm_value_dealloc(atm_value_t atm_value); -static void atm_hash_table_init(); +static void atm_hash_table_init(void); static kern_return_t atm_value_hash_table_insert(atm_value_t new_atm_value); static void atm_value_hash_table_delete(atm_value_t atm_value); static atm_value_t get_atm_value_from_aid(aid_t aid) __unused; @@ -107,6 +107,7 @@ atm_get_value( mach_voucher_attr_content_t recipe, mach_voucher_attr_content_size_t recipe_size, mach_voucher_attr_value_handle_t *out_value, + mach_voucher_attr_value_flags_t *out_flags, ipc_voucher_t *out_value_voucher); kern_return_t @@ -143,6 +144,7 @@ struct ipc_voucher_attr_manager atm_manager = { .ivam_extract_content = atm_extract_content, .ivam_command = atm_command, .ivam_release = atm_release, + .ivam_flags = IVAM_FLAGS_NONE, }; #if DEVELOPMENT || DEBUG @@ -306,6 +308,7 @@ atm_get_value( mach_voucher_attr_content_t __unused recipe, mach_voucher_attr_content_size_t __unused recipe_size, mach_voucher_attr_value_handle_t *out_value, + mach_voucher_attr_value_flags_t *out_flags, ipc_voucher_t *out_value_voucher) { atm_value_t atm_value = ATM_VALUE_NULL; @@ -322,6 +325,7 @@ atm_get_value( /* never an out voucher */ *out_value_voucher = IPC_VOUCHER_NULL; + *out_flags = MACH_VOUCHER_ATTR_VALUE_FLAGS_NONE; if (disable_atm || (atm_get_diagnostic_config() & ATM_TRACE_DISABLE)) return KERN_NOT_SUPPORTED; @@ -721,15 +725,18 @@ atm_send_user_notification( return KERN_FAILURE; } - /* Set the honor queue limit option on the thread. */ - th->options |= TH_OPT_HONOR_QLIMIT; + thread_set_honor_qlimit(th); kr = atm_collect_trace_info(user_port, aid, sub_aid, flags, buffers_array, count, sizes_array, count); - /* Make sure that honor queue limit option is unset on the thread. */ - th->options &= (~TH_OPT_HONOR_QLIMIT); + thread_clear_honor_qlimit(th); - if (kr == MACH_SEND_TIMED_OUT) { - kr = KERN_SUCCESS; + if (kr != KERN_SUCCESS) { + ipc_port_release_send(user_port); + + if (kr == MACH_SEND_TIMED_OUT) { + kr = KERN_SUCCESS; + } } + return kr; } @@ -784,14 +791,16 @@ atm_send_proc_inspect_notification( return KERN_FAILURE; } - /* Set the honor queue limit option on the thread. */ - th->options |= TH_OPT_HONOR_QLIMIT; + thread_set_honor_qlimit(th); kr = atm_inspect_process_buffer(user_port, traced_pid, traced_uniqueid, buffer_size, memory_port); - /* Make sure that honor queue limit option is unset on the thread. */ - th->options &= (~TH_OPT_HONOR_QLIMIT); + thread_clear_honor_qlimit(th); - if (kr == MACH_SEND_TIMED_OUT) { - kr = KERN_SUCCESS; + if (kr != KERN_SUCCESS) { + ipc_port_release_send(user_port); + + if (kr == MACH_SEND_TIMED_OUT) { + kr = KERN_SUCCESS; + } } ipc_port_release_send(memory_port);