diff mbox series

[v5,12/13] selftests/sgx: Discard unsupported ELF sections

Message ID 20230831134144.22686-13-jo.vanbulck@cs.kuleuven.be (mailing list archive)
State New, archived
Headers show
Series selftests/sgx: Fix compilation errors | expand

Commit Message

Jo Van Bulck Aug. 31, 2023, 1:41 p.m. UTC
Building the test enclave with -static-pie may produce a dynamic symbol
table, but this is not supported for enclaves and any relocations need to
happen manually (e.g., as for "encl_op_array"). Thus, opportunistically
discard ".dyn*" and ".gnu.hash" which the enclave loader cannot handle.

Signed-off-by: Jo Van Bulck <jo.vanbulck@cs.kuleuven.be>
---
 tools/testing/selftests/sgx/test_encl.lds | 2 ++
 1 file changed, 2 insertions(+)

Comments

Jarkko Sakkinen Sept. 4, 2023, 8:33 p.m. UTC | #1
On Thu Aug 31, 2023 at 4:41 PM EEST, Jo Van Bulck wrote:
> Building the test enclave with -static-pie may produce a dynamic symbol
> table, but this is not supported for enclaves and any relocations need to
> happen manually (e.g., as for "encl_op_array"). Thus, opportunistically
> discard ".dyn*" and ".gnu.hash" which the enclave loader cannot handle.
>
> Signed-off-by: Jo Van Bulck <jo.vanbulck@cs.kuleuven.be>
> ---
>  tools/testing/selftests/sgx/test_encl.lds | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/tools/testing/selftests/sgx/test_encl.lds b/tools/testing/selftests/sgx/test_encl.lds
> index 333a3e78fdc9..ffe851a1cac4 100644
> --- a/tools/testing/selftests/sgx/test_encl.lds
> +++ b/tools/testing/selftests/sgx/test_encl.lds
> @@ -33,6 +33,8 @@ SECTIONS
>  		*(.note*)
>  		*(.debug*)
>  		*(.eh_frame*)
> +		*(.dyn*)
> +		*(.gnu.hash)
>  	}
>  }
>  
> -- 
> 2.25.1

Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org>

Also, for any patches (not that many) I've done post-Intel: I hereby
give permission to license that code with MIT or compatible license
as the upper bound.

For any code I've produced while at Intel the copyright is owned by
Intel so perhaps Dave could help with that part?

I'm happy if this code ends up to wider use than just kselftest for
sure.

BR, Jarkko
diff mbox series

Patch

diff --git a/tools/testing/selftests/sgx/test_encl.lds b/tools/testing/selftests/sgx/test_encl.lds
index 333a3e78fdc9..ffe851a1cac4 100644
--- a/tools/testing/selftests/sgx/test_encl.lds
+++ b/tools/testing/selftests/sgx/test_encl.lds
@@ -33,6 +33,8 @@  SECTIONS
 		*(.note*)
 		*(.debug*)
 		*(.eh_frame*)
+		*(.dyn*)
+		*(.gnu.hash)
 	}
 }