Hi,

I thought I'd post the current state of the plugins/next tree for
comments and reviews.

Firstly we have a bunch of fixes for the hotblocks plugins from Alex
Bradbury.

We also have Ziyang Zhang's syscall filter patches which allow plugins
to filter (and/or replace) syscalls. The initial use for this would be
for something like Lorelei:

  https://pretalx.com/kvm-forum-2025/talk/KFSGHS/

where using plugins avoids needing to integrate complex logic into
linux-user itself. No doubt the reverse engineers would also find the
capability useful.

There is also a discussion thread about a general purpose PC setting
patch:

  Message-Id: e64f4a1f-ac43-487b-f0af-08de04dbd9f1
  Subject: [RFC PATCH v2 0/2] Enable PC diversion via the plugin API
  From: Florian Hofhammer <[email protected]>
  Date: Mon, 6 Oct 2025 15:21:21 +0200
  Message-ID: <[email protected]>

but as we still need to work out a nice way to handle removing the PC
from the register list I've left that out for now.

Finally I was doing some hacking around on my kvm/trap-me-harder
patches and I wanted to check when IRQ's occurred and what systems
registers were touched when. I then discovered that the ICC_ registers
were not available to plugins due to being created after the CPUs are
initialised. I've tried several approaches but it seems having a clean
vCPU initialisation after machine creation is tricky so instead I've
split the hooks into creation and reset and moved the plugin visable
callback to reset. However this may change the assumptions about what
to do in vcpu_init.

You can see some of the ugliness in the new systrace plugin which has
to jump through hoops to deal with the fact the number of registers it
can see changes several times. Unfortunately this seems to trigger a
corruption bug which I haven't nailed down yet while running:

./qemu-system-aarch64 \
                  -machine type=virt,gic-version=3 \
                  -cpu neoverse-n1 \
                  -smp 4 \
                  -serial mon:stdio \
                  -m 1024 \
                  -accel tcg \
                  -kernel 
~/lsrc/linux.git/builds/arm64.initramfs/arch/arm64/boot/Image.gz \
                  -append "console=ttyAMA0" \
                  -display none -d unimp,plugin,cpu_reset -plugin 
./contrib/plugins/libsystrace.so,show_frompc=on,tracksw=msr,reg=icc\* -D 
boot.log

I'm open to better ideas about how to solve this particular problem.

Anyway happy holidays everyone, see you all in the new year ;-)

Alex.

Alex Bennée (5):
  plugins: shorten aggressively long name
  plugins: split init_hook into create and reset
  target/arm: defer creation of gdb register until machine created
  contrib/plugins: add systrace plugin for tracking exceptions and irqs
  target/arm: allow gdb to read ARM_CP_NORAW regs (!upstream)

Alex Bradbury (5):
  contrib/plugins/hotblocks: Correctly free sorted counts list
  contrib/plugins/hotblocks: Fix off by one error in iteration of sorted
    blocks
  contrib/plugins/hotblocks: Print uint64_t with PRIu64 rather than
    PRId64
  docs/about/emulation: Add documentation for hotblocks plugin arguments
  contrib/plugins/hotblocks: Allow limit to be set as a command line
    argument

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

 docs/about/emulation.rst                      |  12 +
 include/qemu/plugin-event.h                   |   1 +
 include/qemu/plugin.h                         |  52 +-
 include/qemu/qemu-plugin.h                    |  40 +-
 include/user/syscall-trace.h                  |  17 +
 contrib/plugins/cflow.c                       |  22 +-
 contrib/plugins/hotblocks.c                   |  20 +-
 contrib/plugins/howvec.c                      |   2 +-
 contrib/plugins/stoptrigger.c                 |  10 +-
 contrib/plugins/systrace.c                    | 572 ++++++++++++++++++
 hw/core/cpu-common.c                          |  21 +-
 linux-user/syscall.c                          |   7 +-
 plugins/api.c                                 |   9 +-
 plugins/core.c                                |  68 ++-
 target/arm/cpu.c                              |  33 +
 target/arm/gdbstub.c                          |   6 +-
 target/arm/helper.c                           |  15 +-
 .../multiarch/test-plugin-syscall-filter.c    |  35 ++
 tests/tcg/plugins/discons.c                   |  18 +-
 tests/tcg/plugins/inline.c                    |   6 +-
 tests/tcg/plugins/insn.c                      |   5 +-
 tests/tcg/plugins/syscall.c                   |  19 +
 contrib/plugins/meson.build                   |   2 +-
 tests/tcg/multiarch/Makefile.target           |   4 +-
 24 files changed, 922 insertions(+), 74 deletions(-)
 create mode 100644 contrib/plugins/systrace.c
 create mode 100644 tests/tcg/multiarch/test-plugin-syscall-filter.c

-- 
2.47.3


Reply via email to