Skip to content

Commit

Permalink
Fix regression when bumping Linux to 6.1.88
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
robelin committed Jul 20, 2024
1 parent 6aebede commit 0cc7e6d
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/arch/x86/vm.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include <linux/kvm_para.h>
#include <string.h>
#include <sys/ioctl.h>
#include <stddef.h>

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

memset(boot, 0, sizeof(struct boot_params));
memmove(boot, data, sizeof(struct boot_params));
memmove((void *)boot + offsetof(struct boot_params, hdr),
data + offsetof(struct boot_params, hdr),
sizeof(struct setup_header));

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

0 comments on commit 0cc7e6d

Please sign in to comment.