Skip to content

Conversation

@jethrogb
Copy link
Member

@jethrogb jethrogb commented Oct 11, 2019

@jethrogb jethrogb force-pushed the upstream-driver branch 2 times, most recently from fc94da6 to 704ec3a Compare February 14, 2020 11:37
@jethrogb jethrogb mentioned this pull request Jun 8, 2020
@jethrogb jethrogb requested review from raoulstrackx and removed request for VardhanThigle January 9, 2021 09:19
@jethrogb
Copy link
Member Author

jethrogb commented Jan 9, 2021

Ready for review, tested against Linux 5.11-rc2

@jethrogb jethrogb changed the title [WIP] Support upstream driver Support upstream driver Jan 9, 2021
@jethrogb jethrogb added the driver Issues related to OS drivers label Jan 9, 2021
@raoulstrackx
Copy link
Contributor

bors r+

bors bot added a commit that referenced this pull request Jan 28, 2021
181: Support upstream driver r=raoulstrackx a=jethrogb

See also the [Linux kernel documentation for __vdso_sgx_enter_enclave](https://github.com/torvalds/linux/blob/84292fffc2468125632a21c09533a89426ea212e/arch/x86/include/uapi/asm/sgx.h#L123-L166)

Co-authored-by: Jethro Beekman <jethro@fortanix.com>
@bors
Copy link
Contributor

bors bot commented Jan 28, 2021

Build failed:

@jethrogb
Copy link
Member Author

Non-rebase part of my latest push:

diff --git a/.travis.yml b/.travis.yml
index 48980cc..83d2c28 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -29,7 +29,7 @@ matrix:
       before_script:
         - rustup target add x86_64-fortanix-unknown-sgx x86_64-unknown-linux-musl
       script:
-        - cargo test --verbose --all --exclude sgxs-loaders
+        - cargo test --verbose --all --exclude sgxs-loaders && [ "$(echo $(nm -D target/debug/sgx-detect|grep __vdso_sgx_enter_enclave))" = "w __vdso_sgx_enter_enclave" ]
         - cargo test --verbose -p sgx-isa --features sgxstd --target x86_64-fortanix-unknown-sgx --no-run
         - cargo test --verbose -p sgxs-tools --features pe2sgxs --bin isgx-pe2sgx
         - cargo test --verbose -p dcap-ql --features link
diff --git a/enclave-runner/src/tcs.rs b/enclave-runner/src/tcs.rs
index a890867..35c8676 100644
--- a/enclave-runner/src/tcs.rs
+++ b/enclave-runner/src/tcs.rs
@@ -75,6 +75,7 @@ pub(crate) fn coenter<T: Tcs>(
                 // `--as-needed` to the linker. This is never executed because
                 // of the unconditional jump above.
 .global __vdso_clock_gettime
+.type __vdso_clock_gettime, function
                 call __vdso_clock_gettime@PLT
 
 1:
@@ -138,6 +139,8 @@ pub(crate) fn coenter<T: Tcs>(
             asm!("
                     sub $0x8, %rsp                   // align stack
                     push {}                          // push argument: run
+.weak __vdso_sgx_enter_enclave
+.type __vdso_sgx_enter_enclave, function
                     call __vdso_sgx_enter_enclave@PLT
                     add $0x10, %rsp                  // restore stack pointer
                 ",
@@ -163,7 +166,7 @@ pub(crate) fn coenter<T: Tcs>(
                 match sgx_result.try_into() {
                     Ok(Enclu::EExit) => { /* normal case */ },
                     Ok(Enclu::EResume) => {
-                       if let Some(mut debug_buf) = debug_buf {
+                        if let Some(mut debug_buf) = debug_buf {
                             let _ = write!(&mut debug_buf[..], "Enclave triggered exception: {:?}\0", run);
                         } else {
                             eprintln!("Enclave triggered exception, treating as panic: {:?}", run);

@raoulstrackx
Copy link
Contributor

bors r+

@bors
Copy link
Contributor

bors bot commented Jan 28, 2021

Build succeeded:

  • continuous-integration/travis-ci/push

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

driver Issues related to OS drivers

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants