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~