xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/2] deal with GOT stuff for RISC-V
@ 2023-03-16 13:22 Oleksii Kurochko
  2023-03-16 13:22 ` [PATCH v2 1/2] xen/riscv: add EMBEDDED_EXTRA_CFLAGS to CFLAGS Oleksii Kurochko
                   ` (3 more replies)
  0 siblings, 4 replies; 13+ messages in thread
From: Oleksii Kurochko @ 2023-03-16 13:22 UTC (permalink / raw)
  To: xen-devel
  Cc: Jan Beulich, Andrew Cooper, Stefano Stabellini, Gianluca Guida,
	Oleksii Kurochko, Bob Eshleman, Alistair Francis, Connor Davis

The patch series introduces things to deal with GOT stuff whichwas faced
during the work on [1].

Initially, the issue was with 'la' pseudo instruction, which transformed to
'aupic/l{w|d} GOT' instead of 'auipc/addi'.
The transformation dependson .option {nopic, pic} directive or compiler flags.

Right now, 'la' transforms to 'auipc/l{w|d}', which in case of cpu0_boot_stack[]
will lead to the usage of _GLOBAL_OFFSET_TABLE_and addresses inside GOT
sections will be relative to linker time addresses.

At least there are two reasons for that:
1. GCC compiler used in RISCV64 container is compiled with
  --enable-default-pie flag.
2. GCC spec file for the RISC-V architecture by default enabled -fpic:
   [user@49295ae49cbe build]$ riscv64-linux-gnu-gcc -dumpspecs | grep -i pic
    --traditional-format %(subtarget_asm_debugging_spec) %{fno-pie|fno- PIE|fno-pic|fno-PIC:;:-fpic} %{march=*} %{mabi=*} %{mno-relax} %{mbig- endian} %{mlittle-endian} %(subtarget_asm_spec)%{misa-spec=*}
  which means that -fpic is enabled if none of the following options are
  present on the command line: fno-pie, -fno-PIE, -fno-pic, -fno-PIC

To resolve that, it was added EMBEDDED_EXTRA_CFLAGS to RISCV's CFLAGS as it was
done for other architecture.

To catch use cases when GOT things will be produced by something was createthe
second patch of the patch series:
[xen/riscv: add explicit check that.got{.plt} is empty] which add .got&.got.plt
sections to xen.lds.S and alsoadds asserts to check that the mentioned sections
are empty otherwise, it will be produced a compilation error with the message
that the sections aren't empty.

[1]:
https://lore.kernel.org/xen-devel/22c46432-e940-914e-53c2-2913607be3e2@suse.com/T/#t

---
Changes in V2:
 * The patch [1] was refactored and lead to the patch [xen/riscv: add
   EMBEDDED_EXTRA_CFLAGS to CFLAGS].
 * In addition to the patch [1] was created another patch [xen/riscv: add explicit
   check that .got{.plt} is empty] to be sure that .got{.plt} sections
   weren't produced.
---
Oleksii Kurochko (2):
  xen/riscv: add EMBEDDED_EXTRA_CFLAGS to CFLAGS
  xen/riscv: add explicit check that .got{.plt} is empty

 xen/arch/riscv/arch.mk   |  2 ++
 xen/arch/riscv/xen.lds.S | 13 +++++++++++++
 2 files changed, 15 insertions(+)

-- 
2.39.2



^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH v2 1/2] xen/riscv: add EMBEDDED_EXTRA_CFLAGS to CFLAGS
  2023-03-16 13:22 [PATCH v2 0/2] deal with GOT stuff for RISC-V Oleksii Kurochko
