On 11/5/24 23:54, Noah Goldstein wrote:
You still need to handle is_proc_myself, for the guest binary.

Would this by handled by basically do:

```
if (is_proc_myself(p, "exe")) {
         exe = exec_path;
         if (through_qemu)
             argp[argp_offset] = exec_path;
}
```
Or am I missing something?

Something like that, yes.

I wonder if those two cases are related.  Do we need to also add an argument so 
that we
can pass the executable to the next qemu via file descriptor?  I.e. execvat 
becomes

      f = openat()
      execv(qemu, "-execfd", f)

and is_proc_myself uses execfd, which we already have open.

How does passing a fd from one process to another work?
As long as the fd is not marked O_CLOEXEC, it stays open in the new process. Providing the number via command-line, or whatever, is sufficient for the new process to know what is going on.

I now realize this is necessary for the AT_EMPTY_PATH flag, where we only have the file descriptor.


r~

Reply via email to