Merge remote-tracking branch 'upstream/master' into main
This commit is contained in:
commit
8d8fc6b1bd
@ -4014,7 +4014,7 @@ static void query_stats(StatsResultList **result, StatsTarget target,
|
||||
stats_list);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
g_assert_not_reached();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -94,8 +94,16 @@ not tested anymore, so it is recommended to use one of the latest versions of
|
||||
Windows instead.
|
||||
|
||||
The project supports building QEMU with current versions of the MinGW
|
||||
toolchain, either hosted on Linux (Debian/Fedora) or via MSYS2 on Windows.
|
||||
toolchain, either hosted on Linux (Debian/Fedora) or via `MSYS2`_ on Windows.
|
||||
A more recent Windows version is always preferred as it is less likely to have
|
||||
problems with building via MSYS2. The building process of QEMU involves some
|
||||
Python scripts that call os.symlink() which needs special attention for the
|
||||
build process to successfully complete. On newer versions of Windows 10,
|
||||
unprivileged accounts can create symlinks if Developer Mode is enabled.
|
||||
When Developer Mode is not available/enabled, the SeCreateSymbolicLinkPrivilege
|
||||
privilege is required, or the process must be run as an administrator.
|
||||
|
||||
.. _Homebrew: https://brew.sh/
|
||||
.. _MacPorts: https://www.macports.org/
|
||||
.. _MSYS2: https://www.msys2.org/
|
||||
.. _Repology: https://repology.org/
|
||||
|
@ -332,7 +332,7 @@ static void microvm_memory_init(MicrovmMachineState *mms)
|
||||
rom_set_fw(fw_cfg);
|
||||
|
||||
if (machine->kernel_filename != NULL) {
|
||||
x86_load_linux(x86ms, fw_cfg, 0, true);
|
||||
x86_load_linux(x86ms, fw_cfg, 0, true, false);
|
||||
}
|
||||
|
||||
if (mms->option_roms) {
|
||||
|
@ -796,7 +796,7 @@ void xen_load_linux(PCMachineState *pcms)
|
||||
rom_set_fw(fw_cfg);
|
||||
|
||||
x86_load_linux(x86ms, fw_cfg, pcmc->acpi_data_size,
|
||||
pcmc->pvh_enabled);
|
||||
pcmc->pvh_enabled, pcmc->legacy_no_rng_seed);
|
||||
for (i = 0; i < nb_option_roms; i++) {
|
||||
assert(!strcmp(option_rom[i].name, "linuxboot.bin") ||
|
||||
!strcmp(option_rom[i].name, "linuxboot_dma.bin") ||
|
||||
@ -992,7 +992,7 @@ void pc_memory_init(PCMachineState *pcms,
|
||||
|
||||
if (linux_boot) {
|
||||
x86_load_linux(x86ms, fw_cfg, pcmc->acpi_data_size,
|
||||
pcmc->pvh_enabled);
|
||||
pcmc->pvh_enabled, pcmc->legacy_no_rng_seed);
|
||||
}
|
||||
|
||||
for (i = 0; i < nb_option_roms; i++) {
|
||||
|
@ -438,9 +438,11 @@ DEFINE_I440FX_MACHINE(v7_1, "pc-i440fx-7.1", NULL,
|
||||
|
||||
static void pc_i440fx_7_0_machine_options(MachineClass *m)
|
||||
{
|
||||
PCMachineClass *pcmc = PC_MACHINE_CLASS(m);
|
||||
pc_i440fx_7_1_machine_options(m);
|
||||
m->alias = NULL;
|
||||
m->is_default = false;
|
||||
pcmc->legacy_no_rng_seed = true;
|
||||
compat_props_add(m->compat_props, hw_compat_7_0, hw_compat_7_0_len);
|
||||
compat_props_add(m->compat_props, pc_compat_7_0, pc_compat_7_0_len);
|
||||
}
|
||||
|
@ -375,8 +375,10 @@ DEFINE_Q35_MACHINE(v7_1, "pc-q35-7.1", NULL,
|
||||
|
||||
static void pc_q35_7_0_machine_options(MachineClass *m)
|
||||
{
|
||||
PCMachineClass *pcmc = PC_MACHINE_CLASS(m);
|
||||
pc_q35_7_1_machine_options(m);
|
||||
m->alias = NULL;
|
||||
pcmc->legacy_no_rng_seed = true;
|
||||
compat_props_add(m->compat_props, hw_compat_7_0, hw_compat_7_0_len);
|
||||
compat_props_add(m->compat_props, pc_compat_7_0, pc_compat_7_0_len);
|
||||
}
|
||||
|
@ -26,6 +26,7 @@
|
||||
#include "qemu/cutils.h"
|
||||
#include "qemu/units.h"
|
||||
#include "qemu/datadir.h"
|
||||
#include "qemu/guest-random.h"
|
||||
#include "qapi/error.h"
|
||||
#include "qapi/qmp/qerror.h"
|
||||
#include "qapi/qapi-visit-common.h"
|
||||
@ -766,7 +767,8 @@ static bool load_elfboot(const char *kernel_filename,
|
||||
void x86_load_linux(X86MachineState *x86ms,
|
||||
FWCfgState *fw_cfg,
|
||||
int acpi_data_size,
|
||||
bool pvh_enabled)
|
||||
bool pvh_enabled,
|
||||
bool legacy_no_rng_seed)
|
||||
{
|
||||
bool linuxboot_dma_enabled = X86_MACHINE_GET_CLASS(x86ms)->fwcfg_dma_enabled;
|
||||
uint16_t protocol;
|
||||
@ -774,7 +776,7 @@ void x86_load_linux(X86MachineState *x86ms,
|
||||
int dtb_size, setup_data_offset;
|
||||
uint32_t initrd_max;
|
||||
uint8_t header[8192], *setup, *kernel;
|
||||
hwaddr real_addr, prot_addr, cmdline_addr, initrd_addr = 0;
|
||||
hwaddr real_addr, prot_addr, cmdline_addr, initrd_addr = 0, first_setup_data = 0;
|
||||
FILE *f;
|
||||
char *vmode;
|
||||
MachineState *machine = MACHINE(x86ms);
|
||||
@ -784,6 +786,7 @@ void x86_load_linux(X86MachineState *x86ms,
|
||||
const char *dtb_filename = machine->dtb;
|
||||
const char *kernel_cmdline = machine->kernel_cmdline;
|
||||
SevKernelLoaderContext sev_load_ctx = {};
|
||||
enum { RNG_SEED_LENGTH = 32 };
|
||||
|
||||
/* Align to 16 bytes as a paranoia measure */
|
||||
cmdline_size = (strlen(kernel_cmdline) + 16) & ~15;
|
||||
@ -1063,16 +1066,31 @@ void x86_load_linux(X86MachineState *x86ms,
|
||||
kernel_size = setup_data_offset + sizeof(struct setup_data) + dtb_size;
|
||||
kernel = g_realloc(kernel, kernel_size);
|
||||
|
||||
stq_p(header + 0x250, prot_addr + setup_data_offset);
|
||||
|
||||
setup_data = (struct setup_data *)(kernel + setup_data_offset);
|
||||
setup_data->next = 0;
|
||||
setup_data->next = cpu_to_le64(first_setup_data);
|
||||
first_setup_data = prot_addr + setup_data_offset;
|
||||
setup_data->type = cpu_to_le32(SETUP_DTB);
|
||||
setup_data->len = cpu_to_le32(dtb_size);
|
||||
|
||||
load_image_size(dtb_filename, setup_data->data, dtb_size);
|
||||
}
|
||||
|
||||
if (!legacy_no_rng_seed) {
|
||||
setup_data_offset = QEMU_ALIGN_UP(kernel_size, 16);
|
||||
kernel_size = setup_data_offset + sizeof(struct setup_data) + RNG_SEED_LENGTH;
|
||||
kernel = g_realloc(kernel, kernel_size);
|
||||
setup_data = (struct setup_data *)(kernel + setup_data_offset);
|
||||
setup_data->next = cpu_to_le64(first_setup_data);
|
||||
first_setup_data = prot_addr + setup_data_offset;
|
||||
setup_data->type = cpu_to_le32(SETUP_RNG_SEED);
|
||||
setup_data->len = cpu_to_le32(RNG_SEED_LENGTH);
|
||||
qemu_guest_getrandom_nofail(setup_data->data, RNG_SEED_LENGTH);
|
||||
}
|
||||
|
||||
/* Offset 0x250 is a pointer to the first setup_data link. */
|
||||
stq_p(header + 0x250, first_setup_data);
|
||||
|
||||
/*
|
||||
* If we're starting an encrypted VM, it will be OVMF based, which uses the
|
||||
* efi stub for booting and doesn't require any values to be placed in the
|
||||
|
@ -34,6 +34,7 @@
|
||||
#include "hw/qdev-properties.h"
|
||||
#include "qapi/error.h"
|
||||
#include "qemu/error-report.h"
|
||||
#include "qemu/guest-random.h"
|
||||
#include "qemu/log.h"
|
||||
#include "chardev/char.h"
|
||||
#include "sysemu/device_tree.h"
|
||||
@ -363,6 +364,7 @@ static const void *boston_fdt_filter(void *opaque, const void *fdt_orig,
|
||||
size_t ram_low_sz, ram_high_sz;
|
||||
size_t fdt_sz = fdt_totalsize(fdt_orig) * 2;
|
||||
g_autofree void *fdt = g_malloc0(fdt_sz);
|
||||
uint8_t rng_seed[32];
|
||||
|
||||
err = fdt_open_into(fdt_orig, fdt, fdt_sz);
|
||||
if (err) {
|
||||
@ -370,6 +372,9 @@ static const void *boston_fdt_filter(void *opaque, const void *fdt_orig,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
qemu_guest_getrandom_nofail(rng_seed, sizeof(rng_seed));
|
||||
qemu_fdt_setprop(fdt, "/chosen", "rng-seed", rng_seed, sizeof(rng_seed));
|
||||
|
||||
cmdline = (machine->kernel_cmdline && machine->kernel_cmdline[0])
|
||||
? machine->kernel_cmdline : " ";
|
||||
err = qemu_fdt_setprop_string(fdt, "/chosen", "bootargs", cmdline);
|
||||
|
@ -159,6 +159,8 @@ e1000e_intrmgr_on_throttling_timer(void *opaque)
|
||||
|
||||
if (msi_enabled(timer->core->owner)) {
|
||||
trace_e1000e_irq_msi_notify_postponed();
|
||||
/* Clear msi_causes_pending to fire MSI eventually */
|
||||
timer->core->msi_causes_pending = 0;
|
||||
e1000e_set_interrupt_cause(timer->core, 0);
|
||||
} else {
|
||||
trace_e1000e_irq_legacy_notify_postponed();
|
||||
|
@ -34,6 +34,7 @@
|
||||
#include "qemu/option.h"
|
||||
#include "qemu/config-file.h"
|
||||
#include "qemu/error-report.h"
|
||||
#include "qemu/guest-random.h"
|
||||
#include "sysemu/device_tree.h"
|
||||
#include "sysemu/reset.h"
|
||||
#include "hw/boards.h"
|
||||
@ -83,6 +84,7 @@ static int nios2_load_dtb(struct nios2_boot_info bi, const uint32_t ramsize,
|
||||
int fdt_size;
|
||||
void *fdt = NULL;
|
||||
int r;
|
||||
uint8_t rng_seed[32];
|
||||
|
||||
if (dtb_filename) {
|
||||
fdt = load_device_tree(dtb_filename, &fdt_size);
|
||||
@ -91,6 +93,9 @@ static int nios2_load_dtb(struct nios2_boot_info bi, const uint32_t ramsize,
|
||||
return 0;
|
||||
}
|
||||
|
||||
qemu_guest_getrandom_nofail(rng_seed, sizeof(rng_seed));
|
||||
qemu_fdt_setprop(fdt, "/chosen", "rng-seed", rng_seed, sizeof(rng_seed));
|
||||
|
||||
if (kernel_cmdline) {
|
||||
r = qemu_fdt_setprop_string(fdt, "/chosen", "bootargs",
|
||||
kernel_cmdline);
|
||||
|
@ -19,6 +19,7 @@
|
||||
#include "qemu/osdep.h"
|
||||
#include "qemu/cutils.h"
|
||||
#include "qemu/error-report.h"
|
||||
#include "qemu/guest-random.h"
|
||||
#include "qapi/error.h"
|
||||
#include "hw/loader.h"
|
||||
#include "hw/rx/rx62n.h"
|
||||
@ -83,6 +84,7 @@ static void rx_gdbsim_init(MachineState *machine)
|
||||
MemoryRegion *sysmem = get_system_memory();
|
||||
const char *kernel_filename = machine->kernel_filename;
|
||||
const char *dtb_filename = machine->dtb;
|
||||
uint8_t rng_seed[32];
|
||||
|
||||
if (machine->ram_size < mc->default_ram_size) {
|
||||
char *sz = size_to_str(mc->default_ram_size);
|
||||
@ -140,6 +142,8 @@ static void rx_gdbsim_init(MachineState *machine)
|
||||
error_report("Couldn't set /chosen/bootargs");
|
||||
exit(1);
|
||||
}
|
||||
qemu_guest_getrandom_nofail(rng_seed, sizeof(rng_seed));
|
||||
qemu_fdt_setprop(dtb, "/chosen", "rng-seed", rng_seed, sizeof(rng_seed));
|
||||
/* DTB is located at the end of SDRAM space. */
|
||||
dtb_offset = ROUND_DOWN(machine->ram_size - dtb_size, 16);
|
||||
rom_add_blob_fixed("dtb", dtb, dtb_size,
|
||||
|
@ -290,7 +290,7 @@ static void vhost_vdpa_listener_region_del(MemoryListener *listener,
|
||||
|
||||
result = vhost_iova_tree_find_iova(v->iova_tree, &mem_region);
|
||||
iova = result->iova;
|
||||
vhost_iova_tree_remove(v->iova_tree, &mem_region);
|
||||
vhost_iova_tree_remove(v->iova_tree, result);
|
||||
}
|
||||
vhost_vdpa_iotlb_batch_begin_once(v);
|
||||
ret = vhost_vdpa_dma_unmap(v, iova, int128_get64(llsize));
|
||||
@ -1179,7 +1179,18 @@ static int vhost_vdpa_set_vring_base(struct vhost_dev *dev,
|
||||
struct vhost_vring_state *ring)
|
||||
{
|
||||
struct vhost_vdpa *v = dev->opaque;
|
||||
VirtQueue *vq = virtio_get_queue(dev->vdev, ring->index);
|
||||
|
||||
/*
|
||||
* vhost-vdpa devices does not support in-flight requests. Set all of them
|
||||
* as available.
|
||||
*
|
||||
* TODO: This is ok for networking, but other kinds of devices might
|
||||
* have problems with these retransmissions.
|
||||
*/
|
||||
while (virtqueue_rewind(vq, 1)) {
|
||||
continue;
|
||||
}
|
||||
if (v->shadow_vqs_enabled) {
|
||||
/*
|
||||
* Device vring base was set at device start. SVQ base is handled by
|
||||
@ -1195,21 +1206,10 @@ static int vhost_vdpa_get_vring_base(struct vhost_dev *dev,
|
||||
struct vhost_vring_state *ring)
|
||||
{
|
||||
struct vhost_vdpa *v = dev->opaque;
|
||||
int vdpa_idx = ring->index - dev->vq_index;
|
||||
int ret;
|
||||
|
||||
if (v->shadow_vqs_enabled) {
|
||||
VhostShadowVirtqueue *svq = g_ptr_array_index(v->shadow_vqs, vdpa_idx);
|
||||
|
||||
/*
|
||||
* Setting base as last used idx, so destination will see as available
|
||||
* all the entries that the device did not use, including the in-flight
|
||||
* processing ones.
|
||||
*
|
||||
* TODO: This is ok for networking, but other kinds of devices might
|
||||
* have problems with these retransmissions.
|
||||
*/
|
||||
ring->num = svq->last_used_idx;
|
||||
ring->num = virtio_queue_get_last_avail_idx(dev->vdev, ring->index);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -127,6 +127,9 @@ struct PCMachineClass {
|
||||
|
||||
/* create kvmclock device even when KVM PV features are not exposed */
|
||||
bool kvmclock_create_always;
|
||||
|
||||
/* skip passing an rng seed for legacy machines */
|
||||
bool legacy_no_rng_seed;
|
||||
};
|
||||
|
||||
#define TYPE_PC_MACHINE "generic-pc-machine"
|
||||
|
@ -123,7 +123,8 @@ void x86_bios_rom_init(MachineState *ms, const char *default_firmware,
|
||||
void x86_load_linux(X86MachineState *x86ms,
|
||||
FWCfgState *fw_cfg,
|
||||
int acpi_data_size,
|
||||
bool pvh_enabled);
|
||||
bool pvh_enabled,
|
||||
bool legacy_no_rng_seed);
|
||||
|
||||
bool x86_machine_is_smm_enabled(const X86MachineState *x86ms);
|
||||
bool x86_machine_is_acpi_enabled(const X86MachineState *x86ms);
|
||||
|
@ -10,6 +10,7 @@
|
||||
#define SETUP_EFI 4
|
||||
#define SETUP_APPLE_PROPERTIES 5
|
||||
#define SETUP_JAILHOUSE 6
|
||||
#define SETUP_RNG_SEED 9
|
||||
|
||||
#define SETUP_INDIRECT (1<<31)
|
||||
|
||||
|
@ -143,6 +143,9 @@ void cpu_loop(CPUHPPAState *env)
|
||||
env->iaoq_f = env->gr[31];
|
||||
env->iaoq_b = env->gr[31] + 4;
|
||||
break;
|
||||
case EXCP_IMP:
|
||||
force_sig_fault(TARGET_SIGSEGV, TARGET_SEGV_MAPERR, env->iaoq_f);
|
||||
break;
|
||||
case EXCP_ILL:
|
||||
force_sig_fault(TARGET_SIGILL, TARGET_ILL_ILLOPN, env->iaoq_f);
|
||||
break;
|
||||
|
@ -1603,21 +1603,12 @@ static abi_long do_ppoll(abi_long arg1, abi_long arg2, abi_long arg3,
|
||||
}
|
||||
#endif
|
||||
|
||||
static abi_long do_pipe2(int host_pipe[], int flags)
|
||||
{
|
||||
#ifdef CONFIG_PIPE2
|
||||
return pipe2(host_pipe, flags);
|
||||
#else
|
||||
return -ENOSYS;
|
||||
#endif
|
||||
}
|
||||
|
||||
static abi_long do_pipe(CPUArchState *cpu_env, abi_ulong pipedes,
|
||||
int flags, int is_pipe2)
|
||||
{
|
||||
int host_pipe[2];
|
||||
abi_long ret;
|
||||
ret = flags ? do_pipe2(host_pipe, flags) : pipe(host_pipe);
|
||||
ret = pipe2(host_pipe, flags);
|
||||
|
||||
if (is_error(ret))
|
||||
return get_errno(ret);
|
||||
@ -1641,7 +1632,7 @@ static abi_long do_pipe(CPUArchState *cpu_env, abi_ulong pipedes,
|
||||
}
|
||||
|
||||
if (put_user_s32(host_pipe[0], pipedes)
|
||||
|| put_user_s32(host_pipe[1], pipedes + sizeof(host_pipe[0])))
|
||||
|| put_user_s32(host_pipe[1], pipedes + sizeof(abi_int)))
|
||||
return -TARGET_EFAULT;
|
||||
return get_errno(ret);
|
||||
}
|
||||
|
@ -2026,15 +2026,6 @@ config_host_data.set('CONFIG_OPEN_BY_HANDLE', cc.links(gnu_source_prefix + '''
|
||||
#else
|
||||
int main(void) { struct file_handle fh; return open_by_handle_at(0, &fh, 0); }
|
||||
#endif'''))
|
||||
config_host_data.set('CONFIG_PIPE2', cc.links(gnu_source_prefix + '''
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
int main(void)
|
||||
{
|
||||
int pipefd[2];
|
||||
return pipe2(pipefd, O_CLOEXEC);
|
||||
}'''))
|
||||
config_host_data.set('CONFIG_POSIX_MADVISE', cc.links(gnu_source_prefix + '''
|
||||
#include <sys/mman.h>
|
||||
#include <stddef.h>
|
||||
|
@ -87,10 +87,12 @@ if [ "$GITLAB_CI" != "true" ]; then
|
||||
make "-j$(nproc)" qemu-fuzz-i386 V=1
|
||||
fi
|
||||
|
||||
# Prepare a preinstalled tree
|
||||
# Place data files in the preinstall tree
|
||||
make install DESTDIR=$DEST_DIR/qemu-bundle
|
||||
rm -rf $DEST_DIR/qemu-bundle/opt/qemu-oss-fuzz/bin
|
||||
rm -rf $DEST_DIR/qemu-bundle/opt/qemu-oss-fuzz/libexec
|
||||
|
||||
targets=$(./qemu-fuzz-i386 | awk '$1 ~ /\*/ {print $2}')
|
||||
targets=$(./qemu-fuzz-i386 | grep generic-fuzz | awk '$1 ~ /\*/ {print $2}')
|
||||
base_copy="$DEST_DIR/qemu-fuzz-i386-target-$(echo "$targets" | head -n 1)"
|
||||
|
||||
cp "./qemu-fuzz-i386" "$base_copy"
|
||||
|
Loading…
x
Reference in New Issue
Block a user