Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade toolchain and std to May 2024 #139

Merged
merged 11 commits into from
Jun 28, 2024

Conversation

DemesneGH
Copy link
Contributor

@DemesneGH DemesneGH commented Jun 26, 2024

This PR upgrades the Rust toolchain and standard library to nightly-2024-05-15, and the libc crate to 0.2.153, both ported for OP-TEE targets.

Additionally, it includes various build script adjustments and code modifications necessary for this upgrade.

Changes:

  • Port libc 0.2.153 and add OP-TEE implementation:

  • Pin Rust src and add OP-TEE std implementation:

  • No Need to Port compiler_builtins:

    • Removing the link argument link-dead-code helps avoid linking errors with math functions such as "undefined reference to log10".
  • Unify OP-TEE Target Names:

    • "aarch64-unknown-optee" for AARCH64
    • "arm-unknown-optee" for ARM32
  • optee-utee-rs:

    • Macros: upgrade for quote and syn.
    • Temporarily remove systest as it's not compatible with the new Rust version.
  • Examples:

    • hotp-rs:
      • Workaround for the unexpected address of the slice with zero-length. For stable Rust, it's a normal address, but for nightly, it's 0x1, causing a TA panic when dereferencing.
    • tls_client-rs & tls_server-rs:
      • Upgrade to Ring 0.16.20 and Rustls 0.21.0.
      • Update TA source code to accommodate API changes.
  • Fix some warnings on new version:

    • Symbolic link to .cargo/config.toml: Xargo uses .cargo.config, not .cargo/config.toml (required for the new cargo version).
    • Change build_dependencies to build-dependencies: deprecated in favor of build-dependencies and will not work in the 2024 edition.
  • Polish building scripts

Discussions:

  • Xargo or -Zbuild-std When building std from source:

  • Upstream the OP-TEE Targets:

    • Benefits:
      • No need for the target JSON file in the SDK root.
      • Stay up-to-date without pinning toolchain version.
      • Download Rust src via rustup add components rust-src.
      • (Optional) Use cargo -Zbuild-std instead of Xargo.
    • Other considerations:
      • Even after upstreaming to a tier-3 target, we cannot install our target via rustup, so build-std is still needed.
      • For Rustls and Ring (which use optee-utee-rs APIs such as random and time), we still need to port, or open PR to add our target.

TODOs:

  • ARM32 TAs bug fix:
    • Rustc bug when linking: Rust compiler generates symbols.o for ARM32 Object files with EABI version 0, causing error source object xxx.rlib has EABI version 5, but target ta-xxx has EABI version 0. This can be fixed by applying a patch to the Rust compiler. A PR to the Rust repository will be made.
    • tls_client-rs TA ldelf error:
      • User mode data-abort at address xxx (write permission fault) before loading TA into an address.

This PR is a work in progress. Any comments would be appreciated. Thank you!

Updates:

  • I'm preparing the Release v.0.3.0 and temporarily drop the ARM32 support for this Release. After the Rustc PR is finished we can enable the ARM32 in the further Release version.

@DemesneGH DemesneGH marked this pull request as ready for review June 28, 2024 02:42
@DemesneGH DemesneGH changed the title [DRAFT] Upgrade toolchain and std to May 2024 Upgrade toolchain and std to May 2024 Jun 28, 2024
@DemesneGH DemesneGH merged commit 19d9ab8 into apache:release-v0.3.0 Jun 28, 2024
3 checks passed
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