Commit Graph

2300 Commits

Author SHA1 Message Date
Pietro Albini
0a284153e9 Rollup merge of #65905 - cuviper:doc-unix-mode, r=Dylan-DPC
[doc] fixes for unix/vxworks `OpenOptionsExt::mode`
2019-11-05 09:49:52 +01:00
nia
b4f92eaea2 Use any() in code shared between FreeBSD and NetBSD 2019-11-04 17:34:29 +00:00
nia
23d221153f Use KERN_ARND syscall for random numbers on NetBSD, same as FreeBSD.
This system call is present on all supported NetBSD versions and
provides an endless stream of non-blocking random data from the
kernel's ChaCha20-based CSPRNG. It doesn't require a file descriptor
to be opened.

The system call is documented here (under kern.arandom):
https://netbsd.gw.com/cgi-bin/man-cgi?sysctl+7+NetBSD-7.0

And defined here:
https://nxr.netbsd.org/xref/src/sys/sys/sysctl.h#273

The semantics are the same as FreeBSD so reading 256 bytes per call
is fine.

Similar change for getrandom crate: rust-random/getrandom#115
2019-11-04 17:16:11 +00:00
Umesh Kalappa
5083adeaad Implemented the home_dir for VxWorks 2019-11-04 09:15:28 -08:00
BaoshanPang
8995974e70 vxWorks: remove all code related to UNIX socket as it is not supported by vxWorks 2019-10-29 14:27:30 -07:00
Josh Stone
624e7d7cd0 [doc] fix the reference to using OpenOptions::open 2019-10-28 13:03:18 -07:00
Josh Stone
096c99b6eb [doc] add a possessive apostrophe in OpenOptionsExt::mode 2019-10-28 13:01:02 -07:00
bors
fae75cd216 Auto merge of #65167 - hermitcore:rusty-hermit, r=alexcrichton
Redesign the interface to the unikernel HermitCore

We are developing the unikernel HermitCore, where the kernel is written in Rust and is already part of the Rust Standard Library. The interface between the standard library and the kernel based on a small C library. With this pull request, we remove completely the dependency to C and use lld as linker. Currently, the kernel will be linked to the application as static library, which is published at https://github.com/hermitcore/libhermit-rs.

We don’t longer support the C interface to the kernel. Consequently, we remove this part from the Rust Standard Library.
2019-10-26 19:35:59 +00:00
Yuki Okushi
d40c6afba0 Rollup merge of #65810 - raoulstrackx:ac_mitigation, r=nagisa
SGX: Clear additional flag on enclave entry

An attacker could set both the AC flag in CR0 as in rflags. This causes the enclave to perform an AEX upon a misaligned memory access, and an attacker learns some information about the internal enclave state.
The AC flag in rflags is copied from userspace upon an enclave entry. Upon AEX it is copied and later restored. This patch forces the rflag.AC bit to be reset right after an enter.
2019-10-26 02:46:02 +09:00
Raoul Strackx
5aafa98562 forgot pushfq/popqfq: fixed 2019-10-25 16:06:13 +02:00
Raoul Strackx
34f5d5923f cleaning up code 2019-10-25 15:44:07 +02:00
Raoul Strackx
d257c20a1d removed unnecessary push 2019-10-25 15:27:48 +02:00
Mazdak Farrokhzad
f1d747a99d Rollup merge of #65685 - oxalica:statx-eperm, r=alexcrichton
Fix check of `statx` and handle EPERM

Should fix #65662

https://github.com/rust-lang/rust/issues/65662#issuecomment-544593939
> I think a reasonable solution might be to do something like try to stat AT_CWD initially and if that fails with EPERM or ENOSYS we disable the syscall entirely, otherwise it's cached as always good to use.

r? @alexcrichton
2019-10-25 13:12:48 +02:00
Stefan Lankes
d349e32fc7 Merge branch 'master' into rusty-hermit, resolve conflicts 2019-10-25 09:09:55 +02:00
Mazdak Farrokhzad
426c6cf84f Rollup merge of #64178 - mati865:clippy, r=scottmcm
More Clippy fixes for alloc, core and std

