Skip to content

Conversation

AdrianCX
Copy link

This is an update of PR to another branch:

Original review and comments: #57 (comment)

Code is guarded via defines to enable only if 'RUST_SGX' is present.

Main logic is in libunwind/src/AddressSpace.hpp
We use 6 symbols to figure out where eh_frame / eh_frame_hdr is at runtime when loaded in an SGX enclave. (EH symbols + IMAGE base)
These are set by 'fortanix-sgx-tools'.

As notes:

  • Target above at the moment uses a pre-compiled libunwind.a from forked repo.
  • Goal of these changes is to use official llvm with patch.
  • Changes in rust-lang to use this are planned if/when this is accepted.
  • Ticket: Update libunwind fortanix/rust-sgx#174
  • Original ported changes: llvm/llvm-project@release/5.x...fortanix:release/5.x

Code is guarded via defines to enable only if 'RUST_SGX' is present.

Main logic is in libunwind/src/AddressSpace.hpp
We use 6 symbols to figure out where eh_frame / eh_frame_hdr is at runtime when loaded in an SGX enclave. (EH symbols + IMAGE base)
These are set by 'fortanix-sgx-tools'.

As notes:
- Target above at the moment uses a pre-compiled libunwind.a from forked repo.
- Goal of these changes is to use official llvm with patch.
- Changes in rust-lang to use this are planned if/when this is accepted.
- Ticket: fortanix/rust-sgx#174
- Original ported changes: llvm/llvm-project@release/5.x...fortanix:release/5.x
@AdrianCX AdrianCX closed this May 26, 2020
vext01 added a commit to vext01/llvm-project that referenced this pull request Apr 27, 2023
62: Add the yk-linkage llvm pass. r=ltratt a=vext01



Co-authored-by: Edd Barrett <[email protected]>
nikic pushed a commit to nikic/llvm-project that referenced this pull request Aug 25, 2025
llvm#137975)

An authenticated pointer can be explicitly checked by the compiler via a
sequence of instructions that executes BRK on failure. It is important
to recognize such BRK instruction as checking every register (as it is
expected to immediately trigger an abnormal program termination) to
prevent false positive reports about authentication oracles:

      autia   x2, x3
      autia   x0, x1
      ; neither x0 nor x2 are checked at this point
      eor     x16, x0, x0, lsl #1
      tbz     x16, rust-lang#62, on_success ; marks x0 as checked
      ; end of BB: for x2 to be checked here, it must be checked in both
      ; successor basic blocks
    on_failure:
      brk     0xc470
    on_success:
      ; x2 is checked
      ldr     x1, [x2] ; marks x2 as checked
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant