]> xenbits.xensource.com Git - people/aperard/xen-unstable.git/commitdiff
xen/riscv: register Xen's load address as a boot module
authorOleksii Kurochko <oleksii.kurochko@gmail.com>
Thu, 10 Oct 2024 08:55:24 +0000 (10:55 +0200)
committerJan Beulich <jbeulich@suse.com>
Thu, 10 Oct 2024 08:55:24 +0000 (10:55 +0200)
Avoid using BOOTMOD_XEN region for other purposes or boot modules
which could result in memory corruption or undefined behaviour.

Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
xen/arch/riscv/setup.c

index 6d156c3a4098e10c4970cd4d5d5483ae9376c18d..f531ca38ee1bb3c1bae8c2ce772a5b190cd12207 100644 (file)
@@ -1,6 +1,7 @@
 /* SPDX-License-Identifier: GPL-2.0-only */
 
 #include <xen/bug.h>
+#include <xen/bootfdt.h>
 #include <xen/compile.h>
 #include <xen/device_tree.h>
 #include <xen/init.h>
@@ -44,6 +45,11 @@ void __init noreturn start_xen(unsigned long bootcpu_id,
               "Please check your bootloader.\n",
               dtb_addr, BOOT_FDT_VIRT_SIZE);
 
+    /* Register Xen's load address as a boot module. */
+    if ( !add_boot_module(BOOTMOD_XEN, virt_to_maddr(_start),
+                          _end - _start, false) )
+        panic("Failed to add BOOTMOD_XEN\n");
+
     printk("All set up\n");
 
     machine_halt();