1. 22 7月, 2020 1 次提交
  2. 18 7月, 2020 3 次提交
    • F
      fixes #67108 by using the external crate · 4b6a0278
      Federico Ponzi 提交于
      4b6a0278
    • A
      std: Switch from libbacktrace to gimli · 13db3cc1
      Alex Crichton 提交于
      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.
      13db3cc1
    • R
      Generating the coverage map · a6f8b8a2
      Rich Kadel 提交于
      rustc now generates the coverage map and can support (limited)
      coverage report generation, at the function level.
      
      Example:
      
      $ BUILD=$HOME/rust/build/x86_64-unknown-linux-gnu
      $ $BUILD/stage1/bin/rustc -Zinstrument-coverage \
      $HOME/rust/src/test/run-make-fulldeps/instrument-coverage/main.rs
      $ LLVM_PROFILE_FILE="main.profraw" ./main
      called
      $ $BUILD/llvm/bin/llvm-profdata merge -sparse main.profraw -o main.profdata
      $ $BUILD/llvm/bin/llvm-cov show --instr-profile=main.profdata main
          1|      1|pub fn will_be_called() {
          2|      1|    println!("called");
          3|      1|}
          4|       |
          5|      0|pub fn will_not_be_called() {
          6|      0|    println!("should not have been called");
          7|      0|}
          8|       |
          9|      1|fn main() {
         10|      1|    let less = 1;
         11|      1|    let more = 100;
         12|      1|
         13|      1|    if less < more {
         14|      1|        will_be_called();
         15|      1|    } else {
         16|      1|        will_not_be_called();
         17|      1|    }
         18|      1|}
      a6f8b8a2
  3. 17 7月, 2020 2 次提交
  4. 16 7月, 2020 1 次提交
  5. 15 7月, 2020 3 次提交
  6. 14 7月, 2020 1 次提交
  7. 13 7月, 2020 1 次提交
  8. 08 7月, 2020 2 次提交
    • A
      Fix cross-compilation of LLVM to aarch64 Windows targets · 59f979fa
      Arlo Siemsen 提交于
      When cross-compiling, the LLVM build system recurses to build tools
      that need to run on the host system. However, since we pass cmake defines
      to set the compiler and target, LLVM still compiles these tools for the
      target system, rather than the host. The tools then fail to execute
      during the LLVM build.
      
      This change sets defines for the tools that need to run on the
      host (llvm-nm, llvm-tablegen, and llvm-config), so that the LLVM build
      does not attempt to build them, and instead relies on the tools already built.
      
      If compiling with clang-cl, this change also adds the `--target` option
      to specify the target triple. MSVC compilers do not require this, since there
      is a separate compiler binary for cross-compilation.
      59f979fa
    • M
      Update rust-installer to latest version · 32025fd7
      Michael Forney 提交于
      This pulls in a fix for the install script on some tr(1) implementations,
      as well as an update to use `anyhow` instead of `failure` for error
      handling.
      32025fd7
  9. 03 7月, 2020 1 次提交
  10. 27 6月, 2020 1 次提交
  11. 26 6月, 2020 3 次提交
  12. 24 6月, 2020 1 次提交
  13. 23 6月, 2020 1 次提交
    • A
      Stop using old version of `syn` in `rustc-workspace-hack` · e2ab98df
      Aaron Hill 提交于
      None of the tools seem to need syn 0.15.35, so we can just build syn
      1.0.
      
      This was causing an issue with clippy's `compile-test` program: since
      multiple versions of `syn` would exist in the build directory, we would
      non-deterministically pick one based on filesystem iteration order. If
      the pre-1.0 version of `syn` was picked, a strange build error would
      occur (see
      https://github.com/rust-lang/rust/pull/73594#issuecomment-647671463)
      
      To prevent this kind of issue from happening again, we now panic if we
      find multiple versions of a crate in the build directly, instead of
      silently picking the first version we find.
      e2ab98df
  14. 22 6月, 2020 1 次提交
  15. 20 6月, 2020 7 次提交
  16. 19 6月, 2020 1 次提交
  17. 15 6月, 2020 1 次提交
    • T
      Diagnose use of incompatible sanitizers · 0a65f280
      Tomasz Miąsko 提交于
      Emit an error when incompatible sanitizer are configured through command
      line options. Previously the last one configured prevailed and others
      were silently ignored.
      
      Additionally use a set to represent configured sanitizers, making it
      possible to enable multiple sanitizers at once. At least in principle,
      since currently all of them are considered to be incompatible with
      others.
      0a65f280
  18. 14 6月, 2020 1 次提交
  19. 10 6月, 2020 1 次提交
  20. 07 6月, 2020 1 次提交
  21. 04 6月, 2020 1 次提交
  22. 03 6月, 2020 1 次提交
  23. 02 6月, 2020 1 次提交
  24. 30 5月, 2020 1 次提交
  25. 29 5月, 2020 1 次提交
  26. 28 5月, 2020 1 次提交