@ 2023-03-16 13:22 ` Oleksii Kurochko
  2023-03-16 13:54   ` Jan Beulich
  2023-04-18  2:16   ` Alistair Francis
  2023-03-16 13:22 ` [PATCH v2 2/2] xen/riscv: add explicit check that .got{.plt} is empty Oleksii Kurochko
                   ` (2 subsequent siblings)
  3 siblings, 2 replies; 13+ messages in thread
From: Oleksii Kurochko @ 2023-03-16 13:22 UTC (permalink / raw)
  To: xen-devel
  Cc: Jan Beulich, Andrew Cooper, Stefano Stabellini, Gianluca Guida,
	Oleksii Kurochko, Bob Eshleman, Alistair Francis, Connor Davis

The patch is needed to keep all address of cpu0_boot_stack
PC-relative.

Pseudoinstruction 'la' can be transformed to 'auipc/addi' or
'auipc/l{w|d}'. It depends on the .option directive: nopic and pic
or compiler flags.

Right now, 'la' transforms to 'auipc/l{w|d}', which in case of
cpu0_boot_stack[] will lead to the usage of _GLOBAL_OFFSET_TABLE_
where all addresses will be without counting that it might happen
that linker address != load address ( so addresses inside got
sections will be relative to linker time ).

It happens becuase the compiler from riscv64 docker compiled with
--enable-default-pie:
  [user@49295ae49cbe build]$ riscv64-linux-gnu-gcc -v
  Using built-in specs.
  COLLECT_GCC=riscv64-linux-gnu-gcc
  COLLECT_LTO_WRAPPER=/usr/lib/gcc/riscv64-linux-gnu/12.2.0/lto-wrapper
  Target: riscv64-linux-gnu
  Configured with: /build/riscv64-linux-gnu-gcc/src/gcc-12.2.0/configure
  --prefix=/usr --program-prefix=riscv64-linux-gnu- --with-local-
  prefix=/usr/riscv64-linux-gnu --with-sysroot=/usr/riscv64-linux-gnu --
  with-build-sysroot=/usr/riscv64-linux-gnu --libdir=/usr/lib --
  libexecdir=/usr/lib --target=riscv64-linux-gnu --host=x86_64-pc-linux-
  gnu --build=x86_64-pc-linux-gnu --with-system-zlib --with-isl --with-
  linker-hash-style=gnu --disable-nls --disable-libunwind-exceptions --
  disable-libstdcxx-pch --disable-libssp --disable-multilib --disable-
  werror --enable-languages=c,c++ --enable-shared --enable-threads=posix
  --enable-__cxa_atexit --enable-clocale=gnu --enable-gnu-unique-object -
  -enable-linker-build-id --enable-lto --enable-plugin --enable-install-
  libiberty --enable-gnu-indirect-function --enable-default-pie --enable-
  checking=release
  Thread model: posix
  Supported LTO compression algorithms: zlib zstd
  gcc version 12.2.0 (GCC)

Looking at gcc spec file for the RISC-V architecture:
  [user@49295ae49cbe build]$ riscv64-linux-gnu-gcc -dumpspecs | grep -i
  pic
  --traditional-format %(subtarget_asm_debugging_spec) %{fno-pie|fno-
  PIE|fno-pic|fno-PIC:;:-fpic} %{march=*} %{mabi=*} %{mno-relax} %{mbig-
  endian} %{mlittle-endian} %(subtarget_asm_spec)%{misa-spec=*}
which means that -fpic is enabled if none of the following options are
present on the command line:
    -fno-pie
    -fno-PIE
    -fno-pic
    -fno-PIC

That's the reasons why 'la' is transformed to 'aupic/l{w|d} GOT' and
not be dependent on the toolchain used.

Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
---
 Changes in V2:
 * instead of changing 'la' to 'lla' to keep cpu0_boot_stack PC-relative
   it was updated CFLAGS with EMBEDDED_EXTRA_CFLAGS which contains
   -fno-PIE thereby 'la' will be transformed to 'auipc/addi' without
   GOT usage.
 * update the commit message with additional details.
---
 xen/arch/riscv/arch.mk | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/xen/arch/riscv/arch.mk b/xen/arch/riscv/arch.mk
index 45fe858ee0..7448f759b4 100644
--- a/xen/arch/riscv/arch.mk
+++ b/xen/arch/riscv/arch.mk
@@ -1,6 +1,8 @@
 ########################################
 # RISCV-specific definitions
 
+$(call cc-options-add,CFLAGS,CC,$(EMBEDDED_EXTRA_CFLAGS))
+
 CFLAGS-$(CONFIG_RISCV_64) += -mabi=lp64
 
 riscv-march-$(CONFIG_RISCV_ISA_RV64G) := rv64g
-- 
2.39.2



^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH v2 2/2] xen/riscv: add explicit check that .got{.plt} is empty
  2023-03-16 13:22 [PATCH v2 0/2] deal with GOT stuff for RISC-V Oleksii Kurochko
  2023-03-16 13:22 ` [PATCH v2 1/2] xen/riscv: add EMBEDDED_EXTRA_CFLAGS to CFLAGS Oleksii Kurochko
