[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] x86/hvm/dom0: fix PVH initrd and metadata placement


  • To: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Xenia Ragiadakou <xenia.ragiadakou@xxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Thu, 26 Oct 2023 13:41:16 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=hcaA5TvrO/WTLESNjnkEpRqG2ZVVTL9yiPwmp9Cf+Yw=; b=T5cvBm9lIpxl+lIirvRPyf72BGqckimyyXbgOHkt+TM2UzA/wSJMV30WAV7XYa4At02ElEG6rzqYaO2CpxbU8v23VxyJ1GIk8ay20T/SG4ie0X9yprYzYAScce9jcXv8cqcg9/osgN1vRGI2h5jjmYjIOyzgbxfXCvhjCrkk4BATq2hyH04xpy+a6Q5uNpx/HOy+763VfqnUcKJqCqWzg6/ofczqOJTTmLDOZCkjy7f4v0fFGXPL7LRgSAdgvxayxU2ADe7JpjLSUdF03+mgcwOz2cZkJynoqLSjVijaR/bWHLIypFfMFmmVX/3wZmkNw/XdFMYkR1WxCu9s/DA4gw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZtgTW+sJkdrKGe1iwPCkldIDQRXIrjFEUkcAKQ3k3yQoHd4bIKDjU4mHbJzgrLxbvsRcilj8I1YSM/dD+HYaLyyD+4E42K7oVxftoTHG7RcO7uJuIK65nTtbPFjgZb/UA5kiDOoo619/0tW7thJWu23pr7psYh15lnDK+yjav2U73wtYCwx2bjxgqo9khnpE6vEgnkatub3CbvJJZevgfgSACiyFAvF6XnT7enlFYmPHipwOZNM8PzwfzojWB/5tDYoLMxC5EIH32VtVnKLJYZjC1ANLnQj7/o6JIdn5pnZxNdXXkSRp9u5jDpg9BbNZtwY3GiJfoy6RpzId/MThTA==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Roger Pau Monné <roger.pau@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Thu, 26 Oct 2023 11:41:27 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 26.10.2023 12:31, Andrew Cooper wrote:
> On 26/10/2023 9:34 am, Xenia Ragiadakou wrote:
>> On 26/10/23 10:35, Jan Beulich wrote:
>>> On 26.10.2023 08:45, Xenia Ragiadakou wrote:
>>>> Given that start < kernel_end and end > kernel_start, the logic that
>>>> determines the best placement for dom0 initrd and metadata, does not
>>>> take into account the two cases below:
>>>> (1) start > kernel_start && end > kernel_end
>>>> (2) 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.
>>> I agree there is a problem if the kernel range overlaps but is not fully
>>> contained in the E820 range under inspection. I'd like to ask though
>>> under what conditions that can happen, as it seems suspicious for the
>>> kernel range to span multiple E820 ranges.
>>
>> We tried to boot Zephyr as pvh dom0 and its load address was under 1MB.
>>
>> I know ... that maybe shouldn't have been permitted at all, but
>> nevertheless we hit this issue.
> 
> 
> Zephyr is linked to run at 4k.  That's what the ELF Headers say, and the
> entrypoint is not position-independent.

Very interesting. What size is their kernel? And, Xenia, can you provide
the E820 map that you were finding the collision with?

Jan

> So trying to put the binary anywhere else is going to work about as well
> having the notes section misalign the pagetables by 0x20 bytes[1].
> 
> ~Andrew
> 
> [1] Guess what was causing the "Zephyr doesn't boot PVH" issues.  Which
> is doubly irritating because about 6h of debugging prior, I'd pointed
> out that the linker was complaining about an orphaned section and that
> that ought to be fixed before trying to debug further...




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.