Continuation of https://github.com/rust-lang/rust/pull/63805
2019-10-23 22:19:07 +02:00
Yuki Okushi
ff2442ff36 Rollup merge of #65617 - newpavlov:patch-2, r=alexcrichton
Fix WASI sleep impl

Closes #65607

@sunfishcode
Is it fine to use 0 for the `identifier` field? What is this field used for?
2019-10-23 17:14:36 +09:00
oxalica
10f1bc77b3 Some tweaks 2019-10-23 02:43:45 +08:00
Mateusz Mikuła
7491468278 Apply clippy::while_let_on_iterator suggestions 2019-10-22 19:23:10 +02:00
Mateusz Mikuła
95c06a2970 Apply clippy::needless_return suggestions 2019-10-22 19:23:10 +02:00
Stefan Lankes
ddcd157d03 Merge branch 'master' into rusty-hermit 2019-10-22 19:01:09 +02:00
oxalica
c787fe3c70 Fix check of statx 2019-10-22 12:02:32 +08:00
Raoul Strackx
fc50036848 fixed ac vulnerability 2019-10-21 15:10:32 +02:00
Stefan Lankes
b6801b7dcd Merge branch 'master' into rusty-hermit 2019-10-20 10:48:58 +02:00
Stefan Lankes
5ebd4d9c27 move interface to the unikernel in the crate hermit-abi
=> simplifies the maintenance of the interface
2019-10-20 10:46:18 +02:00
Artyom Pavlov
1e2b711d30 fix WASI sleep impl 2019-10-20 06:31:27 +00:00
bors
7bf377f289 Auto merge of #65469 - mati865:libc, r=alexcrichton
Update libc to 0.2.64

Passed local tests.

cc potentially interested people: @gnzlbg @tlively
2019-10-20 06:10:51 +00:00
oxalica
2ee45c9da2 Fix cast of stx_btime.tv_nsec 2019-10-18 10:32:27 +08:00
oxalica
15cb3e08e3 Fix cfgs for current libc 2019-10-18 10:32:27 +08:00
oxalica
43f398be6d Prefer statx on linux if available 2019-10-18 10:32:27 +08:00
Mazdak Farrokhzad
10b580a1d1 Rollup merge of #65316 - oconnor663:noninheritable, r=alexcrichton
make File::try_clone produce non-inheritable handles on Windows

~**NOT READY FOR REVIEW.** This PR is currently mainly to trigger CI so that I can see what happens. (Is there a better way to trigger CI?) I don't know whether this change makes sense yet.~ (Edit: @Mark-Simulacrum clarified that CI doesn't currently run on Windows.)

---

File handles shouldn't be inheritable in general.
`std::process::Command` takes care of making them inheritable when child
processes are spawned, and the `CREATE_PROCESS_LOCK` protects against
races in that section on Windows. But `File::try_clone` has been
creating inheritable file descriptors outside of that lock, which could
be leaking into other child processes unintentionally.

See also https://github.com/rust-lang/rust/pull/31069#discussion_r334117665.
2019-10-17 13:46:04 +02:00
Mateusz Mikuła
6de4924b6c Update emscripten functions declarations 2019-10-17 12:09:11 +02:00
Thomas Lively
2bf59bea48 Upgrade Emscripten targets to use upstream LLVM backend
- Compatible with Emscripten 1.38.46-upstream or later upstream.
 - Refactors the Emscripten target spec to share code with other wasm
   targets.
 - Replaces the old incorrect wasm32 C call ABI with the correct one,
   preserving the old one as wasm32_bindgen_compat for wasm-bindgen
   compatibility.
 - Updates the varargs ABI used by Emscripten and deletes the old one.
 - Removes the obsolete wasm32-experimental-emscripten target.
 - Uses EMCC_CFLAGS on CI to avoid the timeout problems with #63649.
2019-10-16 17:06:48 -07:00
Mazdak Farrokhzad
2a9c791076 Rollup merge of #65246 - Wind-River:real_master_2, r=kennytm
vxWorks: implement get_path() and get_mode() for File fmt::Debug
2019-10-13 19:17:06 +02:00
Jack O'Connor
93ae6924af make File::try_clone produce non-inheritable handles on Windows
File handles shouldn't be inheritable in general.
`std::process::Command` takes care of making them inheritable when child
processes are spawned, and the `CREATE_PROCESS_LOCK` protects against
races in that section on Windows. But `File::try_clone` has been
creating inheritable file descriptors outside of that lock, which could
be leaking into other child processes unintentionally.

