[PATCH v2 0/1] plugins: fix syscall filter return value type

Ziyang Zhang posted 1 patch 1 month, 1 week ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20260618082426.790315-1-functioner@sjtu.edu.cn
Maintainers: Laurent Vivier <laurent@vivier.eu>, Helge Deller <deller@gmx.de>, Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>, "Alex Bennée" <alex.bennee@linaro.org>, Alexandre Iooss <erdnaxe@crans.org>
include/plugins/qemu-plugin.h | 2 +-
include/qemu/plugin.h         | 4 ++--
linux-user/syscall.c          | 2 +-
plugins/core.c                | 2 +-
tests/tcg/plugins/setpc.c     | 2 +-
tests/tcg/plugins/syscall.c   | 2 +-
6 files changed, 7 insertions(+), 7 deletions(-)
[PATCH v2 0/1] plugins: fix syscall filter return value type
Posted by Ziyang Zhang 1 month, 1 week ago
Hi,

The sysret value of the syscall filter callback is declared as uint64_t,
but it is semantically signed: the negative range encodes errno. This
makes it int64_t, matching the ret parameter of
qemu_plugin_vcpu_syscall_ret_cb_t, which already uses int64_t for the
same syscall return value.

As discussed on v1, this is not a correctness fix (the filter only sets
sysret, so the bit pattern is the same either way); it is a consistency
and readability improvement, so that the same syscall return value is
typed the same way on the read side and the write side.

I did not bump QEMU_PLUGIN_VERSION, since this only changes the
signedness of an existing argument.

v1: https://lore.kernel.org/qemu-devel/20260612054800.587419-1-functioner@sjtu.edu.cn/

Changes since v1:
- rebased onto current master, where the syscall callbacks now take a
  userdata argument; the filter signatures were adjusted to keep that
  while changing only the sysret type. No functional change otherwise.

Thanks for your review.

Ziyang Zhang (1):
  plugins: use int64_t for the syscall filter return value

 include/plugins/qemu-plugin.h | 2 +-
 include/qemu/plugin.h         | 4 ++--
 linux-user/syscall.c          | 2 +-
 plugins/core.c                | 2 +-
 tests/tcg/plugins/setpc.c     | 2 +-
 tests/tcg/plugins/syscall.c   | 2 +-
 6 files changed, 7 insertions(+), 7 deletions(-)

-- 
2.34.1
Re: [PATCH v2 0/1] plugins: fix syscall filter return value type
Posted by Pierrick Bouvier 1 month ago
On 6/18/2026 1:24 AM, Ziyang Zhang wrote:
> Hi,
> 
> The sysret value of the syscall filter callback is declared as uint64_t,
> but it is semantically signed: the negative range encodes errno. This
> makes it int64_t, matching the ret parameter of
> qemu_plugin_vcpu_syscall_ret_cb_t, which already uses int64_t for the
> same syscall return value.
> 
> As discussed on v1, this is not a correctness fix (the filter only sets
> sysret, so the bit pattern is the same either way); it is a consistency
> and readability improvement, so that the same syscall return value is
> typed the same way on the read side and the write side.
> 
> I did not bump QEMU_PLUGIN_VERSION, since this only changes the
> signedness of an existing argument.
> 
> v1: https://lore.kernel.org/qemu-devel/20260612054800.587419-1-functioner@sjtu.edu.cn/
> 
> Changes since v1:
> - rebased onto current master, where the syscall callbacks now take a
>   userdata argument; the filter signatures were adjusted to keep that
>   while changing only the sysret type. No functional change otherwise.
> 
> Thanks for your review.
> 
> Ziyang Zhang (1):
>   plugins: use int64_t for the syscall filter return value
> 
>  include/plugins/qemu-plugin.h | 2 +-
>  include/qemu/plugin.h         | 4 ++--
>  linux-user/syscall.c          | 2 +-
>  plugins/core.c                | 2 +-
>  tests/tcg/plugins/setpc.c     | 2 +-
>  tests/tcg/plugins/syscall.c   | 2 +-
>  6 files changed, 7 insertions(+), 7 deletions(-)
> 

This was merged into master (b83371668192a705b878e909c5ae9c1233cbd5fb).
Thank you for your contribution!

Regards,
Pierrick