|
From: | Richard Henderson |
Subject: | Re: linux-user: Add option to run `execve`d programs through QEMU |
Date: | Thu, 7 Nov 2024 09:29:16 +0000 |
User-agent: | Mozilla Thunderbird |
On 11/6/24 21:30, Noah Goldstein wrote:
On Wed, Nov 6, 2024 at 3:10 PM Richard Henderson <richard.henderson@linaro.org> wrote:On 11/6/24 18:13, Noah Goldstein wrote:Question about impl regarding handling of `-execfd` with/without a program name. 1) `-execfd` + program name ie: `qemu -execfd <some_fd> ls -a`. 2) `-execfd` without program name i.e: `qemu -execfd <some_fd> -a`. Do you want to allow both of these? If you want to allow (1), what should we use for `argv[0]`/`exec_path`. The program pass ("ls") or `readlink(<some_fd>)`?The canonical response is, examine the kernel source. We're not implementing this in a vacuum, you're replicating execveat(2). I suspect the answer is (1), to be compared with syscall(__NR_execveat, some_fd, "", &["ls", "-a"], env, AT_EMPTY_PATH);Err, I think the reference for '-execfd' is `fexecve`: https://man7.org/linux/man-pages/man3/fexecve.3.html
No, fexecve(3) is a glibc function which (nowadays) uses the execveat(2) syscall that we want to emulate.
Which doesn't take a path...
... corresponding to the "" and AT_EMPTY_PATH above.
So I guess we just interpret the "ls" as argv[0] but not as "exec_path".
But your conclusion is correct. r~
[Prev in Thread] | Current Thread | [Next in Thread] |