qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Richard Henderson <richard.henderson@linaro.org>
To: Michael Vogt <mvogt@redhat.com>, qemu-devel@nongnu.org
Cc: Michael Vogt <michael.vogt@gmail.com>,
	Laurent Vivier <laurent@vivier.eu>
Subject: Re: [PATCH v6 1/1] linux-user: add openat2 support in linux-user
Date: Sun, 22 Sep 2024 09:25:45 +0200	[thread overview]
Message-ID: <4c10bbdd-41fc-4d7a-98d3-9ba1556519a1@linaro.org> (raw)
In-Reply-To: <65bb234d769980a3b10a655ed19f87966c714e06.1726817664.git.mvogt@redhat.com>

On 9/20/24 11:22, Michael Vogt wrote:
> +static int do_openat2(CPUArchState *cpu_env, abi_long dirfd,
> +                      abi_ptr guest_pathname, abi_ptr guest_open_how,
> +                      abi_long guest_size)

abi_ulong guest_size, as the "real" type is the unsigned size_t.

> +            qemu_log_mask(LOG_UNIMP,
> +                          "Unimplemented openat2 open_how size: %lu\n",
> +                          guest_size);

Use of %lu, and host "long" in general, is always wrong in qemu.

You did not build test everything: this errors out for 32-bit guests.
We must use TARGET_ABI_LONG_lu here.

> @@ -9197,6 +9296,11 @@ static abi_long do_syscall1(CPUArchState *cpu_env, int num, abi_long arg1,
>           fd_trans_unregister(ret);
>           unlock_user(p, arg2, 0);
>           return ret;
> +#if defined(TARGET_NR_openat2)
> +    case TARGET_NR_openat2:
> +        ret = do_openat2(cpu_env, arg1, arg2, arg3, arg4);
> +        return ret;
> +#endif

TARGET_NR_openat2 is universally defined.
This ifdef is not required.

An update to strace.list is missing.

Finally, this does not pass LTP.  In particular,

src/testcases/kernel/syscalls/openat2/openat202.c:62: TFAIL: resolve-no-magiclinks: 
openat2() passed unexpectedly

With RESOLVE_NO_MAGICLINKS, the open of /proc/self/exe handled by maybe_do_fake_open 
should fail with ELOOP.  I *think* that's the only magic link that we handle there, but 
please double check.


r~


      parent reply	other threads:[~2024-09-22  7:26 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-20  9:22 [PATCH v6 0/1] linux-user: add openat2 support in linux-user Michael Vogt
2024-09-20  9:22 ` [PATCH v6 1/1] " Michael Vogt
2024-09-20  9:33   ` Laurent Vivier
2024-09-22  7:25   ` Richard Henderson [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=4c10bbdd-41fc-4d7a-98d3-9ba1556519a1@linaro.org \
    --to=richard.henderson@linaro.org \
    --cc=laurent@vivier.eu \
    --cc=michael.vogt@gmail.com \
    --cc=mvogt@redhat.com \
    --cc=qemu-devel@nongnu.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).