Skip to content

Commit 7d43a93

Browse files
jsun26intelwenlingz
authored andcommitted
HV: validate multiboot cmdline before merge cmdline
In grub 2.02, the flag of MULTIBOOT_INFO_HAS_CMDLINE is set even there is no cmdline was configured. So we need to validate the content of cmdline in multiboot info. If there is no cmdline exist, we should not do merge cmdline for SOS VM. Tracked-On: #3214 Signed-off-by: Victor Sun <victor.sun@intel.com> Acked-by: Eddie Dong <eddie.dong@intel.com>
1 parent 45afd77 commit 7d43a93

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

hypervisor/boot/guest/vboot_info.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,8 @@ static void init_vm_bootargs_info(struct acrn_vm *vm, const struct multiboot_inf
162162
vm->sw.bootargs_info.size = strnlen_s(bootargs, MAX_BOOTARGS_SIZE);
163163
} else {
164164
/* vm_config->load_order == SOS_VM */
165-
if ((mbi->mi_flags & MULTIBOOT_INFO_HAS_CMDLINE) != 0U) {
165+
if (((mbi->mi_flags & MULTIBOOT_INFO_HAS_CMDLINE) != 0U)
166+
&& (*(char *)hpa2hva(mbi->mi_cmdline) != 0)) {
166167
/*
167168
* If there is cmdline from mbi->mi_cmdline, merge it with
168169
* vm_config->os_config.bootargs

0 commit comments

Comments
 (0)