Start the proxy subprocess, connected via Unix socketpair.
(self)
| 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.""" |
no test coverage detected