@ 2023-03-16 13:22 ` Oleksii Kurochko
  2023-03-16 13:56   ` Jan Beulich
  2023-04-18  2:17   ` Alistair Francis
  2023-03-16 13:59 ` [PATCH v2 0/2] deal with GOT stuff for RISC-V Andrew Cooper
  2023-04-17 14:12 ` Jan Beulich
  3 siblings, 2 replies; 13+ messages in thread
From: Oleksii Kurochko @ 2023-03-16 13:22 UTC (permalink / raw)
  To: xen-devel
  Cc: Jan Beulich, Andrew Cooper, Stefano Stabellini, Gianluca Guida,
	Oleksii Kurochko, Bob Eshleman, Alistair Francis, Connor Davis

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



^ permalink raw reply related	[flat|nested] 13+ messages in thread

* Re: [PATCH v2 1/2] xen/riscv: add EMBEDDED_EXTRA_CFLAGS to CFLAGS
  2023-03-16 13:22 ` [PATCH v2 1/2] xen/riscv: add EMBEDDED_EXTRA_CFLAGS to CFLAGS Oleksii Kurochko
@ 2023-03-16 13:54   ` Jan Beulich
  2023-04-18  2:16   ` Alistair Francis
  1 sibling, 0 replies; 13+ messages in thread
From: Jan Beulich @ 2023-03-16 13:54 UTC (permalink / raw)
  To: Oleksii Kurochko
  Cc: Andrew Cooper, Stefano Stabellini, Gianluca Guida, Bob Eshleman,
	Alistair Francis, Connor Davis, xen-devel

On 16.03.2023 14:22, Oleksii Kurochko wrote:
> The patch is needed to keep all address of cpu0_boot_stack
> PC-relative.
> 
> Pseudoinstruction 'la' can be transformed to 'auipc/addi' or
> 'auipc/l{w|d}'. It depends on the .option directive: nopic and pic
> or compiler flags.
> 
> Right now, 'la' transforms to 'auipc/l{w|d}', which in case of
> cpu0_boot_stack[] will lead to the usage of _GLOBAL_OFFSET_TABLE_
> where all addresses will be without counting that it might happen
> that linker address != load address ( so addresses inside got
> sections will be relative to linker time ).
> 
> It happens becuase the compiler from riscv64 docker compiled with
> --enable-default-pie:
>   [user@49295ae49cbe build]$ riscv64-linux-gnu-gcc -v
>   Using built-in specs.
>   COLLECT_GCC=riscv64-linux-gnu-gcc
>   COLLECT_LTO_WRAPPER=/usr/lib/gcc/riscv64-linux-gnu/12.2.0/lto-wrapper
>   Target: riscv64-linux-gnu
>   Configured with: /build/riscv64-linux-gnu-gcc/src/gcc-12.2.0/configure
>   --prefix=/usr --program-prefix=riscv64-linux-gnu- --with-local-
>   prefix=/usr/riscv64-linux-gnu --with-sysroot=/usr/riscv64-linux-gnu --
>   with-build-sysroot=/usr/riscv64-linux-gnu --libdir=/usr/lib --
>   libexecdir=/usr/lib --target=riscv64-linux-gnu --host=x86_64-pc-linux-
>   gnu --build=x86_64-pc-linux-gnu --with-system-zlib --with-isl --with-
>   linker-hash-style=gnu --disable-nls --disable-libunwind-exceptions --
>   disable-libstdcxx-pch --disable-libssp --disable-multilib --disable-
>   werror --enable-languages=c,c++ --enable-shared --enable-threads=posix
>   --enable-__cxa_atexit --enable-clocale=gnu --enable-gnu-unique-object -
>   -enable-linker-build-id --enable-lto --enable-plugin --enable-install-
>   libiberty --enable-gnu-indirect-function --enable-default-pie --enable-
>   checking=release
>   Thread model: posix
>   Supported LTO compression algorithms: zlib zstd
>   gcc version 12.2.0 (GCC)
> 
> Looking at gcc spec file for the RISC-V architecture:
>   [user@49295ae49cbe build]$ riscv64-linux-gnu-gcc -dumpspecs | grep -i
>   pic
>   --traditional-format %(subtarget_asm_debugging_spec) %{fno-pie|fno-
>   PIE|fno-pic|fno-PIC:;:-fpic} %{march=*} %{mabi=*} %{mno-relax} %{mbig-
>   endian} %{mlittle-endian} %(subtarget_asm_spec)%{misa-spec=*}
> which means that -fpic is enabled if none of the following options are
> present on the command line:
>     -fno-pie
>     -fno-PIE
>     -fno-pic
>     -fno-PIC
> 
> That's the reasons why 'la' is transformed to 'aupic/l{w|d} GOT' and
> not be dependent on the toolchain used.
> 
> Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>

