From: Laurent Vivier <laurent@vivier.eu>
To: WANG Xuerui <xen0n@gentoo.org>, qemu-devel@nongnu.org
Cc: "Philippe Mathieu-Daudé" <f4bug@amsat.org>,
"Andreas K . Hüttel" <dilfridge@gentoo.org>
Subject: Re: [PATCH] linux-user: Implement faccessat2
Date: Fri, 21 Oct 2022 17:37:32 +0200 [thread overview]
Message-ID: <0825f689-a649-3b3c-796e-ae3d8a3556e0@vivier.eu> (raw)
In-Reply-To: <20221009060813.2289077-1-xen0n@gentoo.org>
Le 09/10/2022 à 08:08, WANG Xuerui a écrit :
> User space has been preferring this syscall for a while, due to its
> closer match with C semantics, and newer platforms such as LoongArch
> apparently have libc implementations that don't fallback to faccessat
> so normal access checks are failing without the emulation in place.
>
> Tested by successfully emerging several packages within a Gentoo loong
> stage3 chroot, emulated on amd64 with help of static qemu-loongarch64.
>
> Reported-by: Andreas K. Hüttel <dilfridge@gentoo.org>
> Signed-off-by: WANG Xuerui <xen0n@gentoo.org>
> ---
> linux-user/strace.list | 3 +++
> linux-user/syscall.c | 9 +++++++++
> 2 files changed, 12 insertions(+)
>
> diff --git a/linux-user/strace.list b/linux-user/strace.list
> index a87415bf3d..3df2184580 100644
> --- a/linux-user/strace.list
> +++ b/linux-user/strace.list
> @@ -178,6 +178,9 @@
> #ifdef TARGET_NR_faccessat
> { TARGET_NR_faccessat, "faccessat" , NULL, print_faccessat, NULL },
> #endif
> +#ifdef TARGET_NR_faccessat2
> +{ TARGET_NR_faccessat2, "faccessat2" , NULL, print_faccessat, NULL },
> +#endif
> #ifdef TARGET_NR_fadvise64
> { TARGET_NR_fadvise64, "fadvise64" , NULL, NULL, NULL },
> #endif
> diff --git a/linux-user/syscall.c b/linux-user/syscall.c
> index 2e954d8dbd..a81f0b65b9 100644
> --- a/linux-user/syscall.c
> +++ b/linux-user/syscall.c
> @@ -9110,6 +9110,15 @@ static abi_long do_syscall1(CPUArchState *cpu_env, int num, abi_long arg1,
> unlock_user(p, arg2, 0);
> return ret;
> #endif
> +#if defined(TARGET_NR_faccessat2) && defined(__NR_faccessat2)
> + case TARGET_NR_faccessat2:
> + if (!(p = lock_user_string(arg2))) {
> + return -TARGET_EFAULT;
> + }
> + ret = get_errno(faccessat(arg1, p, arg3, arg4));
> + unlock_user(p, arg2, 0);
> + return ret;
> +#endif
> #ifdef TARGET_NR_nice /* not on alpha */
> case TARGET_NR_nice:
> return get_errno(nice(arg1));
I have applied this patch to my linux-user-for-7.2 branch,
adding defined(TARGET_NR_faccessat2) for print_faccessat() and removing the defined(__NR_faccessat2)
in syscall.c (as we call the glibc wrapper).
Thanks,
Laurent
next prev parent reply other threads:[~2022-10-21 15:39 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-09 6:08 [PATCH] linux-user: Implement faccessat2 WANG Xuerui
2022-10-10 8:53 ` Helge Deller
2022-10-18 9:58 ` Michael Tokarev
2022-10-18 13:05 ` Luca Bonissi
2022-10-21 15:37 ` Laurent Vivier [this message]
-- strict thread matches above, loose matches on Subject: below --
2022-07-29 20:14 Richard Henderson
2022-07-31 15:38 ` Richard Henderson
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=0825f689-a649-3b3c-796e-ae3d8a3556e0@vivier.eu \
--to=laurent@vivier.eu \
--cc=dilfridge@gentoo.org \
--cc=f4bug@amsat.org \
--cc=qemu-devel@nongnu.org \
--cc=xen0n@gentoo.org \
/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).