Commit Graph

2313 Commits

Author SHA1 Message Date
bors 228a0ed7b0 Auto merge of #70946 - jumbatm:clashing-extern-decl, r=nagisa
Add a lint to catch clashing `extern` fn declarations.

Closes #69390.

Adds lint `clashing_extern_decl` to detect when, within a single crate, an extern function of the same name is declared with different types. Because two symbols of the same name cannot be resolved to two different functions at link time, and one function cannot possibly have two types, a clashing extern declaration is almost certainly a mistake.

This lint does not run between crates because a project may have dependencies which both rely on the same extern function, but declare it in a different (but valid) way. For example, they may both declare an opaque type for one or more of the arguments (which would end up distinct types), or use types that are valid conversions in the language the extern fn is defined in. In these cases, we can't say that the clashing declaration is incorrect.

r? @eddyb
2020-06-21 02:20:07 +00:00
Ralf Jung 96b86ea1a8 Rollup merge of #73471 - raoulstrackx:raoul/fpu_tag_word, r=jethrogb
Prevent attacker from manipulating FPU tag word used in SGX enclave

Insufficient sanitization of the x87 FPU tag word in the trusted enclave runtime allowed unprivileged adversaries in the containing host application to induce incoherent or unexpected results for ABI-compliant compiled enclave application code that uses the x87 FPU.

Vulnerability was disclosed to us by Fritz Alder, Jo Van Bulck, David Oswald and Frank Piessens

cc: @jethrogb
2020-06-20 16:39:57 +02:00
Ralf Jung 77efcab0f2 Rollup merge of #73171 - tblah:riscv-qemu-test, r=pietroalbini
RISC-V Emulated Testing

Adds a disabled docker image on which to run RISC-V tests. Based on the armhf image.

Test using
```
./src/ci/docker/run.sh riscv64gc-linux
```

cc: @msizanoen1
2020-06-20 16:39:51 +02:00
jumbatm 6b74e3cbb9 Add ClashingExternDecl lint.
This lint checks that all declarations for extern fns of the same name
are declared with the same types.
2020-06-20 16:54:32 +10:00
Raoul Strackx 33b304c5e0 Using xsave restore to restore complete FPU state 2020-06-19 18:39:07 +02:00
Raoul Strackx daedb7920f Prevent attacker from manipulating FPU tag word used in SGX enclave
Insufficient sanitization of the x87 FPU tag word in the trusted enclave runtime allowed unprivileged adversaries in the containing host application to induce incoherent or unexpected results for ABI-compliant compiled enclave application code that uses the x87 FPU.

Vulnerability was disclosed to us by Fritz Alder, Jo Van Bulck, David Oswald and Frank Piessens
2020-06-18 12:11:39 +02:00
qy3u d134870bd4 Document format correction 2020-06-18 17:46:27 +08:00
Lzu Tao 0e6c333ca6 Use Ipv4Addr::from<[u8; 4]> when possible 2020-06-16 01:54:17 +00:00
Stefan Lankes 76f1581a25 remove obsolete , to pass the format check 2020-06-15 10:05:14 +02:00
Stefan Lankes a8e3746e91 add comment about the usage of Arc 2020-06-15 09:29:32 +02:00
Stefan Lankes 6c983a7335 use Ipv6Addr::from to build the IPv6 address 2020-06-15 08:53:58 +02:00
Stefan Lankes 9c9f21fb23 Revert "simplify conversion to IpAddr::V6"
This reverts commit d221ffc68e.
2020-06-15 08:43:44 +02:00
Stefan Lankes aa53a037a2 Revert "changes to pass the format check"
This reverts commit 9d596b50f1.
2020-06-15 08:43:08 +02:00
Stefan Lankes 810ba39563 remove obsolete line 2020-06-15 08:07:56 +02:00
Stefan Lankes 9d596b50f1 changes to pass the format check 2020-06-15 07:28:53 +02:00
Stefan Lankes d221ffc68e simplify conversion to IpAddr::V6 2020-06-14 23:43:54 +02:00
Stefan Lankes c99116afe3 remove unused function 2020-06-14 00:38:31 +02:00
Stefan Lankes 71d41d9e9f add TcpListener support for HermitCore
Add basic support of TcpListerner for HermitCore.
In addition, revise TcpStream to support peer_addr.
2020-06-13 20:51:00 +02:00
Lzu Tao fff822fead Migrate to numeric associated consts 2020-06-10 01:35:47 +00:00
Tom Eccles 253112d43c Mark tests whcih don't work under riscv emulation 2020-06-09 16:22:21 +01:00
Jethro Beekman ea48f2e4da Enable LVI hardening for x86_64-fortanix-unknown-sgx 2020-06-07 12:12:30 +02:00
Mark Rousskov 7139342249 Bump to 1.46 2020-06-03 15:27:51 -04:00
bors 2679c38fc3 Auto merge of #72472 - LeSeulArtichaut:sync-command, r=dtolnay
Implement `Sync` for `process::Command on unix and vxworks

Closes #72387.
r? @cuviper
2020-05-25 02:48:55 +00:00
LeSeulArtichaut 01630b26dd Implement Sync for `process::Command on unix and vxworks 2020-05-22 18:33:12 +02:00
Ralf Jung 53d0046983 Rollup merge of #72123 - jsgf:stabilize-arg0, r=sfackler
Stabilize process_set_argv0 feature for Unix

This stabilizes process_set_argv0 targeting 1.45.0. It has been
useful in practice and seems useful as-is.

