Darling Wiki

macOS translation layer for Linux

User Tools

Site Tools


documentation:mach_ports

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

documentation:mach_ports [2019/03/16 13:29]
bugaevc Create a brand new page
documentation:mach_ports [2019/03/17 15:02] (current)
bugaevc Fix a word & add another link
Line 173: Line 173:
 In addition to using the ''​*_self()''​ traps and other methods mentioned above, you can get all these ports by calling ''​task_get_special_port()'',​ passing in the task port (for the caller task or any other task) and an identifier of the port (''​TASK_BOOTSTRAP_PORT''​ and so on). There also exist wrapper macros (''​task_get_bootstrap_port()''​ and so on) that pass the right identifier automatically. In addition to using the ''​*_self()''​ traps and other methods mentioned above, you can get all these ports by calling ''​task_get_special_port()'',​ passing in the task port (for the caller task or any other task) and an identifier of the port (''​TASK_BOOTSTRAP_PORT''​ and so on). There also exist wrapper macros (''​task_get_bootstrap_port()''​ and so on) that pass the right identifier automatically.
  
-There also exists ''​task_set_special_port()''​ (and the wrapper macros) that allows you to //change// the special ports for a given task to any send right you provide. ''​mach_task_self()''​ and all the other APIs discussed above will, in fact, return these replaced ports rather than the //real// ports for the task, host and so on. This is a powerful mechanism that can be used, for example, to disallow task to manipulate itself, log and forward any messages it sends and receives (Hurd'​s ''​rpctrace''​),​ or make it believe it's running on a different version of the kernel or on another host. This is also how task get the bootstrap port: the first task (launchd) starts with a null bootstrap port, allocates a port and sets it as the bootstrap port for the tasks it spawns.+There also exists ''​task_set_special_port()''​ (and the wrapper macros) that allows you to //change// the special ports for a given task to any send right you provide. ''​mach_task_self()''​ and all the other APIs discussed above will, in fact, return these replaced ports rather than the //real// ports for the task, host and so on. This is a powerful mechanism that can be used, for example, to disallow task to manipulate itself, log and forward any messages it sends and receives (Hurd'​s ''​rpctrace''​),​ or make it believe it's running on a different version of the kernel or on another host. This is also how tasks get the bootstrap port: the first task (launchd) starts with a null bootstrap port, allocates a port and sets it as the bootstrap port for the tasks it spawns.
  
 There also are two special sets of ports that tasks inherit: There also are two special sets of ports that tasks inherit:
Line 509: Line 509:
   * [[http://​www.gnustep.org/​resources/​documentation/​Developer/​Base/​ProgrammingManual/​manual_7.html|Objective-C GNUstep Base Programming Manual: 7. Distributed Objects]]   * [[http://​www.gnustep.org/​resources/​documentation/​Developer/​Base/​ProgrammingManual/​manual_7.html|Objective-C GNUstep Base Programming Manual: 7. Distributed Objects]]
   * [[https://​developer.apple.com/​library/​archive/​documentation/​MacOSX/​Conceptual/​BPSystemStartup/​Chapters/​CreatingXPCServices.html|Creating XPC Services]]   * [[https://​developer.apple.com/​library/​archive/​documentation/​MacOSX/​Conceptual/​BPSystemStartup/​Chapters/​CreatingXPCServices.html|Creating XPC Services]]
 +  * [[https://​thecyberwire.com/​events/​docs/​IanBeer_JSS_Slides.pdf|Auditing and Exploiting Apple IPC]]
documentation/mach_ports.txt ยท Last modified: 2019/03/17 15:02 by bugaevc