Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mumble-voip/mach_override.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Mentovai <mark@chromium.org>2014-05-10 00:40:10 +0400
committerMark Mentovai <mark@chromium.org>2014-05-10 00:40:10 +0400
commit84a5bd929213b9e0f059d3bc8c5b738e9fe4e620 (patch)
treeb86d4c1fe660c3c3b8b6c5ce881954162ec3c0bc /libudis86/decode.c
parente2ca3c37cb72dd6a66bb56ced2c52e3bd7463232 (diff)
Stop using mach_host_self and host_page_size, fixing a port right leak
It is incorrect to use mach_host_self without disposing of the send right to the host port with mach_port_deallocate when done with it. http://crbug.com/105513 shows the sorts of problems that can arise when send rights aren’t properly deallocated. mach_host_self was only used by mach_override to be able to call host_page_size. host_page_size is unnecessary, because it always returns a constant value, PAGE_SIZE, which is also known at user-land compile time. See libsyscall/mach/mach_init.c. User code is better off just using this macro directly, and not fumbling with the system calls to obtain and properly dispose of a send right to the host port. (You need to mach_port_deallocate the ports you get from mach_host_self and mach_thread_self, but you must not normally deallocate the one from mach_task_self, because mach_task_self is actually just a macro that references a global variable. It doesn’t add any port rights at all. See <mach/mach_init.h>. If you bypass the macro and call the real mach_task_self system call, you do need to call mach_port_deallocate, but this situation is incredibly rare.)
Diffstat (limited to 'libudis86/decode.c')
0 files changed, 0 insertions, 0 deletions