]> xenbits.xensource.com Git - unikraft/unikraft.git/commitdiff
plat/kvm/x86: Mark the thrashed command-line as a kernel resource
authorSergiu Moga <sergiu.moga@protonmail.com>
Sun, 9 Apr 2023 17:02:24 +0000 (20:02 +0300)
committerUnikraft <monkey@unikraft.io>
Fri, 11 Aug 2023 10:18:44 +0000 (10:18 +0000)
Since this buffer is only meant for `ukplat_entry_argp`, which will
thrash it as a result of parsing it to obtain `argc`/`argv`, mark it
as a kernel related memory region instead (`UKPLAT_MEMRT_KERNEL`).

Signed-off-by: Sergiu Moga <sergiu.moga@protonmail.com>
Reviewed-by: Michalis Pappas <michalis@unikraft.io>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Closes: #848

plat/kvm/x86/setup.c

index ba3229f262cbab2407e482fe997a4de78c18256f..7e63b274a90fda29b9262a837446bf86478c99d3 100644 (file)
@@ -220,7 +220,11 @@ static inline int cmdline_init(struct ukplat_bootinfo *bi)
                cmdline_len = sizeof(CONFIG_UK_NAME) - 1;
        }
 
-       cmdline = ukplat_memregion_alloc(cmdline_len + 1, UKPLAT_MEMRT_CMDLINE);
+       /* This is not the original command-line, but one that will be thrashed
+        * by `ukplat_entry_argp` to obtain argc/argv. So mark it as a kernel
+        * resource instead.
+        */
+       cmdline = ukplat_memregion_alloc(cmdline_len + 1, UKPLAT_MEMRT_KERNEL);
        if (unlikely(!cmdline))
                return -ENOMEM;