Reviewed-by: Jan Beulich <jbeulich@suse.com>

There may also want to be Suggested-by to both Andrew and me.

Jan


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v2 2/2] xen/riscv: add explicit check that .got{.plt} is empty
  2023-03-16 13:22 ` [PATCH v2 2/2] xen/riscv: add explicit check that .got{.plt} is empty Oleksii Kurochko
@ 2023-03-16 13:56   ` Jan Beulich
  2023-04-18  2:17   ` Alistair Francis
  1 sibling, 0 replies; 13+ messages in thread
From: Jan Beulich @ 2023-03-16 13:56 UTC (permalink / raw)
  To: Oleksii Kurochko
  Cc: Andrew Cooper, Stefano Stabellini, Gianluca Guida, Bob Eshleman,
	Alistair Francis, Connor Davis, xen-devel

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


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v2 0/2] deal with GOT stuff for RISC-V
  2023-03-16 13:22 [PATCH v2 0/2] deal with GOT stuff for RISC-V Oleksii Kurochko
  2023-03-16 13:22 ` [PATCH v2 1/2] xen/riscv: add EMBEDDED_EXTRA_CFLAGS to CFLAGS Oleksii Kurochko
  2023-03-16 13:22 ` [PATCH v2 2/2] xen/riscv: add explicit check that .got{.plt} is empty Oleksii Kurochko
@ 2023-03-16 13:59 ` Andrew Cooper
  2023-04-18  6:30   ` Jan Beulich
  2023-04-17 14:12 ` Jan Beulich
  3 siblings, 1 reply; 13+ messages in thread
From: Andrew Cooper @ 2023-03-16 13:59 UTC (permalink / raw)
  To: Oleksii Kurochko, xen-devel
  Cc: Jan Beulich, Stefano Stabellini, Gianluca Guida, Bob Eshleman,
	Alistair Francis, Connor Davis

On 16/03/2023 1:22 pm, Oleksii Kurochko wrote:
> Oleksii Kurochko (2):
>   xen/riscv: add EMBEDDED_EXTRA_CFLAGS to CFLAGS
>   xen/riscv: add explicit check that .got{.plt} is empty

Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v2 0/2] deal with GOT stuff for RISC-V
  2023-03-16 13:22 [PATCH v2 0/2] deal with GOT stuff for RISC-V Oleksii Kurochko
                   ` (2 preceding siblings ...)
  2023-03-16 13:59 ` [PATCH v2 0/2] deal with GOT stuff for RISC-V Andrew Cooper
@ 2023-04-17 14:12 ` Jan Beulich
  2023-04-18 12:03   ` Oleksii
  3 siblings, 1 reply; 13+ messages in thread
From: Jan Beulich @ 2023-04-17 14:12 UTC (permalink / raw)
  To: Oleksii Kurochko
  Cc: Andrew Cooper, Stefano Stabellini, Gianluca Guida, Bob Eshleman,
	Alistair Francis, Connor Davis, xen-devel

On 16.03.2023 14:22, Oleksii Kurochko wrote:
> Oleksii Kurochko (2):
>   xen/riscv: add EMBEDDED_EXTRA_CFLAGS to CFLAGS
>   xen/riscv: add explicit check that .got{.plt} is empty
> 
>  xen/arch/riscv/arch.mk   |  2 ++
>  xen/arch/riscv/xen.lds.S | 13 +++++++++++++
>  2 files changed, 15 insertions(+)

