Skip to content

Commit 3053494

Browse files
authored
Rollup merge of rust-lang#38699 - japaric:lsan, r=alexcrichton
LeakSanitizer, ThreadSanitizer, AddressSanitizer and MemorySanitizer support ``` $ cargo new --bin leak && cd $_ $ edit Cargo.toml && tail -n3 $_ ``` ``` toml [profile.dev] opt-level = 1 ``` ``` $ edit src/main.rs && cat $_ ``` ``` rust use std::mem; fn main() { let xs = vec![0, 1, 2, 3]; mem::forget(xs); } ``` ``` $ RUSTFLAGS="-Z sanitizer=leak" cargo run --target x86_64-unknown-linux-gnu; echo $? Finished dev [optimized + debuginfo] target(s) in 0.0 secs Running `target/debug/leak` ================================================================= ==10848==ERROR: LeakSanitizer: detected memory leaks Direct leak of 16 byte(s) in 1 object(s) allocated from: #0 0x557c3488db1f in __interceptor_malloc /shared/rust/checkouts/lsan/src/compiler-rt/lib/lsan/lsan_interceptors.cc:55 #1 0x557c34888aaa in alloc::heap::exchange_malloc::h68f3f8b376a0da42 /shared/rust/checkouts/lsan/src/liballoc/heap.rs:138 rust-lang#2 0x557c34888afc in leak::main::hc56ab767de6d653a $PWD/src/main.rs:4 rust-lang#3 0x557c348c0806 in __rust_maybe_catch_panic ($PWD/target/debug/leak+0x3d806) SUMMARY: LeakSanitizer: 16 byte(s) leaked in 1 allocation(s). 23 ``` ``` $ cargo new --bin racy && cd $_ $ edit src/main.rs && cat $_ ``` ``` rust use std::thread; static mut ANSWER: i32 = 0; fn main() { let t1 = thread::spawn(|| unsafe { ANSWER = 42 }); unsafe { ANSWER = 24; } t1.join().ok(); } ``` ``` $ RUSTFLAGS="-Z sanitizer=thread" cargo run --target x86_64-unknown-linux-gnu; echo $? ================== WARNING: ThreadSanitizer: data race (pid=12019) Write of size 4 at 0x562105989bb4 by thread T1: #0 racy::main::_$u7b$$u7b$closure$u7d$$u7d$::hbe13ea9e8ac73f7e $PWD/src/main.rs:6 (racy+0x000000010e3f) #1 _$LT$std..panic..AssertUnwindSafe$LT$F$GT$$u20$as$u20$core..ops..FnOnce$LT$$LP$$RP$$GT$$GT$::call_once::h2e466a92accacc78 /shared/rust/checkouts/lsan/src/libstd/panic.rs:296 (racy+0x000000010cc5) rust-lang#2 std::panicking::try::do_call::h7f4d2b38069e4042 /shared/rust/checkouts/lsan/src/libstd/panicking.rs:460 (racy+0x00000000c8f2) rust-lang#3 __rust_maybe_catch_panic <null> (racy+0x0000000b4e56) rust-lang#4 std::panic::catch_unwind::h31ca45621ad66d5a /shared/rust/checkouts/lsan/src/libstd/panic.rs:361 (racy+0x00000000b517) rust-lang#5 std::thread::Builder::spawn::_$u7b$$u7b$closure$u7d$$u7d$::hccfc37175dea0b01 /shared/rust/checkouts/lsan/src/libstd/thread/mod.rs:357 (racy+0x00000000c226) rust-lang#6 _$LT$F$u20$as$u20$alloc..boxed..FnBox$LT$A$GT$$GT$::call_box::hd880bbf91561e033 /shared/rust/checkouts/lsan/src/liballoc/boxed.rs:605 (racy+0x00000000f27e) rust-lang#7 std::sys::imp::thread::Thread::new::thread_start::hebdfc4b3d17afc85 <null> (racy+0x0000000abd40) Previous write of size 4 at 0x562105989bb4 by main thread: #0 racy::main::h23e6e5ca46d085c3 $PWD/src/main.rs:8 (racy+0x000000010d7c) #1 __rust_maybe_catch_panic <null> (racy+0x0000000b4e56) rust-lang#2 __libc_start_main <null> (libc.so.6+0x000000020290) Location is global 'racy::ANSWER::h543d2b139f819b19' of size 4 at 0x562105989bb4 (racy+0x0000002f8bb4) Thread T1 (tid=12028, running) created by main thread at: #0 pthread_create /shared/rust/checkouts/lsan/src/compiler-rt/lib/tsan/rtl/tsan_interceptors.cc:902 (racy+0x00000001aedb) #1 std::sys::imp::thread::Thread::new::hce44187bf4a36222 <null> (racy+0x0000000ab9ae) rust-lang#2 std::thread::spawn::he382608373eb667e /shared/rust/checkouts/lsan/src/libstd/thread/mod.rs:412 (racy+0x00000000b5aa) rust-lang#3 racy::main::h23e6e5ca46d085c3 $PWD/src/main.rs:6 (racy+0x000000010d5c) rust-lang#4 __rust_maybe_catch_panic <null> (racy+0x0000000b4e56) rust-lang#5 __libc_start_main <null> (libc.so.6+0x000000020290) SUMMARY: ThreadSanitizer: data race $PWD/src/main.rs:6 in racy::main::_$u7b$$u7b$closure$u7d$$u7d$::hbe13ea9e8ac73f7e ================== ThreadSanitizer: reported 1 warnings 66 ``` ``` $ cargo new --bin oob && cd $_ $ edit src/main.rs && cat $_ ``` ``` rust fn main() { let xs = [0, 1, 2, 3]; let y = unsafe { *xs.as_ptr().offset(4) }; } ``` ``` $ RUSTFLAGS="-Z sanitizer=address" cargo run --target x86_64-unknown-linux-gnu; echo $? ================================================================= ==13328==ERROR: AddressSanitizer: stack-buffer-overflow on address 0x7fff29f3ecd0 at pc 0x55802dc6bf7e bp 0x7fff29f3ec90 sp 0x7fff29f3ec88 READ of size 4 at 0x7fff29f3ecd0 thread T0 #0 0x55802dc6bf7d in oob::main::h0adc7b67e5feb2e7 $PWD/src/main.rs:3 #1 0x55802dd60426 in __rust_maybe_catch_panic ($PWD/target/debug/oob+0xfe426) rust-lang#2 0x55802dd58dd9 in std::rt::lang_start::hb2951fc8a59d62a7 ($PWD/target/debug/oob+0xf6dd9) rust-lang#3 0x55802dc6c002 in main ($PWD/target/debug/oob+0xa002) rust-lang#4 0x7fad8c3b3290 in __libc_start_main (/usr/lib/libc.so.6+0x20290) rust-lang#5 0x55802dc6b719 in _start ($PWD/target/debug/oob+0x9719) Address 0x7fff29f3ecd0 is located in stack of thread T0 at offset 48 in frame #0 0x55802dc6bd5f in oob::main::h0adc7b67e5feb2e7 $PWD/src/main.rs:1 This frame has 1 object(s): [32, 48) 'xs' <== Memory access at offset 48 overflows this variable HINT: this may be a false positive if your program uses some custom stack unwind mechanism or swapcontext (longjmp and C++ exceptions *are* supported) SUMMARY: AddressSanitizer: stack-buffer-overflow $PWD/src/main.rs:3 in oob::main::h0adc7b67e5feb2e7 Shadow bytes around the buggy address: 0x1000653dfd40: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x1000653dfd50: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x1000653dfd60: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x1000653dfd70: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x1000653dfd80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 =>0x1000653dfd90: 00 00 00 00 f1 f1 f1 f1 00 00[f3]f3 00 00 00 00 0x1000653dfda0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x1000653dfdb0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x1000653dfdc0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x1000653dfdd0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x1000653dfde0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 Shadow byte legend (one shadow byte represents 8 application bytes): Addressable: 00 Partially addressable: 01 02 03 04 05 06 07 Heap left redzone: fa Heap right redzone: fb Freed heap region: fd Stack left redzone: f1 Stack mid redzone: f2 Stack right redzone: f3 Stack partial redzone: f4 Stack after return: f5 Stack use after scope: f8 Global redzone: f9 Global init order: f6 Poisoned by user: f7 Container overflow: fc Array cookie: ac Intra object redzone: bb ASan internal: fe Left alloca redzone: ca Right alloca redzone: cb ==13328==ABORTING 1 ``` ``` $ cargo new --bin uninit && cd $_ $ edit src/main.rs && cat $_ ``` ``` rust use std::mem; fn main() { let xs: [u8; 4] = unsafe { mem::uninitialized() }; let y = xs[0] + xs[1]; } ``` ``` $ RUSTFLAGS="-Z sanitizer=memory" cargo run; echo $? ==30198==WARNING: MemorySanitizer: use-of-uninitialized-value #0 0x563f4b6867da in uninit::main::hc2731cd4f2ed48f8 $PWD/src/main.rs:5 #1 0x563f4b7033b6 in __rust_maybe_catch_panic ($PWD/target/debug/uninit+0x873b6) rust-lang#2 0x563f4b6fbd69 in std::rt::lang_start::hb2951fc8a59d62a7 ($PWD/target/debug/uninit+0x7fd69) rust-lang#3 0x563f4b6868a9 in main ($PWD/target/debug/uninit+0xa8a9) rust-lang#4 0x7fe844354290 in __libc_start_main (/usr/lib/libc.so.6+0x20290) rust-lang#5 0x563f4b6864f9 in _start ($PWD/target/debug/uninit+0xa4f9) SUMMARY: MemorySanitizer: use-of-uninitialized-value $PWD/src/main.rs:5 in uninit::main::hc2731cd4f2ed48f8 Exiting 77 ```
2 parents 7f7dc76 + e180dd5 commit 3053494

