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

[XEN v1] xen/Arm: Probe the entry point address of an uImage correctly


  • To: <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Ayan Kumar Halder <ayan.kumar.halder@xxxxxxx>
  • Date: Thu, 8 Dec 2022 12:49:29 +0000
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=lists.xenproject.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); 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=yenTeUt+rF7YHoERmpJx6GV+EruBzgUxZO07mi3amQ8=; b=Y9/sORJ/ZnhyGY1WFcZoVzAlJgRKD6LYXQTFKiBEo7o0l0Wy1ZVQF3m44TfPhkeyiITCZ+u76iCbugyMXCF3JaPWggjTYWfe1je83REoyxNbToSfDDJBNNeuJb8xdFJoudeWI4+n8HKpujgtfL2PSQTDmnWQTZfNcJalDRFYvdSeTzYVZpUlooZ28TEyx4T634yYvxt6H/Qoia+ZponYFe22AQXEV73z1V7umbLWX2S07YEB4jVOl72iXDlOcFGfQKUIC+eO+zupOUo/yL+0bk4T28IdH7A9hSaOrIRuWg5UQOVKpedNwUHv2pcRq5udfcjsO1v632SbaW3b629YTQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZfL94OnihEgyPsEOv8EAH8ueSAy9i96vBvCG1jAfdZTp7m/Ol/r2hhCkgAGRHuKBPMrSbb/JIr+dHgnLJX2uk05KtC1ACIKsXUEC8ZDXc0dwX5hDMQqWI0jF7pJThU06BGIh+JvgjE4aqKtaLoupAsC3v28n+kx0FBAsxdNHPp1KdRMFElhZO1wfJWAFZkNh7LuSn3A89p4BEgpLokK3l+EKrLD/rw2VgRNnLyZ2TMpW7hCxNxn6105uH6jOWjPKfMStX93EhItBoqXtQZO5Ry6bu6Pj/DXA8ZA6je6vXRp0TJct4rrEALDkFXBCXObx//S4pCkLy9Wg6XvquywL6A==
  • Cc: <sstabellini@xxxxxxxxxx>, <stefanos@xxxxxxxxxx>, <julien@xxxxxxx>, <Volodymyr_Babchuk@xxxxxxxx>, <bertrand.marquis@xxxxxxx>, <michal.orzel@xxxxxxx>, Ayan Kumar Halder <ayan.kumar.halder@xxxxxxx>
  • Delivery-date: Thu, 08 Dec 2022 12:50:00 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

Currently, kernel_uimage_probe() does not set info->zimage.start. As a
result, it contains the default value (ie 0). This causes,
kernel_zimage_place() to treat the binary (contained within uImage) as
position independent executable. Thus, it loads it at an incorrect address.

The correct approach would be to read "uimage.ep" and set
info->zimage.start. This will ensure that the binary is loaded at the
correct address.

Signed-off-by: Ayan Kumar Halder <ayan.kumar.halder@xxxxxxx>
---

I uncovered this issue while loading Zephyr as a dom0less domU with Xen on
R52 FVP. Zephyr builds with static device tree. Thus, the load address is
always fixed.

 xen/arch/arm/kernel.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/xen/arch/arm/kernel.c b/xen/arch/arm/kernel.c
index 2556a45c38..e4e8c67669 100644
--- a/xen/arch/arm/kernel.c
+++ b/xen/arch/arm/kernel.c
@@ -222,6 +222,8 @@ static int __init kernel_uimage_probe(struct kernel_info 
*info,
     if ( len > size - sizeof(uimage) )
         return -EINVAL;
 
+    info->zimage.start = be32_to_cpu(uimage.ep);
+
     info->zimage.kernel_addr = addr + sizeof(uimage);
     info->zimage.len = len;
 
-- 
2.17.1




 


Rackspace

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