Just to mention it in case you aren't aware: Hunting down the necessary acks
is your responsibility, not one of the committers. You may want to ping Bob
and Alistair (unless this response of mine is already enough of a ping).
Provided of course the patches still apply as-is ...

Jan


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v2 1/2] xen/riscv: add EMBEDDED_EXTRA_CFLAGS to CFLAGS
  2023-03-16 13:22 ` [PATCH v2 1/2] xen/riscv: add EMBEDDED_EXTRA_CFLAGS to CFLAGS Oleksii Kurochko
  2023-03-16 13:54   ` Jan Beulich
@ 2023-04-18  2:16   ` Alistair Francis
  1 sibling, 0 replies; 13+ messages in thread
From: Alistair Francis @ 2023-04-18  2:16 UTC (permalink / raw)
  To: Oleksii Kurochko
  Cc: xen-devel, Jan Beulich, Andrew Cooper, Stefano Stabellini,
	Gianluca Guida, Bob Eshleman, Alistair Francis, Connor Davis

On Thu, Mar 16, 2023 at 11:22 PM Oleksii Kurochko
<oleksii.kurochko@gmail.com> wrote:
>
> The patch is needed to keep all address of cpu0_boot_stack
> PC-relative.
>
> Pseudoinstruction 'la' can be transformed to 'auipc/addi' or
> 'auipc/l{w|d}'. It depends on the .option directive: nopic and pic
> or compiler flags.
>
> Right now, 'la' transforms to 'auipc/l{w|d}', which in case of
> cpu0_boot_stack[] will lead to the usage of _GLOBAL_OFFSET_TABLE_
> where all addresses will be without counting that it might happen
> that linker address != load address ( so addresses inside got
> sections will be relative to linker time ).
>
> It happens becuase the compiler from riscv64 docker compiled with
> --enable-default-pie:
>   [user@49295ae49cbe build]$ riscv64-linux-gnu-gcc -v
>   Using built-in specs.
>   COLLECT_GCC=riscv64-linux-gnu-gcc
>   COLLECT_LTO_WRAPPER=/usr/lib/gcc/riscv64-linux-gnu/12.2.0/lto-wrapper
>   Target: riscv64-linux-gnu
>   Configured with: /build/riscv64-linux-gnu-gcc/src/gcc-12.2.0/configure
>   --prefix=/usr --program-prefix=riscv64-linux-gnu- --with-local-
>   prefix=/usr/riscv64-linux-gnu --with-sysroot=/usr/riscv64-linux-gnu --
>   with-build-sysroot=/usr/riscv64-linux-gnu --libdir=/usr/lib --
>   libexecdir=/usr/lib --target=riscv64-linux-gnu --host=x86_64-pc-linux-
>   gnu --build=x86_64-pc-linux-gnu --with-system-zlib --with-isl --with-
>   linker-hash-style=gnu --disable-nls --disable-libunwind-exceptions --
>   disable-libstdcxx-pch --disable-libssp --disable-multilib --disable-
>   werror --enable-languages=c,c++ --enable-shared --enable-threads=posix
>   --enable-__cxa_atexit --enable-clocale=gnu --enable-gnu-unique-object -
>   -enable-linker-build-id --enable-lto --enable-plugin --enable-install-
>   libiberty --enable-gnu-indirect-function --enable-default-pie --enable-
>   checking=release
>   Thread model: posix
>   Supported LTO compression algorithms: zlib zstd
>   gcc version 12.2.0 (GCC)
>
> Looking at gcc spec file for the RISC-V architecture:
>   [user@49295ae49cbe build]$ riscv64-linux-gnu-gcc -dumpspecs | grep -i
>   pic
>   --traditional-format %(subtarget_asm_debugging_spec) %{fno-pie|fno-
>   PIE|fno-pic|fno-PIC:;:-fpic} %{march=*} %{mabi=*} %{mno-relax} %{mbig-
>   endian} %{mlittle-endian} %(subtarget_asm_spec)%{misa-spec=*}
> which means that -fpic is enabled if none of the following options are
> present on the command line:
>     -fno-pie
>     -fno-PIE
>     -fno-pic
>     -fno-PIC
>
> That's the reasons why 'la' is transformed to 'aupic/l{w|d} GOT' and
> not be dependent on the toolchain used.
>
> Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>

Acked-by: Alistair Francis <alistair.francis@wdc.com>

Alistair

> ---
>  Changes in V2:
>  * instead of changing 'la' to 'lla' to keep cpu0_boot_stack PC-relative
>    it was updated CFLAGS with EMBEDDED_EXTRA_CFLAGS which contains
>    -fno-PIE thereby 'la' will be transformed to 'auipc/addi' without
>    GOT usage.
>  * update the commit message with additional details.
> ---
>  xen/arch/riscv/arch.mk | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/xen/arch/riscv/arch.mk b/xen/arch/riscv/arch.mk
> index 45fe858ee0..7448f759b4 100644
> --- a/xen/arch/riscv/arch.mk
> +++ b/xen/arch/riscv/arch.mk
> @@ -1,6 +1,8 @@
>  ########################################
>  # RISCV-specific definitions
>
> +$(call cc-options-add,CFLAGS,CC,$(EMBEDDED_EXTRA_CFLAGS))
> +
>  CFLAGS-$(CONFIG_RISCV_64) += -mabi=lp64
>
>  riscv-march-$(CONFIG_RISCV_ISA_RV64G) := rv64g
> --
> 2.39.2
>
>


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v2 2/2] xen/riscv: add explicit check that .got{.plt} is empty
  2023-03-16 13:22 ` [PATCH v2 2/2] xen/riscv: add explicit check that .got{.plt} is empty Oleksii Kurochko
  2023-03-16 13:56   ` Jan Beulich
@ 2023-04-18  2:17   ` Alistair Francis
  1 sibling, 0 replies; 13+ messages in thread
