Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
x86/hvm/dom0: fix PVH initrd and metadata placement
Zephyr image consists of multiple non-contiguous load segments that reside in different RAM regions. For instance: ELF: phdr: paddr=0x1000 memsz=0x8000 ELF: phdr: paddr=0x100000 memsz=0x28a90 ELF: phdr: paddr=0x128aa0 memsz=0x7560 ELF: memory: 0x1000 -> 0x130000 However, the logic that determines the best placement for dom0 initrd and metadata, assumes that the image is fully contained in a single RAM region, not taking into account the cases where: (1) start > kernel_start && end > kernel_end (2) start < kernel_start && end < kernel_end (3) start > kernel_start && end < kernel_end In case (1), the evaluation will result in end = kernel_start, i.e. end < start, and will load initrd in the middle of the kernel. In case (2), the evaluation will result in start = kernel_end, i.e. end < start, and will load initrd at kernel_end, that is out of the memory region under evaluation. In case (3), the evaluation will result in either end = kernel_start or start = kernel_end but in both cases will be end < start, and will either load initrd in the middle of the image, or arbitrarily at kernel_end. This patch reorganizes the conditionals to include so far unconsidered cases as well, uniformly returning the lowest available address. Fixes: 73b47ee ('x86/dom0: improve PVH initrd and metadata placement') Signed-off-by: Xenia Ragiadakou <[email protected]> Signed-off-by: Jan Beulich <[email protected]> Reviewed-by: Roger Pau Monné <[email protected]>
- Loading branch information