[PATCH v4 0/2] linux-user: introduce syscall-filter plugin API

Ziyang Zhang posted 2 patches 1 month, 3 weeks ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20251214144620.179282-1-functioner@sjtu.edu.cn
Maintainers: Riku Voipio <riku.voipio@iki.fi>, Laurent Vivier <laurent@vivier.eu>, "Alex Bennée" <alex.bennee@linaro.org>, Alexandre Iooss <erdnaxe@crans.org>, Mahmoud Mandour <ma.mandourr@gmail.com>, Pierrick Bouvier <pierrick.bouvier@linaro.org>
include/qemu/plugin-event.h                   |  1 +
include/qemu/plugin.h                         | 33 ++++++++++++-----
include/qemu/qemu-plugin.h                    | 32 ++++++++++++++++
include/user/syscall-trace.h                  | 17 +++++++++
linux-user/syscall.c                          |  7 +++-
plugins/api.c                                 |  7 ++++
plugins/core.c                                | 37 +++++++++++++++++++
tests/tcg/multiarch/Makefile.target           |  4 +-
.../multiarch/test-plugin-syscall-filter.c    | 35 ++++++++++++++++++
tests/tcg/plugins/syscall.c                   | 19 ++++++++++
10 files changed, 180 insertions(+), 12 deletions(-)
create mode 100644 tests/tcg/multiarch/test-plugin-syscall-filter.c
[PATCH v4 0/2] linux-user: introduce syscall-filter plugin API
Posted by Ziyang Zhang 1 month, 3 weeks ago
We choose a smaller magic syscall number to avoid the illegal instruction
exception [1] on qemu-arm.

PATCH v4:
  1. Modify some comments

PATCH v3:
  1. Change to a smaller magic syscall number and add comments
  2. Set register flags out of the for-loop

PATCH v2:
  1. Rebased on newest version of master

PATCH v1:
  1. Format the code

RFC v2:
  1. Simplify the syscall filter mechanism and remove fork-cpu
  2. Add QEMU_PLUGIN_EV_VCPU_SYSCALL_FILTER enum

RFC v1:
  1. Add syscall filter registry
  2. Add fork-cpu interface to re-enter cpu_loop when handling syscalls

Ziyang Zhang (2):
  linux-user: add plugin API to filter syscalls
  tcg tests: add a test to verify the syscall filter plugin API

 include/qemu/plugin-event.h                   |  1 +
 include/qemu/plugin.h                         | 33 ++++++++++++-----
 include/qemu/qemu-plugin.h                    | 32 ++++++++++++++++
 include/user/syscall-trace.h                  | 17 +++++++++
 linux-user/syscall.c                          |  7 +++-
 plugins/api.c                                 |  7 ++++
 plugins/core.c                                | 37 +++++++++++++++++++
 tests/tcg/multiarch/Makefile.target           |  4 +-
 .../multiarch/test-plugin-syscall-filter.c    | 35 ++++++++++++++++++
 tests/tcg/plugins/syscall.c                   | 19 ++++++++++
 10 files changed, 180 insertions(+), 12 deletions(-)
 create mode 100644 tests/tcg/multiarch/test-plugin-syscall-filter.c

-- 
2.34.1
Re: [PATCH v4 0/2] linux-user: introduce syscall-filter plugin API
Posted by Pierrick Bouvier 5 days, 4 hours ago
On 12/14/25 6:46 AM, Ziyang Zhang wrote:
> We choose a smaller magic syscall number to avoid the illegal instruction
> exception [1] on qemu-arm.
> 
> PATCH v4:
>    1. Modify some comments
> 
> PATCH v3:
>    1. Change to a smaller magic syscall number and add comments
>    2. Set register flags out of the for-loop
> 
> PATCH v2:
>    1. Rebased on newest version of master
> 
> PATCH v1:
>    1. Format the code
> 
> RFC v2:
>    1. Simplify the syscall filter mechanism and remove fork-cpu
>    2. Add QEMU_PLUGIN_EV_VCPU_SYSCALL_FILTER enum
> 
> RFC v1:
>    1. Add syscall filter registry
>    2. Add fork-cpu interface to re-enter cpu_loop when handling syscalls
> 
> Ziyang Zhang (2):
>    linux-user: add plugin API to filter syscalls
>    tcg tests: add a test to verify the syscall filter plugin API
> 
>   include/qemu/plugin-event.h                   |  1 +
>   include/qemu/plugin.h                         | 33 ++++++++++++-----
>   include/qemu/qemu-plugin.h                    | 32 ++++++++++++++++
>   include/user/syscall-trace.h                  | 17 +++++++++
>   linux-user/syscall.c                          |  7 +++-
>   plugins/api.c                                 |  7 ++++
>   plugins/core.c                                | 37 +++++++++++++++++++
>   tests/tcg/multiarch/Makefile.target           |  4 +-
>   .../multiarch/test-plugin-syscall-filter.c    | 35 ++++++++++++++++++
>   tests/tcg/plugins/syscall.c                   | 19 ++++++++++
>   10 files changed, 180 insertions(+), 12 deletions(-)
>   create mode 100644 tests/tcg/multiarch/test-plugin-syscall-filter.c
> 

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

Regards,
Pierrick
Re: [PATCH v4 0/2] linux-user: introduce syscall-filter plugin API
Posted by Alex Bennée 1 month, 3 weeks ago
Ziyang Zhang <functioner@sjtu.edu.cn> writes:

> We choose a smaller magic syscall number to avoid the illegal instruction
> exception [1] on qemu-arm.

Queued to plugins/next, thanks.

-- 
Alex Bennée
Virtualisation Tech Lead @ Linaro