From: Alistair Francis @ 2023-04-18  2:17 UTC (permalink / raw)
  To: Oleksii Kurochko
  Cc: xen-devel, Jan Beulich, Andrew Cooper, Stefano Stabellini,
	Gianluca Guida, Bob Eshleman, Alistair Francis, Connor Davis

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
>
>


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v2 0/2] deal with GOT stuff for RISC-V
  2023-03-16 13:59 ` [PATCH v2 0/2] deal with GOT stuff for RISC-V Andrew Cooper
@ 2023-04-18  6:30   ` Jan Beulich
  2023-04-18  6:35     ` Andrew Cooper
  0 siblings, 1 reply; 13+ messages in thread
From: Jan Beulich @ 2023-04-18  6:30 UTC (permalink / raw)
  To: Andrew Cooper
  Cc: Stefano Stabellini, Gianluca Guida, Bob Eshleman,
	Alistair Francis, Connor Davis, Oleksii Kurochko, xen-devel

On 16.03.2023 14:59, Andrew Cooper wrote:
> On 16/03/2023 1:22 pm, Oleksii Kurochko wrote:
>> Oleksii Kurochko (2):
>>   xen/riscv: add EMBEDDED_EXTRA_CFLAGS to CFLAGS
>>   xen/riscv: add explicit check that .got{.plt} is empty
> 
> Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>

I'm sorry, I failed to apply this ack while committing.

Jan


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v2 0/2] deal with GOT stuff for RISC-V
  2023-04-18  6:30   ` Jan Beulich
@ 2023-04-18  6:35     ` Andrew Cooper
  0 siblings, 0 replies; 13+ messages in thread
From: Andrew Cooper @ 2023-04-18  6:35 UTC (permalink / raw)
  To: Jan Beulich
  Cc: Stefano Stabellini, Gianluca Guida, Bob Eshleman,
	Alistair Francis, Connor Davis, Oleksii Kurochko, xen-devel

On 18/04/2023 7:30 am, Jan Beulich wrote:
> On 16.03.2023 14:59, Andrew Cooper wrote:
>> On 16/03/2023 1:22 pm, Oleksii Kurochko wrote:
>>> Oleksii Kurochko (2):
>>>   xen/riscv: add EMBEDDED_EXTRA_CFLAGS to CFLAGS
>>>   xen/riscv: add explicit check that .got{.plt} is empty
>> Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
> I'm sorry, I failed to apply this ack while committing.

Oh well.  The important thing is that it's in now.

~Andrew


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v2 0/2] deal with GOT stuff for RISC-V
  2023-04-17 14:12 ` Jan Beulich
