Misc fixes patches
Subsystems (2)
[PULL 06/13] hw/ppc: mark 'pseries' as a secure machine
In reply to Daniel P. BerrangéThe 'pseries' ppc machine is already declared secure in docs/system/security.rst, due too its intended usage in virtualization scenarios.
--- hw/ppc/spapr.c | 1 + 1 file changed, 1 insertion(+)
hw/ppc/spapr.c +1 -0
@@ -4751,6 +4751,7 @@ static void spapr_machine_latest_class_options(MachineClass *mc) .name = MACHINE_VER_TYPE_NAME("pseries", __VA_ARGS__), \ .parent = TYPE_SPAPR_MACHINE, \ .class_init = MACHINE_VER_SYM(class_init, spapr, __VA_ARGS__), \ + .secure = true, \ }; \ static void MACHINE_VER_SYM(register, spapr, __VA_ARGS__)(void) \ { \
Signature · 1 line
2.56.0
[PULL 13/13] accel/nitro: mark 'nitro' accelerator as secure
In reply to Daniel P. BerrangéThe 'nitro' accelerator is used with a real AWS deployment and thus is considered to be secure.
--- accel/nitro/nitro-accel.c | 1 + 1 file changed, 1 insertion(+)
accel/nitro/nitro-accel.c +1 -0
@@ -251,6 +251,7 @@ static const TypeInfo nitro_accel_type = { .parent = TYPE_ACCEL, .instance_size = sizeof(NitroAccelState), .class_init = nitro_accel_class_init, + .secure = true, };module_obj (TYPE_NITRO_ACCEL );
Signature · 1 line
2.56.0
[PULL 02/13] util/cutils: Use getexecpath() on OpenBSD for qemu_init_exec_dir()
In reply to Daniel P. BerrangéFrom: Brad Smith <[email protected]>
util/cutils: Use getexecpath() on OpenBSD for qemu_init_exec_dir()
OpenBSD has introduced a function getexecpath() to be able to retrieve the executable name and path.
--- meson.build | 8 ++++++++ util/cutils.c | 6 ++++++ 2 files changed, 14 insertions(+)
meson.build +8 -0
@@ -3040,6 +3040,14 @@ config_host_data.set('CONFIG_ELF_AUX_INFO', cc.links(osdep_prefix + ''' return hwcap; }''')) +config_host_data.set('CONFIG_GETEXECPATH', cc.links(osdep_prefix + ''' + #include <limits.h> + #include <unistd.h> + int main(void) { + char buf[PATH_MAX]; + getexecpath(buf, sizeof(buf)); + }''')) + config_host_data.set('CONFIG_USBFS', have_linux_user and cc.compiles(''' #include <linux/usbdevice_fs.h>
util/cutils.c +6 -0
@@ -1097,6 +1097,12 @@ void qemu_init_exec_dir(const char *argv0) p = buf; } } +#elif defined(__OpenBSD__) && defined(CONFIG_GETEXECPATH) + { +if (getexecpath (buf,sizeof (buf)) ==0 ) { + p = buf; + } + }#elif defined(__APPLE__) {char fpath[PATH_MAX ];
Signature · 1 line
2.56.0
[PULL 12/13] accel/xen: mark xen accelerator as secure
In reply to Daniel P. BerrangéXen is servicing virtualization use cases which must provide security and actively maintained.
--- accel/xen/xen-all.c | 1 + 1 file changed, 1 insertion(+)
accel/xen/xen-all.c +1 -0
@@ -147,6 +147,7 @@ static const TypeInfo xen_accel_type = { .name = TYPE_XEN_ACCEL, .parent = TYPE_ACCEL, .class_init = xen_accel_class_init, + .secure = true, };static void xen_accel_ops_class_init (ObjectClass *oc,const void *data)
Signature · 1 line
2.56.0
[PULL 08/13] hw/s390x: mark 's390x-ccw-virtio' as a secure machine
In reply to Daniel P. BerrangéThe 's390x-ccw-virtio' s390x machine is already declared secure in docs/system/security.rst, due too its intended usage in virtualization scenarios.
--- hw/s390x/s390-virtio-ccw.c | 1 + 1 file changed, 1 insertion(+)
hw/s390x/s390-virtio-ccw.c +1 -0
@@ -986,6 +986,7 @@ static const TypeInfo ccw_machine_info = { .name = MACHINE_VER_TYPE_NAME("s390-ccw-virtio", __VA_ARGS__), \ .parent = TYPE_S390_CCW_MACHINE, \ .class_init = MACHINE_VER_SYM(class_init, ccw, __VA_ARGS__), \ + .secure = true, \ }; \ static void MACHINE_VER_SYM(register, ccw, __VA_ARGS__)(void) \ { \
Signature · 1 line
2.56.0
[PULL 07/13] hw/riscv: mark 'virt' as a secure machine
In reply to Daniel P. BerrangéThe 'virt' riscv machine is already declared secure in docs/system/security.rst, due too its intended usage in virtualization scenarios.
--- hw/riscv/virt.c | 1 + 1 file changed, 1 insertion(+)
hw/riscv/virt.c +1 -0
@@ -1201,6 +1201,7 @@ static const TypeInfo virt_machine_typeinfo = { .name = MACHINE_TYPE_NAME("virt"), .parent = TYPE_MACHINE, .class_init = virt_machine_class_init, + .secure = true, .instance_init = virt_machine_instance_init, .instance_finalize = virt_machine_instance_finalize, .instance_size = sizeof(RISCVVirtState),
Signature · 1 line
2.56.0
[PULL 05/13] hw/loongarch: mark 'virt' as a secure machine
In reply to Daniel P. BerrangéThe 'virt' loongarch machine is already declared secure in docs/system/security.rst, due too its intended usage in virtualization scenarios.
--- hw/loongarch/virt.c | 1 + 1 file changed, 1 insertion(+)
hw/loongarch/virt.c +1 -0
@@ -1553,6 +1553,7 @@ static void virt_class_init(ObjectClass *oc, const void *data) .name = MACHINE_VER_TYPE_NAME("virt", __VA_ARGS__), \ .parent = TYPE_LOONGARCH_VIRT_MACHINE, \ .class_init = MACHINE_VER_SYM(class_init, virt, __VA_ARGS__), \ + .secure = true, \ }; \ static void MACHINE_VER_SYM(register, virt, __VA_ARGS__)(void) \ { \
Signature · 1 line
2.56.0
[PULL 10/13] hw/nitro: mark 'nitro' machine as secure
In reply to Daniel P. BerrangéUnlike the 'nitro-enclave' machine which provides emulation, the 'nitro' machine is used with a real AWS deployment and thus is considered to be secure.
--- hw/nitro/machine.c | 1 + 1 file changed, 1 insertion(+)
hw/nitro/machine.c +1 -0
@@ -261,6 +261,7 @@ static const TypeInfo nitro_machine_info = { .parent = TYPE_MACHINE, .instance_size = sizeof(NitroMachineState), .class_init = nitro_machine_class_init, + .secure = true, };static void nitro_machine_register (void )
Signature · 1 line
2.56.0
[PULL 09/13] hw: mark xenpv, xenpvh, xenfv as secure machines
In reply to Daniel P. BerrangéThe Xen machines are already declared secure in docs/system/security.rst, due too their intended usage in virtualization scenarios.
--- hw/arm/xen-pvh.c | 1 + hw/i386/pc_piix.c | 4 ++-- hw/i386/xen/xen-pvh.c | 1 + hw/xenpv/xen_machine_pv.c | 2 +- 4 files changed, 5 insertions(+), 3 deletions(-)
hw/arm/xen-pvh.c +1 -0
@@ -95,6 +95,7 @@ static const TypeInfo xen_arm_machine_type = { .class_init = xen_arm_machine_class_init, .instance_size = sizeof(XenPVHMachineState), .instance_init = xen_arm_instance_init, + .secure = true, };static void xen_arm_machine_register_types (void )
hw/i386/pc_piix.c +2 -2
@@ -667,6 +667,6 @@ static void xenfv_machine_4_2_options(MachineClass *m) m->default_machine_opts = "accel=xen,suppress-vmdesc=on"; } -DEFINE_PC_MACHINE (xenfv_4_2,"xenfv-4.2" , pc_xen_hvm_init, - xenfv_machine_4_2_options); +DEFINE_SECURE_PC_MACHINE (xenfv_4_2,"xenfv-4.2" , pc_xen_hvm_init, + xenfv_machine_4_2_options);#endif
hw/i386/xen/xen-pvh.c +1 -0
@@ -115,6 +115,7 @@ static const TypeInfo xen_pvh_x86_machine_type = { .class_init = xen_pvh_machine_class_init, .instance_init = xen_pvh_instance_init, .instance_size = sizeof(XenPVHx86State), + .secure = true, };static void xen_pvh_machine_register_types (void )
hw/xenpv/xen_machine_pv.c +1 -1
@@ -69,4 +69,4 @@ static void xenpv_machine_init(MachineClass *mc) mc->default_machine_opts ="accel=xen" ; } -DEFINE_MACHINE ("xenpv" , xenpv_machine_init) +DEFINE_SECURE_MACHINE ("xenpv" , xenpv_machine_init)
Signature · 1 line
2.56.0
[PULL 03/13] hw/arm: mark 'virt' as a secure machine
In reply to Daniel P. BerrangéThe 'virt' arm machine is already declared secure in docs/system/security.rst, due too its intended usage in virtualization scenarios.
--- hw/arm/virt.c | 1 + 1 file changed, 1 insertion(+)
hw/arm/virt.c +1 -0
@@ -132,6 +132,7 @@ static void arm_virt_compat_default_set(MachineClass *mc) .parent = TYPE_VIRT_MACHINE, \ .class_init = MACHINE_VER_SYM(class_init, virt, __VA_ARGS__), \ .is_available = target_base_arm, \ + .secure = true, \ }; \ static void MACHINE_VER_SYM(register, virt, __VA_ARGS__)(void) \ { \
Signature · 1 line
2.56.0
[PULL 04/13] hw/i386: mark 'microvm', 'i440fx', 'q35' as secure machines
In reply to Daniel P. BerrangéThe 'microvm', 'i440fx', 'q35' i386 machines are already declared secure in docs/system/security.rst, due too their intended usage in virtualization scenarios.
--- hw/i386/microvm.c | 1 + include/hw/i386/pc.h | 1 + 2 files changed, 2 insertions(+)
hw/i386/microvm.c +1 -0
@@ -736,6 +736,7 @@ static const TypeInfo microvm_machine_info = { .instance_init = microvm_machine_initfn, .class_size = sizeof(MicrovmMachineClass), .class_init = microvm_class_init, + .secure = true, .interfaces = (const InterfaceInfo []) { {TYPE_HOTPLUG_HANDLER }, { }
include/hw/i386/pc.h +1 -0
@@ -330,6 +330,7 @@ extern const size_t pc_compat_4_1_len; .name = MACHINE_VER_TYPE_NAME(namestr, __VA_ARGS__), \ .parent = TYPE_PC_MACHINE, \ .class_init = MACHINE_VER_SYM(class_init, namesym, __VA_ARGS__), \ + .secure = true, \ }; \ static void MACHINE_VER_SYM(register, namesym, __VA_ARGS__)(void) \ { \
Signature · 1 line
2.56.0
The following changes since commit 56afd82bd4db9688f1c1c9d0e2ea163b8cde3283:
Merge tag 'qemu-sparc-20261101' of https://github.com/mcayland/qemu into staging (2026-11-01 08:37:48 -0800)
are available in the Git repository at:
https://gitlab.com/berrange/qemu tags/misc-fixes-pull-request
for you to fetch changes up to f4b560dd12612fa12217f3a621ab54dfb6157040:
accel/nitro: mark 'nitro' accelerator as secure (2026-11-02 11:08:45 +0000)
----------------------------------------------------------------
* Mark virtualization related machine types as secure
* Mark KVM, Xen and Nitro accelerators as secure
* Use getexecpath on OpenBSD
* Use qemu_dup() over dup()
----------------------------------------------------------------
Brad Smith (1):
util/cutils: Use getexecpath() on OpenBSD for qemu_init_exec_dir()
Daniel P. Berrangé (11):
hw/arm: mark 'virt' as a secure machine
hw/i386: mark 'microvm', 'i440fx', 'q35' as secure machines hw/loongarch: mark 'virt' as a secure machine hw/ppc: mark 'pseries' as a secure machine hw/riscv: mark 'virt' as a secure machine hw/s390x: mark 's390x-ccw-virtio' as a secure machine
hw: mark xenpv, xenpvh, xenfv as secure machines hw/nitro: mark 'nitro' machine as secure accel/kvm: mark kvm accelerator as secure accel/xen: mark xen accelerator as secure accel/nitro: mark 'nitro' accelerator as secure
Filip Hejsek (1):
treewide: use qemu_dup() instead of dup()
accel/kvm/kvm-all.c | 1 + accel/nitro/nitro-accel.c | 1 + accel/xen/xen-all.c | 1 + hw/arm/virt.c | 1 + hw/arm/xen-pvh.c | 1 + hw/i386/microvm.c | 1 + hw/i386/pc_piix.c | 4 ++-- hw/i386/xen/xen-pvh.c | 1 + hw/loongarch/virt.c | 1 + hw/nitro/machine.c | 1 + hw/ppc/spapr.c | 1 + hw/riscv/virt.c | 1 + hw/s390x/s390-virtio-ccw.c | 1 + hw/virtio/virtio.c | 2 +- hw/xenpv/xen_machine_pv.c | 2 +- include/hw/i386/pc.h | 1 + io/channel-file.c | 2 +- meson.build | 8 ++++++++ migration/cpr-exec.c | 2 +- qemu-nbd.c | 2 +- system/vl.c | 9 +-------- tests/qtest/bios-tables-test.c | 2 +- tests/unit/test-util-sockets.c | 6 +++--- tests/unit/test-vmstate.c | 2 +- ui/dmabuf.c | 2 +- util/cutils.c | 6 ++++++ 26 files changed, 41 insertions(+), 21 deletions(-)
Signature · 1 line
2.56.0
[PULL 11/13] accel/kvm: mark kvm accelerator as secure
KVM is servicing virtualization use cases which must provide security and actively maintained.
--- accel/kvm/kvm-all.c | 1 + 1 file changed, 1 insertion(+)
accel/kvm/kvm-all.c +1 -0
@@ -4353,6 +4353,7 @@ static const TypeInfo kvm_accel_type = { .instance_finalize = kvm_accel_finalize, .class_init = kvm_accel_class_init, .instance_size = sizeof(KVMState), + .secure = true, };static void kvm_type_init (void )
Signature · 1 line
2.56.0
[PULL 01/13] treewide: use qemu_dup() instead of dup()
In reply to Daniel P. BerrangéFrom: Filip Hejsek <[email protected]>
Use qemu_dup() to ensure the cloexec flag is set on dup'd fds.
The only direct users of dup() are now guest syscalls in the user emulators and the implementation of qemu_dup() itself.
--- hw/virtio/virtio.c | 2 +- io/channel-file.c | 2 +- migration/cpr-exec.c | 2 +- qemu-nbd.c | 2 +- system/vl.c | 9 +-------- tests/qtest/bios-tables-test.c | 2 +- tests/unit/test-util-sockets.c | 6 +++--- tests/unit/test-vmstate.c | 2 +- ui/dmabuf.c | 2 +- 9 files changed, 11 insertions(+), 18 deletions(-)
hw/virtio/virtio.c +1 -1
@@ -3204,7 +3204,7 @@ VirtioSharedMemoryMapping *virtio_shared_memory_mapping_new(uint8_t shmid,return NULL ; } - fd =dup (fd); + fd =qemu_dup (fd);if (fd <0 ) {error_report ("Failed to duplicate fd: %s" ,strerror (errno));return NULL ;
io/channel-file.c +1 -1
@@ -54,7 +54,7 @@ qio_channel_file_new_fd(int fd)QIOChannelFile *qio_channel_file_new_dupfd (int fd,Error **errp) { -int newfd =dup (fd); +int newfd =qemu_dup (fd);if (newfd <0 ) {error_setg_errno (errp, errno,"Could not dup FD %d" , fd);
migration/cpr-exec.c +1 -1
@@ -44,7 +44,7 @@ bool cpr_exec_persist_state(QEMUFile *f, Error **errp) {QIOChannelFile *fioc =QIO_CHANNEL_FILE (qemu_file_get_ioc (f));/* coverity[leaked_storage] - mfd intentionally kept open across exec() */ -int mfd =dup (fioc->fd); +int mfd =qemu_dup (fioc->fd);char val[16 ];/* Remember mfd in environment for post-exec load */
qemu-nbd.c +1 -1
@@ -976,7 +976,7 @@ int main(int argc, char **argv)/* Remember parent's stderr if we will be restoring it. */ if (opts.verbose/* fork_process is set */ ) { - opts.old_stderr =dup (STDERR_FILENO ); + opts.old_stderr =qemu_dup (STDERR_FILENO );if (opts.old_stderr <0 ) {error_report ("Could not dup original stderr: %s" ,strerror (errno));
system/vl.c +1 -8
@@ -614,14 +614,7 @@ static int parse_add_fd(void *opaque, QemuOpts *opts, Error **errp)return -1 ; } -#ifdef F_DUPFD_CLOEXEC - dupfd =fcntl (fd,F_DUPFD_CLOEXEC ,0 ); -#else - dupfd =dup (fd); -if (dupfd !=-1 ) { -qemu_set_cloexec (dupfd); - } -#endif + dupfd =qemu_dup (fd);if (dupfd ==-1 ) {error_setg_errno (errp, errno,"error duplicating fd" );return -1 ;
tests/qtest/bios-tables-test.c +1 -1
@@ -529,7 +529,7 @@ static void test_acpi_asl(test_data *data)const char *diff_cmd = diff_env ? diff_env :"diff -U 16" ;char *diff =g_strdup_printf ("%s %s %s" , diff_cmd, exp_sdt->asl_file, sdt->asl_file); -int out =dup (STDOUT_FILENO ); +int out =qemu_dup (STDOUT_FILENO ); int ret G_GNUC_UNUSED;int dupret;
tests/unit/test-util-sockets.c +3 -3
@@ -62,7 +62,7 @@ int monitor_get_fd(Monitor *mon, const char *fdname, Error **errp)error_setg (errp,"No fd named %s" , fdname);return -1 ; } -return dup (mon_fd); +return qemu_dup (mon_fd); }/*
@@ -115,7 +115,7 @@ static void test_socket_fd_pass_name_bad(void) cur_mon =g_malloc (1 );/* Fake a monitor */ mon_fdname ="myfd" ; - mon_fd =dup (STDOUT_FILENO ); + mon_fd =qemu_dup (STDOUT_FILENO ); g_assert_cmpint(mon_fd, >, STDERR_FILENO); addr.type =SOCKET_ADDRESS_TYPE_FD ;
@@ -189,7 +189,7 @@ static void test_socket_fd_pass_num_bad(void)int fd, sfd;g_assert (cur_mon ==NULL ); - sfd =dup (STDOUT_FILENO ); + sfd =qemu_dup (STDOUT_FILENO ); addr.type =SOCKET_ADDRESS_TYPE_FD ; addr.u.fd.str =g_strdup_printf ("%d" , sfd);
tests/unit/test-vmstate.c +1 -1
@@ -42,7 +42,7 @@ static QEMUFile *open_test_file(bool write)QIOChannel *ioc;QEMUFile *f; - fd =dup (temp_fd); + fd =qemu_dup (temp_fd);g_assert (fd >=0 );lseek (fd,0 ,SEEK_SET );if (write) {
ui/dmabuf.c +1 -1
@@ -95,7 +95,7 @@ void qemu_dmabuf_dup_fds(QemuDmaBuf *dmabuf, int *fds, int nfds)assert (nfds >= dmabuf->num_planes);for (i =0 ; i < dmabuf->num_planes; i++) { - fds[i] = dmabuf->fd[i] >=0 ?dup (dmabuf->fd[i]) :-1 ; + fds[i] = dmabuf->fd[i] >=0 ?qemu_dup (dmabuf->fd[i]) :-1 ; } }
Signature · 1 line
2.56.0
Quoted 10 lines · Daniel P. Berrangé
The following changes since commit
56afd82bd4db9688f1c1c9d0e2ea163b8cde3283:Merge tag 'qemu-sparc-20261101' ofhttps://github.com/mcayland/qemu into staging (2026-11-01 08:37:48 -0800)are available in the Git repository at:
https://gitlab.com/berrange/qemu tags/misc-fixes-pull-request
for you to fetch changes up to
f4b560dd12612fa12217f3a621ab54dfb6157040:
Quoted 7 lines
accel/nitro: mark 'nitro' accelerator as secure (2026-11-02 11:08:45 +0000)----------------------------------------------------------------
* Mark virtualization related machine types as secure
* Mark KVM, Xen and Nitro accelerators as secure
* Use getexecpath on OpenBSD
* Useqemu_dup()overdup()
Fails build on windows:
https://gitlab.com/qemu-project/qemu/-/jobs/17671461626#L2066
Quoted 4 lines
../io/channel-file.c:57:17: error: implicit declaration of function 'qemu_dup' [-Wimplicit-function-declaration]57 | int newfd = qemu_dup(fd); | ^~~~~~~~
../io/channel-file.c:57:17: error: nested extern declaration of 'qemu_dup' [-Werror=nested-externs]
r~
Quoted 19 lines · Richard Henderson
Quoted 10 lines · Daniel P. Berrangé
The following changes since commit
56afd82bd4db9688f1c1c9d0e2ea163b8cde3283:Merge tag 'qemu-sparc-20261101' ofhttps://github.com/mcayland/qemu into staging (2026-11-01 08:37:48 -0800)are available in the Git repository at:
https://gitlab.com/berrange/qemu tags/misc-fixes-pull-request
for you to fetch changes up to
f4b560dd12612fa12217f3a621ab54dfb6157040:Quoted 7 lines
accel/nitro: mark 'nitro' accelerator as secure (2026-11-02 11:08:45 +0000)----------------------------------------------------------------
* Mark virtualization related machine types as secure
* Mark KVM, Xen and Nitro accelerators as secure
* Use getexecpath on OpenBSD
* Useqemu_dup()overdup()
Quoted 8 lines
Fails build on windows:
https://gitlab.com/qemu-project/qemu/-/jobs/17671461626#L2066
Quoted 4 lines
../io/channel-file.c:57:17: error: implicit declaration of function 'qemu_dup' [-Wimplicit-function-declaration]57 | int newfd = qemu_dup(fd); | ^~~~~~~~
../io/channel-file.c:57:17: error: nested extern declaration of 'qemu_dup' [-Werror=nested-externs]
I'm dropping that patch for now, since it is not critical for the release. Sending a v2 PULL.
With regards,
Daniel
Signature · 3 lines
|: https://berrange.com ~~ https://hachyderm.io/@berrange :| |: https://libvirt.org ~~ https://entangle-photo.org :| |: https://pixelfed.art/berrange ~~ https://fstop138.berrange.com :|