The equivalent feature could be implemented for Windows, but as far as I
know nobody has. That can be done separately.

Tracking issue: #66510
2020-05-22 16:58:24 +02:00
bors 9e2a6a29ce Auto merge of #72289 - RalfJung:abort_internal, r=Mark-Simulacrum
abort_internal is safe

`sys::abort_internal` is stably exposed as a safe function. Forward that assumption "inwards" to the `sys` module by making the function itself safe, too.

This corresponds to what https://github.com/rust-lang/rust/pull/72204 did for the intrinsic. We should probably wait until that lands because some of the intrinsic calls in this PR might then need adjustments.
2020-05-18 11:11:19 +00:00
Stefan Lankes 3f47d9d2e6 minor changes to pass the format check 2020-05-18 00:06:32 +02:00
Stefan Lankes 06d692febd use new interface to initialize Condvar
HermitCore introduce a new interface to intialize conditional variables.
Consequently, minor changes are required to support this interface.
2020-05-17 23:49:18 +02:00
Ralf Jung 2764673dca abort_internal is safe 2020-05-17 23:38:31 +02:00
Jeremy Fitzhardinge ff9646c0ad Stabilize process_set_argv0 feature for Unix
This stabilizes process_set_argv0 targeting 1.45.0. It has been
useful in practice and seems useful as-is.

The equivalent feature could be implemented for Windows, but as far as I
know nobody has. That can be done separately.

Tracking issue: #66510
2020-05-12 09:34:23 -07:00
Dylan DPC c818e84821 Rollup merge of #71980 - steveklabnik:warnings-fixes, r=Mark-Simulacrum
Allow a few warnings.

On Windows, these types were causing warnings to be emitted during the
build. These types are allowed to not have idiomatic names, so the
warning should be supressed.
2020-05-07 17:59:00 +02:00
Steve Klabnik d14f000ccc Allow a few warnings.
On Windows, these types were causing warnings to be emitted during the
build. These types are allowed to not have idiomatic names, so the
warning should be supressed.
2020-05-07 07:23:06 -05:00
Dylan DPC a6a7c755fa Rollup merge of #71591 - hermitcore:thread_create, r=hanna-kruppe
use new interface to create threads on HermitCore

- the new interface allows to define the stack size
- increase the default stack size to 1 MByte
2020-05-06 16:58:53 +02:00
Dylan DPC b86620a558 Rollup merge of #71921 - RalfJung:open-mode, r=hanna-kruppe
explain the types used in the open64 call

Fixes https://github.com/rust-lang/rust/issues/71915, where I learned about this quirk. I don't actually know what I am talking about here. ;)
2020-05-06 13:22:22 +02:00
Ralf Jung fbf791bd52 explain the types used in the open64 call 2020-05-05 17:08:22 +02:00
Ralf Jung f9866f95af rely on rdlock/wrlock not returning anything but the specified error codes 2020-05-05 09:08:00 +02:00
Ralf Jung 3f50292edc edit Mutex comment 2020-05-04 20:47:46 +02:00
Ralf Jung 40a6b8c339 explain our rwlock implementation (and fix a potential data race) 2020-05-04 19:37:55 +02:00
Ralf Jung 61fdd3e2be expand comment on default mutex behavior 2020-05-04 19:17:58 +02:00
Markus Reiter 39a97900be Replace cfg macro with attribute. 2020-05-02 17:06:16 +02:00
Steven Fackler c68f23ff6d fix wasi 2020-04-27 04:50:03 -07:00
Stefan Lankes 2c43746758 use nicer code style to define DEFAULT_MIN_STACK_SIZE 2020-04-27 13:18:33 +02:00
Steven Fackler b00afb5782 fix wasm build 2020-04-26 16:34:14 -07:00
Stefan Lankes 4d3cf5bd9b use new interface to create threads on HermitCore
- the new interface allows to define the stack size
2020-04-26 19:47:46 +02:00
Steven Fackler 4bad27a467 Fix stragglers 2020-04-26 04:24:16 -07:00
Steven Fackler 07443f17d4 Update name 2020-04-26 04:24:16 -07:00
Steven Fackler 15262ec6be Add Read/Write::can_read/write_vectored
When working with an arbitrary reader or writer, code that uses vectored
operations may end up being slower than code that copies into a single
buffer when the underlying reader or writer doesn't actually support
vectored operations. These new methods allow you to ask the reader or
witer up front if vectored operations are efficiently supported.

Currently, you have to use some heuristics to guess by e.g. checking if
the read or write only accessed the first buffer. Hyper is one concrete
example of a library that has to do this dynamically:
https://github.com/hyperium/hyper/blob/0eaf304644a396895a4ce1f0146e596640bb666a/src/proto/h1/io.rs#L582-L594
2020-04-26 04:23:39 -07:00
Patrick Mooney dda5c97675 Use fcntl() to set nonblock for solarish sockets
The ioctl(FIONBIO) method of setting a file descriptor to be
non-blocking does not notify the underlying resource in the same way
that fcntl(F_SETFL, O_NONBLOCK) does on illumos and Solaris.
2020-04-15 01:10:22 +00:00
Patrick Mooney b77aefb76e Add illumos triple
Co-Authored-By: Jason King <jason.brian.king@gmail.com>
Co-Authored-By: Joshua M. Clulow <jmc@oxide.computer>
2020-04-14 20:36:07 +00:00
Youngsuk Kim de143312f8 Add missing comma 2020-04-14 09:29:39 -04:00