On Fri, 12 Jun 2026 11:43:57 +0100, Alex Bennée wrote:
All of the arguments here are abi_long which go to int32_t or
target_long->int64_t so perhaps we should be using that for all args to
ensure signedness is correct?
You're right that abi_long is signed. I only changed the return value to
keep this callback consistent with the two syscall callbacks that
existed from the first version of the plugin syscall API:
qemu_plugin_vcpu_syscall_cb_t and qemu_plugin_vcpu_syscall_ret_cb_t.
Both use int64_t for num and int64_t for the return value, while the
entry callback passes a1..a8 as uint64_t. This patch matches that.
I'd prefer to keep the arguments as uint64_t. They don't share a single
signedness: pointers and size_t are unsigned, while offsets and fds are
signed. At this boundary they are just register-width words that the
handler casts per syscall, so the correct extension is per-argument-type
(glibc handles them that way too [1]), and forcing them all to int64_t
would be wrong for pointer arguments in particular.
Changing the whole argument vector would also touch several APIs and all
their callers, which is well beyond the scope of this small signedness
fix. So I'd rather keep it to the return value, the one part of this
interface with a well-defined signed meaning.
[1]
https://github.com/bminor/glibc/blob/master/sysdeps/unix/sysv/linux/x86_64/x32/sysdep.h#L50
Thanks,
Ziyang Zhang