From: Pierrick Bouvier <pierrick.bouvier@linaro.org>
To: Michael Tokarev <mjt@tls.msk.ru>, qemu-devel@nongnu.org
Cc: laurent@vivier.eu, richard.henderson@linaro.org, sir@cmpwn.com,
"Philippe Mathieu-Daudé" <philmd@linaro.org>
Subject: Re: [PATCH v2] linux-user/syscall: Implement execve without execveat
Date: Wed, 5 Jul 2023 14:09:41 +0200 [thread overview]
Message-ID: <92781c52-f70a-88bf-1ce4-0ef6d9e1d2e4@linaro.org> (raw)
In-Reply-To: <8fbd6900-7c33-17e4-600a-e4799719686b@tls.msk.ru>
On 7/5/23 12:26, Michael Tokarev wrote:
> 05.07.2023 12:00, Pierrick Bouvier wrote:
> ...
>> diff --git a/linux-user/syscall.c b/linux-user/syscall.c
>> index 08162cc966..4945ddd7f2 100644
>> --- a/linux-user/syscall.c
>> +++ b/linux-user/syscall.c
>> @@ -659,6 +659,7 @@ safe_syscall4(pid_t, wait4, pid_t, pid, int *, status, int, options, \
>> #endif
>> safe_syscall5(int, waitid, idtype_t, idtype, id_t, id, siginfo_t *, infop, \
>> int, options, struct rusage *, rusage)
>> +safe_syscall3(int, execve, const char *, filename, char **, argv, char **, envp)
>> safe_syscall5(int, execveat, int, dirfd, const char *, filename,
>> char **, argv, char **, envp, int, flags)
>> #if defined(TARGET_NR_select) || defined(TARGET_NR__newselect) || \
>> @@ -8615,9 +8616,9 @@ ssize_t do_guest_readlink(const char *pathname, char *buf, size_t bufsiz)
>> return ret;
>> }
>>
>> -static int do_execveat(CPUArchState *cpu_env, int dirfd,
>> - abi_long pathname, abi_long guest_argp,
>> - abi_long guest_envp, int flags)
>> +static int do_execv(CPUArchState *cpu_env, int dirfd,
>> + abi_long pathname, abi_long guest_argp,
>> + abi_long guest_envp, int flags, bool is_execveat)
>> {
>> int ret;
>> char **argp, **envp;
>> @@ -8696,11 +8697,14 @@ static int do_execveat(CPUArchState *cpu_env, int dirfd,
>> goto execve_efault;
>> }
>>
>> + const char* exe = p;
>> if (is_proc_myself(p, "exe")) {
>> - ret = get_errno(safe_execveat(dirfd, exec_path, argp, envp, flags));
>> - } else {
>> - ret = get_errno(safe_execveat(dirfd, p, argp, envp, flags));
>> + exe = exec_path;
>> }
>> + ret = is_execveat ?
>> + safe_execveat(dirfd, exe, argp, envp, flags):
>> + safe_execve(exe, argp, envp);
>> + ret = get_errno(ret);
>
>
> This one has 2 issues reported by checkpatch.pl:
>
> $ git show | ./scripts/checkpatch.pl -
>
> ERROR: "foo* bar" should be "foo *bar"
> #161: FILE: linux-user/syscall.c:8700:
> + const char* exe = p;
>
> ERROR: spaces required around that ':' (ctx:VxE)
> #169: FILE: linux-user/syscall.c:8705:
> + safe_execveat(dirfd, exe, argp, envp, flags):
> ^
>
> total: 2 errors, 0 warnings, 47 lines checked
>
> Your patch has style problems, please review. If any of these errors
> are false positives report them to the maintainer, see
> CHECKPATCH in MAINTAINERS.
>
> As I mentioned in the v1, I don't remember offhand how the arithmetic if
> should be styled in qemu. At the very best, the v2 variant is difficult
> to read because ":" is too close to ";" visually, an extra space before
> it will make it more explicit.
>
Sorry about it.
I'll fix it, and use style advised by Philippe.
> Other than that, I'm fine with this version.
>
> With the checkpatch issues fixed,
>
> Reviewed-by: Michael Tokarev <mjt@tls.msk.ru>
>
> Thanks,
>
> /mjt
prev parent reply other threads:[~2023-07-05 12:10 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-05 9:00 [PATCH v2] linux-user/syscall: Implement execve without execveat Pierrick Bouvier
2023-07-05 10:26 ` Michael Tokarev
2023-07-05 11:14 ` Philippe Mathieu-Daudé
2023-07-05 12:09 ` Pierrick Bouvier [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=92781c52-f70a-88bf-1ce4-0ef6d9e1d2e4@linaro.org \
--to=pierrick.bouvier@linaro.org \
--cc=laurent@vivier.eu \
--cc=mjt@tls.msk.ru \
--cc=philmd@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=richard.henderson@linaro.org \
--cc=sir@cmpwn.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).