File tree

50 files changed

+765
-7
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+765
-7
lines changed

configure

+1
Original file line numberDiff line numberDiff line change
@@ -649,6 +649,7 @@ opt codegen-tests 1 "run the src/test/codegen tests"
649649
opt option-checking 1 "complain about unrecognized options in this configure script"
650650
opt ninja 0 "build LLVM using the Ninja generator (for MSVC, requires building in the correct environment)"
651651
opt vendor 0 "enable usage of vendored Rust crates"
652+
opt sanitizers 0 "build the sanitizer runtimes (asan, lsan, msan, tsan)"
652653

653654
# Optimization and debugging options. These may be overridden by the release channel, etc.
654655
opt_nosave optimize 1 "build optimized rust code"

src/Cargo.lock

+44
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/bootstrap/check.rs

+4
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,10 @@ pub fn compiletest(build: &Build,
242242
cmd.env("RUSTC_BOOTSTRAP", "1");
243243
build.add_rust_test_threads(&mut cmd);
244244

245+
if build.config.sanitizers {
246+
cmd.env("SANITIZER_SUPPORT", "1");
247+
}
248+
245249
cmd.arg("--adb-path").arg("adb");
246250
cmd.arg("--adb-test-dir").arg(ADB_TEST_DIR);
247251
if target.contains("android") {

src/bootstrap/compile.rs

+11
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,17 @@ pub fn std(build: &Build, target: &str, compiler: &Compiler) {
5151
if compiler.stage == 0 && build.local_rebuild && !build.config.use_jemalloc {
5252
features.push_str(" force_alloc_system");
5353
}
54+
55+
if compiler.stage != 0 && build.config.sanitizers {
56+
// This variable is used by the sanitizer runtime crates, e.g.
57+
// rustc_lsan, to build the sanitizer runtime from C code
58+
// When this variable is missing, those crates won't compile the C code,
59+
// so we don't set this variable during stage0 where llvm-config is
60+
// missing
61+
// We also only build the runtimes when --enable-sanitizers (or its
62+
// config.toml equivalent) is used
63+
cargo.env("LLVM_CONFIG", build.llvm_config(target));
64+
}
5465
cargo.arg("--features").arg(features)
5566
.arg("--manifest-path")
5667
.arg(build.src.join("src/rustc/std_shim/Cargo.toml"));

src/bootstrap/config.rs

+4
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ pub struct Config {
4848
pub target_config: HashMap<String, Target>,
4949
pub full_bootstrap: bool,
5050
pub extended: bool,
51+
pub sanitizers: bool,
5152

5253
// llvm codegen options
5354
pub llvm_assertions: bool,
@@ -149,6 +150,7 @@ struct Build {
149150
python: Option<String>,
150151
full_bootstrap: Option<bool>,
151152
extended: Option<bool>,
153+
sanitizers: Option<bool>,
152154
}
153155

154156
/// TOML representation of various global install decisions.
@@ -294,6 +296,7 @@ impl Config {
294296
set(&mut config.vendor, build.vendor);
295297
set(&mut config.full_bootstrap, build.full_bootstrap);
296298
set(&mut config.extended, build.extended);
299+
set(&mut config.sanitizers, build.sanitizers);
297300

298301
if let Some(ref install) = toml.install {
299302
config.prefix = install.prefix.clone().map(PathBuf::from);
@@ -438,6 +441,7 @@ impl Config {
438441
("VENDOR", self.vendor),
439442
("FULL_BOOTSTRAP", self.full_bootstrap),
440443
("EXTENDED", self.extended),
444+
("SANITIZERS", self.sanitizers),
441445
}
442446

443447
match key {

src/bootstrap/config.toml.example

+3
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,9 @@
124124
# disabled by default.
125125
#extended = false
126126

127+
# Build the sanitizer runtimes
128+
#sanitizers = false
129+
127130
# =============================================================================
128131
# General install configuration options
129132
# =============================================================================

src/bootstrap/lib.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -599,7 +599,8 @@ impl Build {
599599
/// Get the space-separated set of activated features for the standard
600600
/// library.
601601
fn std_features(&self) -> String {
602-
let mut features = "panic-unwind".to_string();
602+
let mut features = "panic-unwind asan lsan msan tsan".to_string();
603+
603604
if self.config.debug_jemalloc {
604605
features.push_str(" debug-jemalloc");
605606
}

src/ci/docker/dist-x86-linux/Dockerfile

+6-1
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,11 @@ RUN ./build-git.sh
6363
COPY build-cmake.sh /tmp/
6464
RUN ./build-cmake.sh
6565

66+
# for sanitizers, we need kernel headers files newer than the ones CentOS ships
67+
# with so we install newer ones here
68+
COPY build-headers.sh /tmp/
69+
RUN ./build-headers.sh
70+
6671
RUN curl -Lo /rustroot/dumb-init \
6772
https://github.com/Yelp/dumb-init/releases/download/v1.2.0/dumb-init_1.2.0_amd64 && \
6873
chmod +x /rustroot/dumb-init
@@ -76,5 +81,5 @@ RUN curl -L https://api.pub.build.mozilla.org/tooltool/sha512/$SCCACHE_DIGEST |
7681
ENV HOSTS=i686-unknown-linux-gnu
7782
ENV HOSTS=$HOSTS,x86_64-unknown-linux-gnu
7883

79-
ENV RUST_CONFIGURE_ARGS --host=$HOSTS --enable-extended
84+
ENV RUST_CONFIGURE_ARGS --host=$HOSTS --enable-extended --enable-sanitizers
8085
ENV SCRIPT python2.7 ../x.py dist --host $HOSTS --target $HOSTS
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#!/bin/bash
2+
# Copyright 2017 The Rust Project Developers. See the COPYRIGHT
3+
# file at the top-level directory of this distribution and at
4+
# http://rust-lang.org/COPYRIGHT.
5+
#
6+
# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
7+
# http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
8+
# <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
9+
# option. This file may not be copied, modified, or distributed
10+
# except according to those terms.
11+
12+
set -ex
13+
source shared.sh
14+
15+
curl https://cdn.kernel.org/pub/linux/kernel/v3.x/linux-3.2.84.tar.xz | unxz | tar x
16+
17+
cd linux-3.2.84
18+
hide_output make mrproper
19+
hide_output make INSTALL_HDR_PATH=dest headers_install
20+
21+
find dest/include \( -name .install -o -name ..install.cmd \) -delete
22+
yes | cp -fr dest/include/* /usr/include
23+
24+
cd ..
25+
rm -rf linux-3.2.84

src/ci/docker/x86_64-gnu/Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,5 @@ RUN curl -OL https://github.com/Yelp/dumb-init/releases/download/v1.2.0/dumb-ini
2222
rm dumb-init_*.deb
2323
ENTRYPOINT ["/usr/bin/dumb-init", "--"]
2424

25-
ENV RUST_CONFIGURE_ARGS --build=x86_64-unknown-linux-gnu
25+
ENV RUST_CONFIGURE_ARGS --build=x86_64-unknown-linux-gnu --enable-sanitizers
2626
ENV SCRIPT python2.7 ../x.py test && python2.7 ../x.py dist

src/librustc/middle/cstore.rs

+2
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,7 @@ pub trait CrateStore<'tcx> {
229229
fn is_allocator(&self, cnum: CrateNum) -> bool;
230230
fn is_panic_runtime(&self, cnum: CrateNum) -> bool;
231231
fn is_compiler_builtins(&self, cnum: CrateNum) -> bool;
232+
fn is_sanitizer_runtime(&self, cnum: CrateNum) -> bool;
232233
fn panic_strategy(&self, cnum: CrateNum) -> PanicStrategy;
233234
fn extern_crate(&self, cnum: CrateNum) -> Option<ExternCrate>;
234235
/// The name of the crate as it is referred to in source code of the current
@@ -390,6 +391,7 @@ impl<'tcx> CrateStore<'tcx> for DummyCrateStore {
390391
fn is_allocator(&self, cnum: CrateNum) -> bool { bug!("is_allocator") }
391392
fn is_panic_runtime(&self, cnum: CrateNum) -> bool { bug!("is_panic_runtime") }
392393
fn is_compiler_builtins(&self, cnum: CrateNum) -> bool { bug!("is_compiler_builtins") }
394+
fn is_sanitizer_runtime(&self, cnum: CrateNum) -> bool { bug!("is_sanitizer_runtime") }
393395
fn panic_strategy(&self, cnum: CrateNum) -> PanicStrategy {
394396
bug!("panic_strategy")
395397
}

src/librustc/session/config.rs

+24-1
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,14 @@ pub struct Config {
5151
pub uint_type: UintTy,
5252
}
5353

54+
#[derive(Clone)]
55+
pub enum Sanitizer {
56+
Address,
57+
Leak,
58+
Memory,
59+
Thread,
60+
}
61+
5462
#[derive(Clone, Copy, PartialEq, Hash)]
5563
pub enum OptLevel {
5664
No, // -O0
@@ -626,11 +634,13 @@ macro_rules! options {
626634
Some("a number");
627635
pub const parse_panic_strategy: Option<&'static str> =
628636
Some("either `panic` or `abort`");
637+
pub const parse_sanitizer: Option<&'static str> =
638+
Some("one of: `address`, `leak`, `memory` or `thread`");
629639
}
630640

631641
#[allow(dead_code)]
632642
mod $mod_set {
633-
use super::{$struct_name, Passes, SomePasses, AllPasses};
643+
use super::{$struct_name, Passes, SomePasses, AllPasses, Sanitizer};
634644
use rustc_back::PanicStrategy;
635645

636646
$(
@@ -751,6 +761,17 @@ macro_rules! options {
751761
}
752762
true
753763
}
764+
765+
fn parse_sanitizer(slote: &mut Option<Sanitizer>, v: Option<&str>) -> bool {
766+
match v {
767+
Some("address") => *slote = Some(Sanitizer::Address),
768+
Some("leak") => *slote = Some(Sanitizer::Leak),
769+
Some("memory") => *slote = Some(Sanitizer::Memory),
770+
Some("thread") => *slote = Some(Sanitizer::Thread),
771+
_ => return false,
772+
}
773+
true
774+
}
754775
}
755776
) }
756777

@@ -949,6 +970,8 @@ options! {DebuggingOptions, DebuggingSetter, basic_debugging_options,
949970
"encode MIR of all functions into the crate metadata"),
950971
osx_rpath_install_name: bool = (false, parse_bool, [TRACKED],
951972
"pass `-install_name @rpath/...` to the OSX linker"),
973+
sanitizer: Option<Sanitizer> = (None, parse_sanitizer, [UNTRACKED],
974+
"Use a sanitizer"),
952975
}
953976

954977
pub fn default_lib_output() -> CrateType {

src/librustc_asan/Cargo.toml

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
[package]
2+
authors = ["The Rust Project Developers"]
3+
build = "build.rs"
4+
name = "rustc_asan"
5+
version = "0.0.0"
6+
7+
[lib]
8+
name = "rustc_asan"
9+
path = "lib.rs"
10+
11+
[build-dependencies]
12+
build_helper = { path = "../build_helper" }
13+
cmake = "0.1.18"
14+
15+
[dependencies]
16+
alloc_system = { path = "../liballoc_system" }
17+
core = { path = "../libcore" }

src/librustc_asan/build.rs

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
extern crate build_helper;
12+
extern crate cmake;
13+
14+
use std::path::PathBuf;
15+
use std::env;
16+
17+
use cmake::Config;
18+
19+
fn main() {
20+
if let Some(llvm_config) = env::var_os("LLVM_CONFIG") {
21+
let dst = Config::new("../compiler-rt")
22+
.define("COMPILER_RT_BUILD_SANITIZERS", "ON")
23+
.define("COMPILER_RT_BUILD_BUILTINS", "OFF")
24+
.define("COMPILER_RT_BUILD_XRAY", "OFF")
25+
.define("LLVM_CONFIG_PATH", llvm_config)
26+
.build_target("asan")
27+
.build();
28+
29+
println!("cargo:rustc-link-search=native={}",
30+
dst.join("build/lib/linux").display());
31+
println!("cargo:rustc-link-lib=static=clang_rt.asan-x86_64");
32+
33+
build_helper::rerun_if_changed_anything_in_dir(&PathBuf::from(env::var("CARGO_MANIFEST_DIR")
34+
.unwrap())
35+
.join("../compiler-rt"));
36+
}
37+
38+
println!("cargo:rerun-if-changed=build.rs");
39+
}

src/librustc_asan/lib.rs

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
#![cfg_attr(not(stage0), feature(sanitizer_runtime))]
12+
#![cfg_attr(not(stage0), sanitizer_runtime)]
13+
#![feature(alloc_system)]
14+
#![feature(staged_api)]
15+
#![no_std]
16+
#![unstable(feature = "sanitizer_runtime_lib",
17+
reason = "internal implementation detail of sanitizers",
18+
issue = "0")]
19+
20+
extern crate alloc_system;

src/librustc_llvm/ffi.rs

+3
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,9 @@ pub enum Attribute {
126126
UWTable = 17,
127127
ZExt = 18,
128128
InReg = 19,
129+
SanitizeThread = 20,
130+
SanitizeAddress = 21,
131+
SanitizeMemory = 22,
129132
}
130133

131134
/// LLVMIntPredicate

0 commit comments

Comments
 (0)