[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Minios-devel] [UNIKRAFT PATCH] plat: Fix ostensibly random crashes during boot
By putting the ALIGN inside the .preinit_array and .init_array sections in the linker scripts, the sections would always be aligned and never empty, so they would be created even when there were no constructors inside. This for some reason completely breaks the proper loading of the data section, leading to a large number of seemingly unrelated bugs during boot with lots of static data structures with effectively random content. I have to admit I don't fully understand all the moving parts here, especially why this so trashes the contents of the data section. Also, a minimal example with just a hello world application does not trigger the problems, but they appear as soon as you replace nolibc with newlib. It boots again properly if you add a constructor. Signed-off-by: Florian Schmidt <florian.schmidt@xxxxxxxxx> --- plat/kvm/arm/link64.lds.S | 4 ++-- plat/kvm/x86/link64.lds | 4 ++-- plat/xen/arm/link32.lds | 4 ++-- plat/xen/x86/link64.lds | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/plat/kvm/arm/link64.lds.S b/plat/kvm/arm/link64.lds.S index f0da7768..f62b9a01 100644 --- a/plat/kvm/arm/link64.lds.S +++ b/plat/kvm/arm/link64.lds.S @@ -108,16 +108,16 @@ SECTIONS { } /* Constructor tables (read-only) */ + . = ALIGN(0x8); _ctors = .; .preinit_array : { - . = ALIGN(0x8); PROVIDE_HIDDEN (__preinit_array_start = .); KEEP (*(.preinit_array)) PROVIDE_HIDDEN (__preinit_array_end = .); } + . = ALIGN(0x8); .init_array : { - . = ALIGN(0x8); PROVIDE_HIDDEN (__init_array_start = .); KEEP (*(SORT_BY_INIT_PRIORITY(.init_array.*) SORT_BY_INIT_PRIORITY(.ctors.*))) KEEP (*(.init_array .ctors)) diff --git a/plat/kvm/x86/link64.lds b/plat/kvm/x86/link64.lds index c96f7501..9cad5e16 100644 --- a/plat/kvm/x86/link64.lds +++ b/plat/kvm/x86/link64.lds @@ -54,16 +54,16 @@ SECTIONS _erodata = .; /* Constructor tables (read-only) */ + . = ALIGN(0x8); _ctors = .; .preinit_array : { - . = ALIGN(0x8); PROVIDE_HIDDEN (__preinit_array_start = .); KEEP (*(.preinit_array)) PROVIDE_HIDDEN (__preinit_array_end = .); } + . = ALIGN(0x8); .init_array : { - . = ALIGN(0x8); PROVIDE_HIDDEN (__init_array_start = .); KEEP (*(SORT_BY_INIT_PRIORITY(.init_array.*) SORT_BY_INIT_PRIORITY(.ctors.*))) KEEP (*(.init_array .ctors)) diff --git a/plat/xen/arm/link32.lds b/plat/xen/arm/link32.lds index 522df30c..bc4e0dec 100644 --- a/plat/xen/arm/link32.lds +++ b/plat/xen/arm/link32.lds @@ -86,16 +86,16 @@ SECTIONS } . = ALIGN(4096); + . = ALIGN(0x8); _ctors = .; .preinit_array : { - . = ALIGN(0x8); PROVIDE_HIDDEN (__preinit_array_start = .); KEEP (*(.preinit_array)) PROVIDE_HIDDEN (__preinit_array_end = .); } + . = ALIGN(0x8); .init_array : { - . = ALIGN(0x8); PROVIDE_HIDDEN (__init_array_start = .); KEEP (*(SORT_BY_INIT_PRIORITY(.init_array.*) SORT_BY_INIT_PRIORITY(.ctors.*))) KEEP (*(.init_array .ctors)) diff --git a/plat/xen/x86/link64.lds b/plat/xen/x86/link64.lds index 82ab653a..9823f469 100644 --- a/plat/xen/x86/link64.lds +++ b/plat/xen/x86/link64.lds @@ -49,16 +49,16 @@ SECTIONS . = ALIGN(4096); _erodata = .; + . = ALIGN(0x8); _ctors = .; .preinit_array : { - . = ALIGN(0x8); PROVIDE_HIDDEN (__preinit_array_start = .); KEEP (*(.preinit_array)) PROVIDE_HIDDEN (__preinit_array_end = .); } + . = ALIGN(0x8); .init_array : { - . = ALIGN(0x8); PROVIDE_HIDDEN (__init_array_start = .); KEEP (*(SORT_BY_INIT_PRIORITY(.init_array.*) SORT_BY_INIT_PRIORITY(.ctors.*))) KEEP (*(.init_array .ctors)) -- 2.21.0 _______________________________________________ Minios-devel mailing list Minios-devel@xxxxxxxxxxxxxxxxxxxx https://lists.xenproject.org/mailman/listinfo/minios-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |