The GOT sections usage should be avoided in the hypervisor
so to catch such use cases earlier when GOT things are
produced the patch introduces .got and .got.plt sections
and adds asserts that they're empty.
The sections won't be created until they remain
empty otherwise the asserts would cause early failure.
Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
---
Changes in V2:
* the patch was introduced in patch series v2.
---
xen/arch/riscv/xen.lds.S | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/xen/arch/riscv/xen.lds.S b/xen/arch/riscv/xen.lds.S
index ca57cce75c..f299ea8422 100644
--- a/xen/arch/riscv/xen.lds.S
+++ b/xen/arch/riscv/xen.lds.S
@@ -1,3 +1,4 @@
+#include <xen/lib.h>
#include <xen/xen.lds.h>
#undef ENTRY
@@ -123,6 +124,15 @@ SECTIONS
*(SORT(.init_array.*))
__ctors_end = .;
} :text
+
+ .got : {
+ *(.got)
+ } : text
+
+ .got.plt : {
+ *(.got.plt)
+ } : text
+
. = ALIGN(POINTER_ALIGN);
__init_end = .;
@@ -156,3 +166,6 @@ SECTIONS
ELF_DETAILS_SECTIONS
}
+
+ASSERT(!SIZEOF(.got), ".got non-empty")
+ASSERT(!SIZEOF(.got.plt), ".got.plt non-empty")
--
2.39.2
On Thu, Mar 16, 2023 at 11:22 PM Oleksii Kurochko
<oleksii.kurochko@gmail.com> wrote:
>
> The GOT sections usage should be avoided in the hypervisor
> so to catch such use cases earlier when GOT things are
> produced the patch introduces .got and .got.plt sections
> and adds asserts that they're empty.
>
> The sections won't be created until they remain
> empty otherwise the asserts would cause early failure.
>
> Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
Acked-by: Alistair Francis <alistair.francis@wdc.com>
Alistair
> ---
> Changes in V2:
> * the patch was introduced in patch series v2.
> ---
> xen/arch/riscv/xen.lds.S | 13 +++++++++++++
> 1 file changed, 13 insertions(+)
>
> diff --git a/xen/arch/riscv/xen.lds.S b/xen/arch/riscv/xen.lds.S
> index ca57cce75c..f299ea8422 100644
> --- a/xen/arch/riscv/xen.lds.S
> +++ b/xen/arch/riscv/xen.lds.S
> @@ -1,3 +1,4 @@
> +#include <xen/lib.h>
> #include <xen/xen.lds.h>
>
> #undef ENTRY
> @@ -123,6 +124,15 @@ SECTIONS
> *(SORT(.init_array.*))
> __ctors_end = .;
> } :text
> +
> + .got : {
> + *(.got)
> + } : text
> +
> + .got.plt : {
> + *(.got.plt)
> + } : text
> +
> . = ALIGN(POINTER_ALIGN);
> __init_end = .;
>
> @@ -156,3 +166,6 @@ SECTIONS
>
> ELF_DETAILS_SECTIONS
> }
> +
> +ASSERT(!SIZEOF(.got), ".got non-empty")
> +ASSERT(!SIZEOF(.got.plt), ".got.plt non-empty")
> --
> 2.39.2
>
>
On 16.03.2023 14:22, Oleksii Kurochko wrote: > The GOT sections usage should be avoided in the hypervisor > so to catch such use cases earlier when GOT things are > produced the patch introduces .got and .got.plt sections > and adds asserts that they're empty. > > The sections won't be created until they remain > empty otherwise the asserts would cause early failure. > > Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com> Reviewed-by: Jan Beulich <jbeulich@suse.com> And again a Suggested-by to Andrew perhaps. Jan
© 2016 - 2025 Red Hat, Inc.