How to have synchronous communication between kext and user-space on macos?

≯℡__Kan透↙ 提交于 2019-12-11 17:16:41

问题


I have a user-space process (daemon) that communicates with a Network Kernel Extension using the "Kernel Control API" (https://developer.apple.com/library/archive/documentation/Darwin/Conceptual/NKEConceptual/control/control.html)

Specifically, I have an NKE that is responsible for modifying the source address of sockets belonging to specific applications. However the NKE does not have all the information or abilities it needs - and often needs to communicate with a daemon process to perform other actions (such as finding paths associated with PIDs, and also adding firewall rules).

However, it seems the "kernel control api" is non-blocking -- but i need the NKE to block in a callback (such as the sf_bind() callback) while it gathers the extra information or performs the actions in the daemon.

How do i implement this blocking communication with the daemon in my NKE using the Kernel Control API?

Basically I want to be able to halt the bind() callback while the NKE requests an action from the daemon (via the kernel control api), and then only continue the bind() callback after that information is received.

来源:https://stackoverflow.com/questions/57145678/how-to-have-synchronous-communication-between-kext-and-user-space-on-macos

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!