about summary refs log tree commit diff
path: root/library/std/src/sys/sgx/abi
AgeCommit message (Collapse)AuthorLines
2024-01-11std: begin moving platform support modules into `pal`joboet-2384/+0
2023-11-26Making `User<T>` and `User<[T]>` `Send`Raoul Strackx-0/+6
2023-07-31Clean up SGX user memory copiesJethro Beekman-122/+85
2023-05-03Fix MXCSR configuration dependent timingRaoul Strackx-1/+5
Some data-independent timing vector instructions may have subtle data-dependent timing due to MXCSR configuration; dependent on (potentially secret) data instruction retirement may be delayed by one cycle.
2023-04-26Spelling library/Josh Soref-2/+2
* advance * aligned * borrowed * calculate * debugable * debuggable * declarations * desugaring * documentation * enclave * ignorable * initialized * iterator * kaboom * monomorphization * nonexistent * optimizer * panicking * process * reentrant * rustonomicon * the * uninitialized Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>
2023-04-12remove some unneeded importsKaDiWa-1/+0
2022-10-14Bugfix: keep TLS data in syncRaoul Strackx-0/+1
2022-09-24Rollup merge of #100823 - WaffleLapkin:less_offsets, r=scottmcmMatthias Krüger-14/+14
Refactor some `std` code that works with pointer offstes This PR replaces `pointer::offset` in standard library with `pointer::add` and `pointer::sub`, [re]moving some casts and using `.addr()` while we are at it. This is a more complicated refactor than all other sibling PRs, so take a closer look when reviewing, please 😃 (though I've checked this multiple times and it looks fine). r? ````@scottmcm```` _split off from #100746, continuation of #100822_
2022-09-11std: check if TCS is a null pointerjoboet-2/+6
2022-09-04Make code worling w/ pointers in ↵Maybe Waffle-14/+14
`library/std/src/sys/sgx/abi/usercalls/alloc.rs` nicer - Use `.addr()` instead of `as`-cast - Use `add` instead of `offset` and remove some `as isize` casts by doing that - Remove some casts
2022-08-22Rollup merge of #100820 - WaffleLapkin:use_ptr_is_aligned_methods, r=scottmcmDylan DPC-2/+2
Use pointer `is_aligned*` methods This PR replaces some manual alignment checks with calls to `pointer::{is_aligned, is_aligned_to}` and removes a useless pointer cast. r? `@scottmcm` _split off from #100746_
2022-08-21Rollup merge of #100822 - WaffleLapkin:no_offset_question_mark, r=scottmcmMatthias Krüger-2/+2
Replace most uses of `pointer::offset` with `add` and `sub` As PR title says, it replaces `pointer::offset` in compiler and standard library with `pointer::add` and `pointer::sub`. This generally makes code cleaner, easier to grasp and removes (or, well, hides) integer casts. This is generally trivially correct, `.offset(-constant)` is just `.sub(constant)`, `.offset(usized as isize)` is just `.add(usized)`, etc. However in some cases we need to be careful with signs of things. r? ````@scottmcm```` _split off from #100746_
2022-08-21Make use of `pointer::is_aligned[_to]`Maybe Waffle-2/+2
2022-08-21Replace most uses of `pointer::offset` with `add` and `sub`Maybe Waffle-2/+2
2022-08-20Rollup merge of #100642 - mzohreva:mz/update-sgx-abi-cancel-queue, ↵Matthias Krüger-4/+30
r=Mark-Simulacrum Update fortanix-sgx-abi and export some useful SGX usercall traits Update `fortanix-sgx-abi` to 0.5.0 to add support for cancel queue (see https://github.com/fortanix/rust-sgx/pull/405 and https://github.com/fortanix/rust-sgx/pull/404). Export some useful traits for processing SGX usercall. This is needed for https://github.com/fortanix/rust-sgx/pull/404 to avoid duplication. cc `@raoulstrackx` and `@jethrogb`
2022-08-17Mitigate Stale Data Read for xAPIC vulnerabilityRaoul Strackx-7/+137
In order to mitigate the Stale Data Read for xAPIC vulnerability completely, reading userspace from an SGX enclave must be aligned and in 8-bytes chunks. References: - https://www.intel.com/content/www/us/en/security-center/advisory/intel-sa-00657.html - https://www.intel.com/content/www/us/en/developer/articles/technical/software-security-guidance/advisory-guidance/stale-data-read-from-xapic.html
2022-08-16Update fortanix-sgx-abi and export some useful SGX usercall traitsMohsen Zohrevandi-4/+30
Update fortanix-sgx-abi to 0.5.0 to add support for cancel queue (see https://github.com/fortanix/rust-sgx/pull/405 and https://github.com/fortanix/rust-sgx/pull/404). Export some useful traits for processing SGX usercall. This is needed for https://github.com/fortanix/rust-sgx/pull/404 to avoid duplication.
2022-08-16Refactor copying data to userspaceRaoul Strackx-19/+32
2022-08-05cleanup code w/ pointers in std a littleMaybe Waffle-1/+1
2022-06-22Address reviewer commentsRaoul Strackx-5/+10
2022-06-15Test `copy_to_userspace` functionRaoul Strackx-1/+33
2022-06-15Ensure userspace allocation is 8-byte alignedRaoul Strackx-1/+4
2022-06-15Mitigate MMIO stale data vulnerabilitiesRaoul Strackx-2/+98
Intel Security Advisory: https://www.intel.com/content/www/us/en/security-center/advisory/intel-sa-00615.html
2022-06-15Unify copying data from enclave to userspaceRaoul Strackx-7/+3
2022-05-09Use Rust 2021 prelude in std itself.Mara Bos-1/+0
2022-04-01Remove need for associated_type_bounds in std.Mara Bos-2/+4
2022-03-10Use implicit capture syntax in format_argsT-O-R-U-S-4/+4
This updates the standard library's documentation to use the new syntax. The documentation is worthwhile to update as it should be more idiomatic (particularly for features like this, which are nice for users to get acquainted with). The general codebase is likely more hassle than benefit to update: it'll hurt git blame, and generally updates can be done by folks updating the code if (and when) that makes things more readable with the new format. A few places in the compiler and library code are updated (mostly just due to already having been done when this commit was first authored).
2021-12-12Stabilize asm! and global_asm!Amanieu d'Antras-0/+3
They are also removed from the prelude as per the decision in https://github.com/rust-lang/rust/issues/87228. stdarch and compiler-builtins are updated to work with the new, stable asm! and global_asm! macros.
2021-06-22Rollup merge of #85054 - jethrogb:jb/sgx-inline-asm, r=AmanieuYuki Okushi-2/+2
Revert SGX inline asm syntax This was erroneously changed in #83387
2021-05-13Add support for const operands and options to global_asm!Amanieu d'Antras-1/+1
On x86, the default syntax is also switched to Intel to match asm!
2021-05-07Revert SGX inline asm syntaxJethro Beekman-2/+2
This was erroneously changed in #83387
2021-05-07Rearrange SGX split module filesJethro Beekman-0/+0
In #75979 several inlined modules were split out into multiple files. This PR keeps the multiple files but moves a few things around to organize things in a coherent way.
2021-04-21Ensure TLS destructors run before thread joins in SGXMohsen Zohrevandi-2/+4
2021-03-22Fix asm! from AT&T to Intel syntaxJosh Stone-1/+1
2021-03-22Update the minimum external LLVM to 10Josh Stone-2/+1
2021-03-03Auto merge of #76345 - okready:sgx-mem-range-overflow-checks, r=joshtriplettbors-8/+34
Add is_enclave_range/is_user_range overflow checks Fixes #76343. This adds overflow checking to `is_enclave_range` and `is_user_range` in `sgx::os::fortanix_sgx::mem` in order to mitigate possible security issues with enclave code. It also accounts for an edge case where the memory range provided ends exactly at the end of the address space, where calculating `p + len` would overflow back to zero despite the range potentially being valid.
2020-12-22Migrate standard library away from compare_and_swapLinus Färnstrand-4/+4
2020-11-12Upgrading dlmalloc to 0.2.1Raoul Strackx-0/+12
2020-10-08Auto merge of #77346 - Caduser2020:master, r=Mark-Simulacrumbors-62/+93
`#[deny(unsafe_op_in_unsafe_fn)]` in sys/sgx This is part of #73904. Enclose unsafe operations in unsafe blocks in `libstd/sys/sgx`.
2020-10-08`#[deny(unsafe_op_in_unsafe_fn)]` in sys/sgxCaduser2020-62/+93
Run `./x.py` fmt Add reference link Fix reference link Apply review suggestions.
2020-09-28Prefer asm! in std - all in sgx moduleLzu Tao-2/+9
2020-09-04Add is_enclave_range/is_user_range overflow checksTheodore Cipicchio-8/+34
Functions such as `is_enclave_range` and `is_user_range` in `sgx::os::fortanix_sgx::mem` are often used to make sure memory ranges passed to an enclave from untrusted code or passed to other trusted code functions are safe to use for their intended purpose. Currently, these functions do not perform any checks to make sure the range provided doesn't overflow when adding the range length to the base address. While debug builds will panic if overflow occurs, release builds will simply wrap the result, leading to false positive results for either function. The burden is placed on application authors to know to perform overflow checks on their own before calling these functions, which can easily lead to security vulnerabilities if omitted. Additionally, since such checks are performed in the Intel SGX SDK versions of these functions, developers migrating from Intel SGX SDK code may expect these functions to operate the same. This commit adds explicit overflow checking to `is_enclave_range` and `is_user_range`, returning `false` if overflow occurs in order to prevent misuse of invalid memory ranges. It also alters the checks to account for ranges that lie exactly at the end of the address space, where calculating `p + len` would overflow despite the range being valid.
2020-08-31std: move "mod tests/benches" to separate filesLzu Tao-114/+112
Also doing fmt inplace as requested.
2020-07-27mv std libs to library/mark-0/+2027