See also https://github.com/rust-lang/rust/pull/31069#discussion_r334117665.
2019-10-11 14:23:25 -04:00
BaoshanPang
6afc5091b9 vxWorks: implement get_path() and get_mode() for File fmt::Debug 2019-10-10 08:41:10 -07:00
Baoshan Pang
175db95b3d add checking (r == 0) 2019-10-08 18:57:17 -07:00
Stefan Lankes
82f40c4b9b minor changes to follow the Rust's style guidelines 2019-10-06 15:53:26 +00:00
Stefan Lankes
c1e440a90f redesign of the interface to the unikernel HermitCore
- the old interface between HermitCore and the Rust Standard Library
  based on a small C library (newlib)
- remove this interface and call directly the unikernel
- remove the dependency to the HermitCore linker
- use rust-lld as linker
2019-10-06 15:26:14 +00:00
Thomas Lively
9a55103b98 Upgrade Emscripten targets to use upstream LLVM backend
- Refactors the Emscripten target spec to share code with other wasm
   targets.
 - Replaces the incorrect wasm32 C call ABI with the old asmjs
   version, which is correct for both wasm32 and JS.
 - Updates the varargs ABI used by Emscripten and deletes the old one.
 - Removes the obsolete wasm32-experimental-emscripten target.
 - Temporarily makes Emscripten targets use panic=abort by default
   because supporting unwinding will require an LLVM patch.
2019-10-04 00:47:21 -07:00
Mazdak Farrokhzad
2d4c101af5 Rollup merge of #64818 - Wind-River:master, r=alexcrichton
update rtpSpawn's parameters type(It's prototype has been updated in libc)

r? @alexcrichton
2019-09-28 05:37:51 +02:00
Baoshan Pang
dd38a0f6c7 update rtpSpawn's parameters type(It's prototype has been updated in libc) 2019-09-25 20:10:29 -07:00
Tyler Mandry
80db06d6da Fix ExitStatus on Fuchsia
Fuchsia exit codes don't follow the convention of libc::WEXITSTATUS et
al, and they are 64 bits instead of 32 bits. This gives Fuchsia its own
representation of ExitStatus.

Additionally, the zircon syscall structs were out of date, causing us to
see bogus return codes.
2019-09-25 15:26:42 -07:00
Baoshan Pang
b548814a8b remove rtp.rs, and move rtpSpawn and RTP_ID_ERROR to libc 2019-09-23 15:37:18 -07:00
n-salim
494d83c892 Merge pull request #25 from Wind-River/stat
rust stat should call libc stat
2019-09-20 16:20:29 -07:00
Baoshan Pang
b956ae38e1 rust stat should call libc stat 2019-09-20 15:47:13 -07:00
Baoshan Pang
491a0c6902 No home directory on vxWorks 2019-09-20 13:25:57 -07:00
Mazdak Farrokhzad
f669872690 Rollup merge of #64393 - Wind-River:master_002_envKey, r=alexcrichton
declare EnvKey before use to fix build error

r? @alexcrichton
2019-09-14 16:42:32 +02:00
Mazdak Farrokhzad
1e2a97018f Rollup merge of #64372 - Wind-River:master, r=alexcrichton
use randSecure and randABytes

r? @alexcrichton

cc @n-salim
2019-09-14 16:42:25 +02:00
Baoshan Pang
b731e11d52 declare EnvKey before use to fix build error 2019-09-10 21:35:01 -07:00
Mazdak Farrokhzad
34f38d9809 Rollup merge of #64129 - Wind-River:master_003, r=alexcrichton
vxWorks: set DEFAULT_MIN_STACK_SIZE to 256K and use min_stack to pass initial stack size to rtpSpawn

vxWorks: set DEFAULT_MIN_STACK_SIZE to 256K and use min_stack to pass initial stack size to rtpSpawn

r? @alexcrichton
cc @n-salim
2019-09-11 02:38:06 +02:00