forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of rust-lang#98949 - ehuss:update-beta-cargo, r=ehuss
[beta] Beta 1.63 backports * fix data race in thread::scope rust-lang#98503 * Mitigate MMIO stale data vulnerability rust-lang#98126 * Cargo: * [BETA-1.63] Fix zsh completions for add and locate-project (rust-lang/cargo#10811) * [BETA-1.63] Bump cargo-util version. (rust-lang/cargo#10805)
- Loading branch information
Showing
7 changed files
with
161 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
use super::alloc::copy_to_userspace; | ||
use super::alloc::User; | ||
|
||
#[test] | ||
fn test_copy_function() { | ||
let mut src = [0u8; 100]; | ||
let mut dst = User::<[u8]>::uninitialized(100); | ||
|
||
for i in 0..src.len() { | ||
src[i] = i as _; | ||
} | ||
|
||
for size in 0..48 { | ||
// For all possible alignment | ||
for offset in 0..8 { | ||
// overwrite complete dst | ||
dst.copy_from_enclave(&[0u8; 100]); | ||
|
||
// Copy src[0..size] to dst + offset | ||
unsafe { copy_to_userspace(src.as_ptr(), dst.as_mut_ptr().offset(offset), size) }; | ||
|
||
// Verify copy | ||
for byte in 0..size { | ||
unsafe { | ||
assert_eq!(*dst.as_ptr().offset(offset + byte as isize), src[byte as usize]); | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Submodule cargo
updated
3 files
+1 −1 | Cargo.toml | |
+1 −1 | crates/cargo-util/Cargo.toml | |
+11 −11 | src/etc/_cargo |