Skip to contentSkip to conversation

x86/vdso: Conditionally export __vdso_sgx_enter_enclave

PATCH Applied Nathan Chancellor 4 participants 6 messages Nov 9, 2022 – Dec 9, 2022

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86/vdso: Conditionally export __vdso_sgx_enter_enclave

Recently, ld.lld moved from '--undefined-version' to '--no-undefined-version' as the default, which breaks building the vDSO when CONFIG_X86_SGX is not set:

ld.lld: error: version script assignment of 'LINUX_2.6' to symbol '__vdso_sgx_enter_enclave' failed: symbol not defined

__vdso_sgx_enter_enclave is only included in the vDSO when CONFIG_X86_SGX is set. Only export it if it will be present in the final object, which clears up the error.

---

It would be nice if this could be picked up for an -rc release but I won't argue otherwise.

Alternatively, we could add '--undefined-version' to the vDSO ldflags but this does not seem unreasonable to me.

 arch/x86/entry/vdso/vdso.lds.S | 2 ++
 1 file changed, 2 insertions(+)
arch/x86/entry/vdso/vdso.lds.S +2 -0
index 4bf48462fca7..e8c60ae7a7c8 100644
@@ -27,7 +27,9 @@ VERSION {
 		__vdso_time;
 		clock_getres;
 		__vdso_clock_getres;
+#ifdef CONFIG_X86_SGX
 		__vdso_sgx_enter_enclave;
+#endif
 	local: *;
 	};
 }

base-commit: f0c4d9fc9cc9462659728d168387191387e903cc

Signature · 1 line
2.38.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 11 lines · Nathan Chancellor

Recently, ld.lld moved from '--undefined-version' to '--no-undefined-version' as the default, which breaks building the vDSO when CONFIG_X86_SGX is not set:

ld.lld: error: version script assignment of 'LINUX_2.6' to symbol '__vdso_sgx_enter_enclave' failed: symbol not defined

__vdso_sgx_enter_enclave is only included in the vDSO when CONFIG_X86_SGX is set. Only export it if it will be present in the final object, which clears up the error.

Quoted 6 lines

---

It would be nice if this could be picked up for an -rc release but I won't argue otherwise.

Sounds like the lld change got reverted, so this is less urgent now, but the change still LGTM regardless. Thanks for the patch!

Fixes 8466436952017 ("x86/vdso: Implement a vDSO for Intel SGX enclave call")
Quoted 27 lines

Alternatively, we could add '--undefined-version' to the vDSO ldflags but this does not seem unreasonable to me.

 arch/x86/entry/vdso/vdso.lds.S | 2 ++
 1 file changed, 2 insertions(+)
arch/x86/entry/vdso/vdso.lds.S +2 -0
index 4bf48462fca7..e8c60ae7a7c8 100644
@@ -27,7 +27,9 @@ VERSION {
                __vdso_time;
                clock_getres;
                __vdso_clock_getres;
+#ifdef CONFIG_X86_SGX
                __vdso_sgx_enter_enclave;
+#endif
        local: *;
        };
 }

base-commit: f0c4d9fc9cc9462659728d168387191387e903cc --
2.38.1

Signature · 2 lines
Thanks,
~Nick Desaulniers
#2 lore raw
In reply to Nathan Chancellor

Ping? The default switch was remerged a couple of days ago so builds with tip of tree LLVM are going to be broken again:

https://github.com/llvm/llvm-project/commit/241dbd310599e3c1a0f1b0c9ced14c8b8760539e

Cheers,
Nathan

Quoted 43 lines · Nathan Chancellor

Recently, ld.lld moved from '--undefined-version' to '--no-undefined-version' as the default, which breaks building the vDSO when CONFIG_X86_SGX is not set:

ld.lld: error: version script assignment of 'LINUX_2.6' to symbol '__vdso_sgx_enter_enclave' failed: symbol not defined

__vdso_sgx_enter_enclave is only included in the vDSO when CONFIG_X86_SGX is set. Only export it if it will be present in the final object, which clears up the error.

---

It would be nice if this could be picked up for an -rc release but I won't argue otherwise.

Alternatively, we could add '--undefined-version' to the vDSO ldflags but this does not seem unreasonable to me.

 arch/x86/entry/vdso/vdso.lds.S | 2 ++
 1 file changed, 2 insertions(+)
arch/x86/entry/vdso/vdso.lds.S +2 -0
index 4bf48462fca7..e8c60ae7a7c8 100644
@@ -27,7 +27,9 @@ VERSION {
 		__vdso_time;
 		clock_getres;
 		__vdso_clock_getres;
+#ifdef CONFIG_X86_SGX
 		__vdso_sgx_enter_enclave;
+#endif
 	local: *;
 	};
 }

base-commit: f0c4d9fc9cc9462659728d168387191387e903cc

Signature · 1 line
2.38.1
#5 lore raw

[tip: x86/urgent] x86/vdso: Conditionally export __vdso_sgx_enter_enclave()

In reply to Nathan Chancellor
The following commit has been merged into the x86/urgent branch of tip:

The following commit has been merged into the x86/urgent branch of tip:

Commit-ID:     45be2ad007a9c6bea70249c4cf3e4905afe4caeb
Gitweb:        https://git.kernel.org/tip/45be2ad007a9c6bea70249c4cf3e4905afe4caeb
Author:        Nathan Chancellor <[email protected]>
AuthorDate:    Tue, 08 Nov 2022 17:03:07 -07:00
Committer:     Thomas Gleixner <[email protected]>
CommitterDate: Fri, 09 Dec 2022 14:58:02 +01:00

x86/vdso: Conditionally export __vdso_sgx_enter_enclave()

Recently, ld.lld moved from '--undefined-version' to '--no-undefined-version' as the default, which breaks building the vDSO when CONFIG_X86_SGX is not set:

ld.lld: error: version script assignment of 'LINUX_2.6' to symbol '__vdso_sgx_enter_enclave' failed: symbol not defined

__vdso_sgx_enter_enclave is only included in the vDSO when CONFIG_X86_SGX is set. Only export it if it will be present in the final object, which clears up the error.

---
 arch/x86/entry/vdso/vdso.lds.S | 2 ++
 1 file changed, 2 insertions(+)
arch/x86/entry/vdso/vdso.lds.S +2 -0
index 4bf4846..e8c60ae 100644
@@ -27,7 +27,9 @@ VERSION {
 		__vdso_time;
 		clock_getres;
 		__vdso_clock_getres;
+#ifdef CONFIG_X86_SGX
 		__vdso_sgx_enter_enclave;
+#endif
 	local: *;
 	};
 }