qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Luca Bonissi <qemu@bonslack.org>
To: Michael Tokarev <mjt@tls.msk.ru>, Helge Deller <deller@gmx.de>,
	WANG Xuerui <xen0n@gentoo.org>,
	qemu-devel@nongnu.org
Cc: "Laurent Vivier" <laurent@vivier.eu>,
	"Philippe Mathieu-Daudé" <f4bug@amsat.org>,
	"Andreas K . Hüttel" <dilfridge@gentoo.org>,
	"Richard Henderson" <richard.henderson@linaro.org>
Subject: Re: [PATCH] linux-user: Implement faccessat2
Date: Tue, 18 Oct 2022 15:05:23 +0200	[thread overview]
Message-ID: <99174e4e-cf9e-b685-0911-d0f60a4e13be@bonslack.org> (raw)
In-Reply-To: <a69ae272-b0a3-cea3-b9a7-a678af274c2a@msgid.tls.msk.ru>

On 18/10/22 11:58, Michael Tokarev wrote:
> 10.10.2022 11:53, Helge Deller wrote:
>> On 10/9/22 08:08, WANG Xuerui wrote:
>>> 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.
>>
>> https://lore.kernel.org/qemu-devel/YzLdcnL6x646T61W@p100/

I think this one is the more complete and simplest solution.
Only change:

+#if defined(TARGET_NR_faccessat2) && defined(__NR_faccessat2)

with

+#if defined(TARGET_NR_faccessat2)

(not necessary to have host __NR_faccessat2)

and replace "faccessat2(...)" with "faccessat(...)", so it uses glibc 
implementation, that uses __NR_faccessat2 if host has this syscall, 
otherwise it falls back to faccessat with the addition of fstatat if 
flags!=0 (obviously, the definition of syscall4(... faccessat2 ...) 
should be removed).

> For loongarch64 users this has become essential, because this is a
> new enough arch so that userspace does not bother using older syscalls,
> in this case it uses faccessat2() for everything, and simplest programs
> fail under qemu due to no fallback whatsoever.

I agree that it has become essential. Development with qemu-user is much 
faster than using qemu-system, with all the benefits to use chroot on a 
shared file system.

I tested (and currently testing) the above patch with Slackware-current 
build scripts on x86_64 host: all works fine!

Thanks!
   Luca


  reply	other threads:[~2022-10-18 14:28 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 [this message]
2022-10-21 15:37 ` Laurent Vivier
  -- 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=99174e4e-cf9e-b685-0911-d0f60a4e13be@bonslack.org \
    --to=qemu@bonslack.org \
    --cc=deller@gmx.de \
    --cc=dilfridge@gentoo.org \
    --cc=f4bug@amsat.org \
    --cc=laurent@vivier.eu \
    --cc=mjt@tls.msk.ru \
    --cc=qemu-devel@nongnu.org \
    --cc=richard.henderson@linaro.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).