Skip to content

Commit 0cc7e6d

Browse files
author
robelin
committedJul 20, 2024
Fix regression when bumping Linux to 6.1.88
Starting from Linux v6.1.88 commit f31f521, the first bootsec is complete removed and filled with 0xff to reserve for PE header. Since we load the full 512 bytes, those 0xff will break kvm-host. Instead, we only have to take the part of setup header.
1 parent 6aebede commit 0cc7e6d

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed
 

‎src/arch/x86/vm.c

+4-1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
#include <linux/kvm_para.h>
99
#include <string.h>
1010
#include <sys/ioctl.h>
11+
#include <stddef.h>
1112

1213
#include "err.h"
1314
#include "vm.h"
@@ -131,7 +132,9 @@ int vm_arch_load_image(vm_t *v, void *data, size_t datasz)
131132
void *kernel = ((uint8_t *) v->mem) + 0x100000;
132133

133134
memset(boot, 0, sizeof(struct boot_params));
134-
memmove(boot, data, sizeof(struct boot_params));
135+
memmove((void *)boot + offsetof(struct boot_params, hdr),
136+
data + offsetof(struct boot_params, hdr),
137+
sizeof(struct setup_header));
135138

136139
size_t setup_sectors = boot->hdr.setup_sects;
137140
size_t setupsz = (setup_sectors + 1) * 512;

0 commit comments

Comments
 (0)