MCPcopy Create free account
hub / github.com/qilingframework/qiling / _start_proxy

Method _start_proxy

qiling/os/posix/kernel_proxy/__init__.py:73–95  ·  view source on GitHub ↗

Start the proxy subprocess, connected via Unix socketpair.

(self)

Source from the content-addressed store, hash-verified

71 self._start_proxy()
72
73 def _start_proxy(self):
74 """Start the proxy subprocess, connected via Unix socketpair."""
75 parent_sock, child_sock = socket.socketpair(socket.AF_UNIX, socket.SOCK_STREAM)
76
77 child_fd = child_sock.fileno()
78
79 # ensure the subprocess can find qiling even when run from a subdirectory
80 env = os.environ.copy()
81 qiling_root = os.path.dirname(os.path.dirname(os.path.dirname(
82 os.path.dirname(os.path.dirname(os.path.abspath(__file__))))))
83 python_path = env.get('PYTHONPATH', '')
84 env['PYTHONPATH'] = f"{qiling_root}:{python_path}" if python_path else qiling_root
85
86 self._process = subprocess.Popen(
87 [sys.executable, '-m', 'qiling.os.posix.kernel_proxy.proxy', str(child_fd)],
88 pass_fds=(child_fd,),
89 close_fds=True,
90 env=env,
91 )
92 child_sock.close()
93
94 self._client = ProxyClient(parent_sock)
95 self.ql.log.info(f"kernel proxy started (pid={self._process.pid})")
96
97 def _build_reverse_table(self) -> Dict[str, int]:
98 """Build name -> syscall_nr mapping from the guest architecture's syscall table."""

Callers 1

__init__Method · 0.95

Calls 5

ProxyClientClass · 0.90
socketpairMethod · 0.80
filenoMethod · 0.45
getMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected