Commit Graph

20 Commits

Author SHA1 Message Date
Yuki Okushi 6275a29dbe Update `compiler_builtins` to 0.1.39 2021-01-07 16:16:36 +09:00
Alex Crichton f99410bb4b std: Update the backtrace crate submodule
This commit updates the `library/backtrace` submodule which primarily
pulls in support for split-debuginfo on macOS, avoiding the need for
`dsymutil` to get run to get line numbers and filenames in backtraces.
2020-11-20 11:56:07 -08:00
Mara Bos d6da5254a0
Rollup merge of #78138 - fortanix:raoul/dlmalloc0.2, r=Mark-Simulacrum
Upgrade dlmalloc to version 0.2

In preparation of adding dynamic memory management support for SGXv2-enabled platforms, the dlmalloc crate has been refactored. More specifically, support has been added to implement platform specification outside of the dlmalloc crate. (see https://github.com/alexcrichton/dlmalloc-rs/pull/15)

This PR upgrades dlmalloc to version 0.2 for the `wasm` and `sgx` targets.

As the dlmalloc changes have received a positive review, but have not been merged yet, this PR contains a commit to prevent tidy from aborting CI prematurely.

cc: `@jethrogb`
2020-11-17 10:06:16 +01:00
Stefan Lankes 6de51252e0
add options to use optimized and mangled compiler builtins 2020-11-15 08:23:31 +01:00
Raoul Strackx 292f15ce87 Upgrading dlmalloc to 0.2.1 2020-11-12 21:40:52 +01:00
Yuki Okushi 2c307fab49
Rollup merge of #77703 - Keruspe:system-libunwind, r=Mark-Simulacrum
add system-llvm-libunwind config option

allows using the system-wide llvm-libunwind as the unwinder

Workaround for #76020
2020-10-27 08:44:44 +09:00
Jonas Schievink e34263d86a
Rollup merge of #77610 - hermitcore:dtors, r=m-ou-se
revise Hermit's mutex interface to support the behaviour of StaticMutex

rust-lang/rust#77147 simplifies things by splitting this Mutex type into two types matching the two use cases: StaticMutex and MovableMutex. To support the new behavior of StaticMutex, we move part of the mutex implementation into libstd.

The interface to the OS changed. Consequently, I removed a few functions, which aren't longer needed.
2020-10-24 22:39:44 +02:00
varkor 878c97e70c Update to rustc-demangle 0.1.18 2020-10-21 21:11:11 +01:00
varkor 2b9d22d3a9 Update rustc-demangle 2020-10-21 21:05:38 +01:00
Marc-Antoine Perennou 66fa42a946 allow using the system-wide llvm-libunwind as the unwinder
Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com>
2020-10-21 14:45:58 +02:00
Stefan Lankes 98fcc3fbc7
using the latest version of libhermit-rs 2020-10-11 11:53:54 +02:00
Josh Triplett 16ebf750cf Update libc to 0.2.79
This also fixes issues with inconsistent `unsafe` on functions.
2020-10-04 22:12:07 -07:00
Joe Richey 37f795697c
libary: Forward compiler-builtins "mem" feature
This fixes https://github.com/rust-lang/wg-cargo-std-aware/issues/53

Now users will be able to do:
```
cargo build -Zbuild-std=core -Zbuild-std-features=compiler-builtins-mem
```
and correctly get the Rust implemenations for `memcpy` and friends.

Signed-off-by: Joe Richey <joerichey@google.com>
2020-09-27 20:31:06 -07:00
Thomas de Zeeuw f7b6ace029 Use IOV_MAX and UIO_MAXIOV constants in limit vectored I/O
Also updates the libc dependency to 0.2.77 (from 0.2.74) as the
constants were only recently added.
2020-09-10 16:27:28 +02:00
Matt Brubeck 15ccdeb224 Update to hashbrown 0.9 2020-09-08 17:23:26 -07:00
Thomas Vigouroux 392478c29e Update compiler-builtins
Fixes #57820 and #46651
2020-08-28 09:02:39 +02:00
Jubilee 28bca67708
Bump std's libc version to 0.2.74 2020-08-14 00:37:19 -07:00
Amanieu d'Antras d51b7b229a Update hashbrown to 0.8.1 2020-08-07 07:03:12 +01:00
Alex Crichton 06d565c967 std: Switch from libbacktrace to gimli
This commit is a proof-of-concept for switching the standard library's
backtrace symbolication mechanism on most platforms from libbacktrace to
gimli. The standard library's support for `RUST_BACKTRACE=1` requires
in-process parsing of object files and DWARF debug information to
interpret it and print the filename/line number of stack frames as part
of a backtrace.

Historically this support in the standard library has come from a
library called "libbacktrace". The libbacktrace library seems to have
been extracted from gcc at some point and is written in C. We've had a
lot of issues with libbacktrace over time, unfortunately, though. The
library does not appear to be actively maintained since we've had
patches sit for months-to-years without comments. We have discovered a
good number of soundness issues with the library itself, both when
parsing valid DWARF as well as invalid DWARF. This is enough of an issue
that the libs team has previously decided that we cannot feed untrusted
inputs to libbacktrace. This also doesn't take into account the
portability of libbacktrace which has been difficult to manage and
maintain over time. While possible there are lots of exceptions and it's
the main C dependency of the standard library right now.

For years it's been the desire to switch over to a Rust-based solution
for symbolicating backtraces. It's been assumed that we'll be using the
Gimli family of crates for this purpose, which are targeted at safely
and efficiently parsing DWARF debug information. I've been working
recently to shore up the Gimli support in the `backtrace` crate. As of a
few weeks ago the `backtrace` crate, by default, uses Gimli when loaded
from crates.io. This transition has gone well enough that I figured it
was time to start talking seriously about this change to the standard
library.

This commit is a preview of what's probably the best way to integrate
the `backtrace` crate into the standard library with the Gimli feature
turned on. While today it's used as a crates.io dependency, this commit
switches the `backtrace` crate to a submodule of this repository which
will need to be updated manually. This is not done lightly, but is
thought to be the best solution. The primary reason for this is that the
`backtrace` crate needs to do some pretty nontrivial filesystem
interactions to locate debug information. Working without `std::fs` is
not an option, and while it might be possible to do some sort of
trait-based solution when prototyped it was found to be too unergonomic.
Using a submodule allows the `backtrace` crate to build as a submodule
of the `std` crate itself, enabling it to use `std::fs` and such.

Otherwise this adds new dependencies to the standard library. This step
requires extra attention because this means that these crates are now
going to be included with all Rust programs by default. It's important
to note, however, that we're already shipping libbacktrace with all Rust
programs by default and it has a bunch of C code implementing all of
this internally anyway, so we're basically already switching
already-shipping functionality to Rust from C.

* `object` - this crate is used to parse object file headers and
  contents. Very low-level support is used from this crate and almost
  all of it is disabled. Largely we're just using struct definitions as
  well as convenience methods internally to read bytes and such.

* `addr2line` - this is the main meat of the implementation for
  symbolication. This crate depends on `gimli` for DWARF parsing and
  then provides interfaces needed by the `backtrace` crate to turn an
  address into a filename / line number. This crate is actually pretty
  small (fits in a single file almost!) and mirrors most of what
  `dwarf.c` does for libbacktrace.

* `miniz_oxide` - the libbacktrace crate transparently handles
  compressed debug information which is compressed with zlib. This crate
  is used to decompress compressed debug sections.

* `gimli` - not actually used directly, but a dependency of `addr2line`.

* `adler32`- not used directly either, but a dependency of
  `miniz_oxide`.

The goal of this change is to improve the safety of backtrace
symbolication in the standard library, especially in the face of
possibly malformed DWARF debug information. Even to this day we're still
seeing segfaults in libbacktrace which could possibly become security
vulnerabilities. This change should almost entirely eliminate this
possibility whilc also paving the way forward to adding more features
like split debug information.

Some references for those interested are:

* Original addition of libbacktrace - #12602
* OOM with libbacktrace - #24231
* Backtrace failure due to use of uninitialized value - #28447
* Possibility to feed untrusted data to libbacktrace - #21889
* Soundness fix for libbacktrace - #33729
* Crash in libbacktrace - #39468
* Support for macOS, never merged - ianlancetaylor/libbacktrace#2
* Performance issues with libbacktrace - #29293, #37477
* Update procedure is quite complicated due to how many patches we
  need to carry - #50955
* Libbacktrace doesn't work on MinGW with dynamic libs - #71060
* Segfault in libbacktrace on macOS - #71397

Switching to Rust will not make us immune to all of these issues. The
crashes are expected to go away, but correctness and performance may
still have bugs arise. The gimli and `backtrace` crates, however, are
actively maintained unlike libbacktrace, so this should enable us to at
least efficiently apply fixes as situations come up.
2020-07-28 16:34:01 -07:00
mark 2c31b45ae8 mv std libs to library/ 2020-07-27 19:51:13 -05:00