Mimic the entries for /proc/cpuinfo to what can be seen on the debian
porterbox mitchy.debian.org.
Cc: Thomas Huth <th.huth+qemu@posteo.eu>
Cc: Laurent Vivier <laurent@vivier.eu>
Signed-off-by: Helge Deller <deller@gmx.de>
When a binary is patched or relocated such that the program header table is
moved into a separate PT_LOAD segment (rather than sitting at the start of the
first loadable segment), QEMU's AT_PHDR auxv entry becomes incorrect. The
loader was computing AT_PHDR as load_addr + e_phoff, which assumes the headers
are mapped 1:1 from file offset 0. This breaks when the headers are elsewhere.
The Linux kernel instead locates the PT_LOAD segment that contains e_phoff,
then computes the in-memory address as p_vaddr + (e_phoff - p_offset). This
correctly handles relocated headers.
Fix by:
1. Add phdr_addr field to image_info to cache the resolved address.
2. Initialize to load_addr + e_phoff (fallback for headers outside any PT_LOAD).
3. In the PT_LOAD mapping loop, detect if the segment contains e_phoff and
override with the segment-relative address.
4. Use info->phdr_addr for AT_PHDR instead of the incorrect formula.
Signed-off-by: Akshit Yadav <valium7171@gmail.com>
Reviewed-by: Helge Deller <deller@gmx.de>
Changes:
- [PATCH v2 00/26] plugins: refactor API to maintain state through (Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>)
Link: https://lore.kernel.org/qemu-devel/20260615193526.2883349-1-pierrick.bouvier@oss.qualcomm.com
# -----BEGIN PGP SIGNATURE-----
#
# iQHWBAABCgBAFiEEN8FWlNi6l2Sxlz/btEQ30ZwoYt8FAmoxmRAiHHBpZXJyaWNr
# LmJvdXZpZXJAb3NzLnF1YWxjb21tLmNvbQAKCRC0RDfRnChi3ztKC/45bQ+YlttE
# d2Zdt/N57raaZ8cumzTfpsmnN3Yd+ilIzJizW2OUgdrKrsXsZ73nEwsy9oV2XAGN
# XEaXBlVmLrIXnWRcVYyeKeTr0pJpjhglbLMwXHotgCpCZn77wOkIhTsJlEL83G0/
# F0Vt0o1FbvOepwZXr0jCU9JT/kewT0BptXClfQpyJcGeggj6x/rUsk32Lj7c5kZH
# 6T64T5tJZ5hxndJ/MQCHbsPkUksZT2WD44EYNb3QpVIvPBeoD/02WBfqC+U0fXQ3
# +O/JSfNacgjLWskaPiykft8t9GsRX3DgR5IJJ/WG4y3h9rxpbQKVdn5aKhmNavYK
# QplhS47OashPPbRWBYmKPipQO30sga5dPBt43mU0y1OfKBJR240r5CnFDNtU+XPM
# fwrcdmogleAKAU5rMqvP7fp2usBX0VAzTwtHF6PtswYX46uon/qIQ7E4VYh8mOeV
# DULhi38wKXUKHDwv00pXOvk2n6SOUdoro6XYaJoyArSK+vVFptV6nd4=
# =gcF/
# -----END PGP SIGNATURE-----
# gpg: Signature made Tue 16 Jun 2026 14:42:24 EDT
# gpg: using RSA key 37C15694D8BA9764B1973FDBB44437D19C2862DF
# gpg: issuer "pierrick.bouvier@oss.qualcomm.com"
# gpg: Good signature from "Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>" [unknown]
# gpg: WARNING: The key's User ID is not certified with a trusted signature!
# gpg: There is no indication that the signature belongs to the owner.
# Primary key fingerprint: 37C1 5694 D8BA 9764 B197 3FDB B444 37D1 9C28 62DF
* tag 'pbouvier/pr/plugins-20260616' of https://gitlab.com/p-b-o/qemu: (26 commits)
plugins/cpp: register callbacks using captureless lambda
scripts/checkpatch: remove check on forbidden space before '[' in C++
scripts/checkpatch: ignore spaces required around some operators in C++
plugins: use consistent parameter documentation for userdata
plugins: add userdata to qemu_plugin_register_vcpu_syscall_ret_cb
plugins: remove qemu_plugin_id from qemu_plugin_vcpu_syscall_ret_cb_t
plugins: add userdata to qemu_plugin_register_vcpu_syscall_filter_cb
plugins: remove qemu_plugin_id from qemu_plugin_vcpu_syscall_filter_cb_t
plugins: add userdata to qemu_plugin_register_vcpu_syscall_cb
plugins: remove qemu_plugin_id from qemu_plugin_vcpu_syscall_cb_t
plugins: add userdata to qemu_plugin_vcpu_tb_trans_cb_t
plugins: remove qemu_plugin_id from qemu_plugin_vcpu_tb_trans_cb_t
plugins: remove qemu_plugin_id from qemu_plugin_vcpu_discon_cb_t
plugins: add userdata to qemu_plugin_register_vcpu_discon_cb
plugins: remove type qemu_plugin_vcpu_simple_cb_t
plugins: add userdata to qemu_plugin_vcpu_for_each
plugins: add userdata to qemu_plugin_register_vcpu_resume_cb
plugins: add userdata to qemu_plugin_register_vcpu_idle_cb
plugins: add userdata to qemu_plugin_register_vcpu_exit_cb
plugins: add userdata to qemu_plugin_register_vcpu_init_cb
...
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Changes:
- [PATCH v2] add a note on -shim to direct kernel boot docs (Gerd Hoffmann <kraxel@redhat.com>)
Link: https://lore.kernel.org/qemu-devel/20260612161707.158029-1-kraxel@redhat.com
# -----BEGIN PGP SIGNATURE-----
#
# iQHWBAABCgBAFiEEN8FWlNi6l2Sxlz/btEQ30ZwoYt8FAmoxjhEiHHBpZXJyaWNr
# LmJvdXZpZXJAb3NzLnF1YWxjb21tLmNvbQAKCRC0RDfRnChi376LC/9tQmAT4ebc
# c8aJ3cai880lZzN8/Q7k9ZWZFfyAz44G5jNLaA+A7AZOE4LQSnMrVgixBF8q4MbQ
# NnTaDMPY/CbI6qO1Jzt0RycCJq36KiKfB/XllayGnLMTW9KNE6rK/uq88bAKSeUu
# 9yAD2Uc9Hbx828xcGuuE1WqxzSRRVe0pVR0k8X90NbDOVXGRjX1FDP8P1sOra2tU
# eUWzXFy1hzBnY+0uZ2GqqGGhuEv8Kj59kl04QhxwBy+F//Oy+b5j51g5xeaQJNXW
# vuEzh/88VD8yqUDE6V1JjAclCzPTTH1+vBUp5FTeqyWIJRW3ZqmY+LPm2a9b7a5b
# g0WUbxcP8ajhw5mRqeY7Owi/wKX7Mhjy28HiZVQSslJXhn/Zd5fkDpGFdSwPCcCs
# iXbTPjwaPWYlQfietzbiu0BqSaS9lyDFhi2C+SkR3Vp/AsP6rnkdqd2SOSC9eecH
# tKpQAhO8wgOWWStsPyNasr1i58tA8Ndqai8VgY+R4mCmRC+E5qyAzNY=
# =4rhM
# -----END PGP SIGNATURE-----
# gpg: Signature made Tue 16 Jun 2026 13:55:29 EDT
# gpg: using RSA key 37C15694D8BA9764B1973FDBB44437D19C2862DF
# gpg: issuer "pierrick.bouvier@oss.qualcomm.com"
# gpg: Good signature from "Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>" [unknown]
# gpg: WARNING: The key's User ID is not certified with a trusted signature!
# gpg: There is no indication that the signature belongs to the owner.
# Primary key fingerprint: 37C1 5694 D8BA 9764 B197 3FDB B444 37D1 9C28 62DF
* tag 'pbouvier/pr/docs-20260616' of https://gitlab.com/p-b-o/qemu:
add a note on -shim to direct kernel boot docs
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
The IGVM spec defines bit 31 of the variable header type as an
optional flag: if set, a loader that does not recognize the header
type may safely skip it. If clear, the loader must reject the file.
Currently, the optional bit is not stripped before comparing header
types, so headers with the bit set fail to match any known type
and are rejected.
Mask bit 31 before comparing header types throughout the IGVM
loader, and skip with a warning any unrecognized header that has
the optional bit set.
Fixes: c1d466d267 ("backends/igvm: Add IGVM loader and configuration")
Signed-off-by: Luigi Leonardi <leonardi@redhat.com>
Message-ID: <20260609-igvm_optional-v2-2-b1f1f08dc40e@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Make sure we actually have two input characters available before going
to parse two hex digits. Fixes one byte buffer overflow of the output
buffer in case the input string has an odd number of characters.
Fixes: CVE-2026-48915
Fixes: 12058948ab ("hw/uefi: add var-service-json.c + qapi for NV vars.")
Reported-by: Feifan Qian <bea1e@proton.me>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Message-ID: <20260526135948.599148-1-kraxel@redhat.com>
We can now demonstrate what previous changes allow us to do. Since all
callbacks have a userdata pointer, we can use that mechanism to move an
object through all of them.
In other words, we can now have stateful plugins without resorting to
any global variable.
As an example, we implement tb counting plugin with our cpp plugin. It
produces an output similar to hotblocks, with same performance.
Reviewed-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org>
Link: https://lore.kernel.org/qemu-devel/20260615193526.2883349-27-pierrick.bouvier@oss.qualcomm.com
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
C++ has a different style when it comes to space around references,
dereferences, so don't report it.
Also, closing templates with >> gets wrongly confused with >> operator,
so just relax this check.
Some examples:
ERROR: spaces required around that '&' (ctx:WxV)
+ auto &[counter, p] = *static_cast<TbData*>(udata);
^
ERROR: spaces required around that '*' (ctx:VxO)
+ auto &[counter, p] = *static_cast<TbData*>(udata);
^
ERROR: spaces required around that '>>' (ctx:VxW)
+ std::vector<std::pair<Vaddr, uint64_t>> v; ^
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org>
Link: https://lore.kernel.org/qemu-devel/20260615193526.2883349-25-pierrick.bouvier@oss.qualcomm.com
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>