about summary refs log tree commit diff
path: root/src/libstd/sys/sgx
AgeCommit message (Collapse)AuthorLines
2019-04-01SGX target: convert a bunch of panics to abortsJethro Beekman-48/+52
2019-03-31libstd: deny(elided_lifetimes_in_paths), fixes in sgxMazdak Farrokhzad-19/+20
2019-03-31libstd: deny(elided_lifetimes_in_paths)Mazdak Farrokhzad-14/+14
2019-03-28Fix missed fn rename in #59284Jethro Beekman-1/+1
2019-03-27Rollup merge of #59284 - RalfJung:maybe-uninit, r=sfacklerJosh Stone-5/+5
adjust MaybeUninit API to discussions uninitialized -> uninit into_initialized -> assume_init read_initialized -> read set -> write
2019-03-26fix some uses I missedRalf Jung-5/+5
2019-03-26Rollup merge of #59374 - faern:simplify-checked-duration-since, r=shepmasterMazdak Farrokhzad-2/+2
Simplify checked_duration_since This follows the same design as we updated to in #56490. Internally, all the system specific time implementations are checked, no panics. Then the panicking publicly exported API can just call the checked version of itself and make do with a single panic (`expect`) at the top. Since the internal sys implementations are now checked, this gets rid of the extra `if self >= &earlier` check in `checked_duration_since`. Except likely making the generated machine code simpler, it also reduces the algorithm from "Check panic condition -> call possibly panicking method" to just "call non panicking method". Added two test cases: * Edge case: Make sure `checked_duration_since` on two equal `Instant`s produce a zero duration, not a `None`. * Most common/intended usage: Make sure `later.checked_duration_since(earlier)`, returns an expected value.
2019-03-26Auto merge of #59136 - jethrogb:jb/sgx-std-test, r=sanxiynbors-59/+137
SGX target: fix std unit tests This fixes some tests and some code in the SGX sys implementation to make the `std` unit test suite pass. #59009 must be merged first.
2019-03-25SGX target: fix std unit testsJethro Beekman-59/+137
2019-03-22Update sys::time impls to have checked_sub_instantLinus Färnstrand-2/+2
2019-03-22Auto merge of #59370 - Centril:rollup, r=Centrilbors-0/+4
Rollup of 18 pull requests Successful merges: - #59106 (Add peer_addr function to UdpSocket) - #59170 (Add const generics to rustdoc) - #59172 (Update and clean up several parts of CONTRIBUTING.md) - #59190 (consistent naming for Rhs type parameter in libcore/ops) - #59236 (Rename miri component to miri-preview) - #59266 (Do not complain about non-existing fields after parse recovery) - #59273 (some small HIR doc improvements) - #59291 (Make Option<ThreadId> no larger than ThreadId, with NonZeroU64) - #59297 (convert field/method confusion help to suggestions) - #59304 (Move some bench tests back from libtest) - #59309 (Add messages for different verbosity levels. Output copy actions.) - #59321 (Unify E0109, E0110 and E0111) - #59322 (Tweak incorrect escaped char diagnostic) - #59323 (use suggestions for "enum instead of variant" error) - #59327 (Add NAN test to docs) - #59329 (cleanup: Remove compile-fail-fulldeps directory again) - #59347 (Move one test from run-make-fulldeps to ui) - #59360 (Add tracking issue number for `seek_convenience`) Failed merges: r? @ghost
2019-03-22Rollup merge of #59106 - LinusU:udp-peer-addr, r=kennytmMazdak Farrokhzad-0/+4
Add peer_addr function to UdpSocket Fixes #59104 This is my first pull request to Rust, so opening early for some feedback. My biggest question is: where do I add tests? Any comments very much appreciated!
2019-03-22Auto merge of #58953 - jethrogb:jb/unify-ffi, r=alexcrichtonbors-285/+35
Unify OsString/OsStr for byte-based implementations As requested in #57860 r? @joshtriplett
2019-03-21Unify OsString/OsStr for byte-based implementationsJethro Beekman-285/+35
2019-03-16Rollup merge of #59009 - sfackler:fix-sgx-vectors, r=alexcrichtonkennytm-12/+4
Fix SGX implementations of read/write_vectored.
2019-03-16Add peer_addr function to UdpSocketLinus Unnebäck-0/+4
2019-03-16Rollup merge of #58949 - jethrogb:jb/sgx-thread-id, r=joshtriplettkennytm-0/+1
SGX target: Expose thread id function in os module In order to call `std::os::fortanix_sgx::usercalls::send`, you need the thread id. This exposes it through another function in `std::os::fortanix_sgx`. I looked at how other platforms do this. On Windows and `cfg(unix)` you can get the OS handle from a `thread::JoinHandle`, but that's not sufficient, I need it for a `thread::Thread`. In the future, this functionality could be added to `thread::Thread` and this platform can follow suit. r? @joshtriplett
2019-03-09Use lifetime contravariance to elide more lifetimes in core+alloc+stdScott McMurray-2/+2
2019-03-07Always call read/write from default vectored io methodsSteven Fackler-8/+2
2019-03-07Fix SGX implementations of read/write_vectored.Steven Fackler-12/+10
2019-03-05SGX target: Expose thread id function in os moduleJethro Beekman-0/+1
2019-02-28Fix some imports and pathsTaiki Endo-1/+1
2019-02-28libstd => 2018Taiki Endo-161/+162
2019-02-26Auto merge of #58357 - sfackler:vectored-io, r=alexcrichtonbors-27/+75
Add vectored read and write support This functionality has lived for a while in the tokio ecosystem, where it can improve performance by minimizing copies. r? @alexcrichton
2019-02-24Fix sgxSteven Fackler-3/+3
2019-02-24Rollup merge of #58454 - pitdicker:windows_stdio, r=alexcrichtonMazdak Farrokhzad-19/+12
Refactor Windows stdio and remove stdin double buffering I was looking for something nice and small to work on, tried to tackle a few FIXME's in Windows stdio, and things grew from there. This part of the standard library contains some tricky code, and has changed over the years to handle more corner cases. It could use some refactoring and extra comments. Changes/fixes: - Made `StderrRaw` `pub(crate)`, to remove the `Write` implementations on `sys::Stderr` (used unsynchronised for panic output). - Remove the unused `Read` implementation on `sys::windows::stdin` - The `windows::stdio::Output` enum made sense when we cached the handles, but we can use simple functions like `is_console` now that we get the handle on every read/write - `write` can now calculate the number of written bytes as UTF-8 when we can't write all `u16`s. - If `write` could only write one half of a surrogate pair, attempt another write for the other because user code can't reslice in any way that would allow us to write it otherwise. - Removed the double buffering on stdin. Documentation on the unexposed `StdinRaw` says: 'This handle is not synchronized or buffered in any fashion'; which is now true. - `sys::windows::Stdin` now always only partially fills its buffer, so we can guarantee any arbitrary UTF-16 can be re-encoded without losing any data. - `sys::windows::STDIN_BUF_SIZE` is slightly larger to compensate. There should be no real change in the number of syscalls the buffered `Stdin` does. This buffer is a little larger, while the extra buffer on Stdin is gone. - `sys::windows::Stdin` now attempts to handle unpaired surrogates at its buffer boundary. - `sys::windows::Stdin` no langer allocates for its buffer, but the UTF-16 decoding still does. ### Testing I did some manual testing of reading and writing to console. The console does support UTF-16 in some sense, but doesn't supporting displaying characters outside the BMP. - compile stage 1 stdlib with a tiny value for `MAX_BUFFER_SIZE` to make it easier to catch corner cases - run a simple test program that reads on stdin, and echo's to stdout - write some lines with plenty of ASCII and emoji in a text editor - copy and paste in console to stdin - return with `\r\n\` or CTRL-Z - copy and paste in text editor - check it round-trips ----- Fixes https://github.com/rust-lang/rust/issues/23344. All but one of the suggestions in that issue are now implemented. the missing one is: > * When reading data, we require the entire set of input to be valid UTF-16. We should instead attempt to read as much of the input as possible as valid UTF-16, only returning an error for the actual invalid elements. For example if we read 10 elements, 5 of which are valid UTF-16, the 6th is bad, and then the remaining are all valid UTF-16, we should probably return the first 5 on a call to `read`, then return an error, then return the remaining on the next call to `read`. Stdin in Console mode is dealing with text directly input by a user. In my opinion getting an unpaired surrogate is quite unlikely in that case, and a valid reason to error on the entire line of input (which is probably short). Dealing with it is incompatible with an unbuffered stdin, which seems the more interesting guarantee to me.
2019-02-20Use standard Read/Write traits in sys::stdioPaul Dicker-8/+14
2019-02-20Remove sys::*::Stderr Write implementationPaul Dicker-13/+0
2019-02-14SGX target: fix panic = abortJethro Beekman-0/+1
2019-02-13impl Deref/DerefMut for IoVec typesSteven Fackler-5/+5
Returning &'a mut [u8] was unsound, and we may as well just have them directly deref to their slices to make it easier to work with them.
2019-02-13Add vectored read and write supportSteven Fackler-26/+74
This functionality has lived for a while in the tokio ecosystem, where it can improve performance by minimizing copies.
2019-02-13Auto merge of #58235 - jethrogb:jb/sgx-usercall-internals, r=alexcrichtonbors-81/+59
SGX target: simplify usercall internals This moves logic from assembly to Rust and removes the special case for exit/panic handling, merging it with regular usercall handling. Also, this fixes a bug in the exit usercall introduced in a75ae00. The bug would make regular exits look like panics with high probability. It would also with some probability leak information through uncleared registers. cc @VardhanThigle r? @alexcrichton
2019-02-10libs: doc commentsAlexander Regueiro-29/+36
2019-02-10Auto merge of #58129 - RalfJung:maybe-uninit, r=cramertjbors-2/+2
MaybeUninit: some docs, rename into_inner -> into_initialized, return &mut from set
2019-02-10fix SGX build failuresRalf Jung-2/+2
2019-02-06SGX target: simplify usercall internalsJethro Beekman-81/+59
This moves logic from assembly to Rust and removes the special case for exit/panic handling, merging it with regular usercall handling. Also, this fixes a bug in the exit usercall introduced in a75ae00. The bug would make regular exits look like panics with high probability. It would also with some probability leak information through uncleared registers.
2019-02-06Rollup merge of #58182 - jethrogb:jb/sgx-bytebuffer-len-0, r=joshtriplettkennytm-2/+8
SGX target: handle empty user buffers correctly Also, expose correct items in `os::fortanix_sgx::usercalls::alloc` * [read_alloc documentation](https://edp.fortanix.com/docs/api/fortanix_sgx_abi/struct.Usercalls.html#method.read_alloc) * [Clarified ByteBuffer documentation](https://github.com/fortanix/rust-sgx/pull/94/files#diff-ca843ad9e25cacd63a80579c0f7efa56) r? @joshtriplett
2019-02-05SGX target: handle empty user buffers correctlyJethro Beekman-2/+8
2019-02-04Remove stray FIXMEJethro Beekman-3/+0
2019-02-01Fix `std::os::fortanix_sgx::usercalls::raw::UsercallNrs`Jethro Beekman-4/+9
Fixes https://github.com/fortanix/rust-sgx/issues/88
2019-01-29SGX target: improve panic & exit handlingJethro Beekman-22/+32
2019-01-26Replace deprecated ATOMIC_INIT constsMark Rousskov-4/+37
2019-01-24Rollup merge of #57860 - jethrogb:jb/sgx-os-ffi, r=joshtriplettMazdak Farrokhzad-0/+110
Add os::fortanix_sgx::ffi module This uses the same byte slice accessors that Unix has. The [ABI specifies](https://docs.rs/fortanix-sgx-abi/0.3.2/fortanix_sgx_abi/struct.ByteBuffer.html) byte slices.
2019-01-23Add os::fortanix_sgx::ffi moduleJethro Beekman-0/+110
2019-01-21Expose alloc/dealloc properly for SGX libunwindJethro Beekman-0/+15
2019-01-13Fix breakage from #56988 and workaround for #57569Vardhan Thigle-0/+9
2019-01-13Adding Build automation for x86_64-fortanix-unknown-sgxVardhan Thigle-0/+10
2019-01-12Rollup merge of #57511 - jethrogb:jb/fix-undef, r=cramertjMazdak Farrokhzad-2/+2
Fix undefined behavior From the [`MaybeUninit::get_mut` docs](https://doc.rust-lang.org/std/mem/union.MaybeUninit.html): > It is up to the caller to guarantee that the the MaybeUninit really is in an initialized state, otherwise this will immediately cause undefined behavior. r? @joshtriplett
2019-01-11Fix undefined behaviorJethro Beekman-2/+2
2019-01-09Exposing enclave image-base to the enclave applicationVardhan Thigle-7/+5
image-base could be used by crates like backtrace to providing to make symbol resolution easier.