@ 2023-04-18 12:03   ` Oleksii
  2023-04-19  6:02     ` Jan Beulich
  0 siblings, 1 reply; 13+ messages in thread
From: Oleksii @ 2023-04-18 12:03 UTC (permalink / raw)
  To: Jan Beulich
  Cc: Andrew Cooper, Stefano Stabellini, Gianluca Guida, Bob Eshleman,
	Alistair Francis, Connor Davis, xen-devel

On Mon, 2023-04-17 at 16:12 +0200, Jan Beulich wrote:
> On 16.03.2023 14:22, Oleksii Kurochko wrote:
> > Oleksii Kurochko (2):
> >   xen/riscv: add EMBEDDED_EXTRA_CFLAGS to CFLAGS
> >   xen/riscv: add explicit check that .got{.plt} is empty
> > 
> >  xen/arch/riscv/arch.mk   |  2 ++
> >  xen/arch/riscv/xen.lds.S | 13 +++++++++++++
> >  2 files changed, 15 insertions(+)
> 
> Just to mention it in case you aren't aware: Hunting down the
> necessary acks
> is your responsibility, not one of the committers. You may want to
> ping Bob
> and Alistair (unless this response of mine is already enough of a
> ping).
> Provided of course the patches still apply as-is ...
> 
Thanks. I'll take that into account.

I thought the only option I have wait for a response from a maintainer.

~ Oleksii




^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v2 0/2] deal with GOT stuff for RISC-V
  2023-04-18 12:03   ` Oleksii
@ 2023-04-19  6:02     ` Jan Beulich
  0 siblings, 0 replies; 13+ messages in thread
From: Jan Beulich @ 2023-04-19  6:02 UTC (permalink / raw)
  To: Oleksii
  Cc: Andrew Cooper, Stefano Stabellini, Gianluca Guida, Bob Eshleman,
	Alistair Francis, Connor Davis, xen-devel

On 18.04.2023 14:03, Oleksii wrote:
> On Mon, 2023-04-17 at 16:12 +0200, Jan Beulich wrote:
>> On 16.03.2023 14:22, Oleksii Kurochko wrote:
>>> Oleksii Kurochko (2):
>>>   xen/riscv: add EMBEDDED_EXTRA_CFLAGS to CFLAGS
>>>   xen/riscv: add explicit check that .got{.plt} is empty
>>>
>>>  xen/arch/riscv/arch.mk   |  2 ++
>>>  xen/arch/riscv/xen.lds.S | 13 +++++++++++++
>>>  2 files changed, 15 insertions(+)
>>
>> Just to mention it in case you aren't aware: Hunting down the
>> necessary acks
>> is your responsibility, not one of the committers. You may want to
>> ping Bob
>> and Alistair (unless this response of mine is already enough of a
>> ping).
>> Provided of course the patches still apply as-is ...
>>
> Thanks. I'll take that into account.
> 
> I thought the only option I have wait for a response from a maintainer.

Well, in principle yes. But pinging is appropriate after a reasonable
amount of time (rule of thumb: a week, maybe two, depending on e.g.
complexity).

Jan


^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2023-04-19  6:03 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-16 13:22 [PATCH v2 0/2] deal with GOT stuff for RISC-V Oleksii Kurochko
2023-03-16 13:22 ` [PATCH v2 1/2] xen/riscv: add EMBEDDED_EXTRA_CFLAGS to CFLAGS Oleksii Kurochko
2023-03-16 13:54   ` Jan Beulich
2023-04-18  2:16   ` Alistair Francis
2023-03-16 13:22 ` [PATCH v2 2/2] xen/riscv: add explicit check that .got{.plt} is empty Oleksii Kurochko
2023-03-16 13:56   ` Jan Beulich
2023-04-18  2:17   ` Alistair Francis
2023-03-16 13:59 ` [PATCH v2 0/2] deal with GOT stuff for RISC-V Andrew Cooper
2023-04-18  6:30   ` Jan Beulich
2023-04-18  6:35     ` Andrew Cooper
2023-04-17 14:12 ` Jan Beulich
2023-04-18 12:03   ` Oleksii
2023-04-19  6:02     ` Jan Beulich

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).