File tree 4 files changed +31
-14
lines changed
4 files changed +31
-14
lines changed Original file line number Diff line number Diff line change 1
1
language : shell
2
2
sudo : required
3
3
dist : trusty
4
- # FIXME(#44398) shouldn't need to be here
5
- group : deprecated-2017Q3
6
4
services :
7
5
- docker
8
6
Original file line number Diff line number Diff line change 1
1
-include ../tools.mk
2
2
3
+ LOG := $(TMPDIR ) /log.txt
4
+
3
5
# NOTE the address sanitizer only supports x86_64 linux and macOS
4
6
5
7
ifeq ($(TARGET ) ,x86_64-apple-darwin)
@@ -8,12 +10,21 @@ EXTRA_RUSTFLAG=-C rpath
8
10
else
9
11
ifeq ($(TARGET ) ,x86_64-unknown-linux-gnu)
10
12
ASAN_SUPPORT =$(SANITIZER_SUPPORT )
11
- EXTRA_RUSTFLAG =
13
+
14
+ # Apparently there are very specific Linux kernels, notably the one that's
15
+ # currently on Travis CI, which contain a buggy commit that triggers failures in
16
+ # the ASan implementation, detailed at google/sanitizers#837. As noted in
17
+ # google/sanitizers#856 the "fix" is to avoid using PIE binaries, so we pass a
18
+ # different relocation model to avoid generating a PIE binary. Once Travis is no
19
+ # longer running kernel 4.4.0-93 we can remove this and pass an empty set of
20
+ # flags again.
21
+ EXTRA_RUSTFLAG =-C relocation-model=dynamic-no-pic
12
22
endif
13
23
endif
14
24
15
25
all :
16
26
ifeq ($(ASAN_SUPPORT ) ,1)
17
27
$(RUSTC) -g -Z sanitizer=address -Z print-link-args $(EXTRA_RUSTFLAG) overflow.rs | grep -q librustc_asan
18
- $(TMPDIR)/overflow 2>&1 | grep -q stack-buffer-overflow
28
+ $(TMPDIR)/overflow 2>&1 | tee $(LOG)
29
+ grep -q stack-buffer-overflow $(LOG)
19
30
endif
Original file line number Diff line number Diff line change 1
1
-include ../tools.mk
2
2
3
+ LOG := $(TMPDIR ) /log.txt
4
+
3
5
# This test builds a shared object, then an executable that links it as a native
4
6
# rust library (constrast to an rlib). The shared library and executable both
5
7
# are compiled with address sanitizer, and we assert that a fault in the cdylib
6
8
# is correctly detected.
7
9
8
10
ifeq ($(TARGET ) ,x86_64-unknown-linux-gnu)
9
11
ASAN_SUPPORT =$(SANITIZER_SUPPORT )
10
- EXTRA_RUSTFLAG =
12
+
13
+ # See comment in sanitizer-address/Makefile for why this is here
14
+ EXTRA_RUSTFLAG =-C relocation-model=dynamic-no-pic
11
15
endif
12
16
13
17
all :
14
18
ifeq ($(ASAN_SUPPORT ) ,1)
15
- $(RUSTC) -g -Z sanitizer=address --crate-type cdylib --target $(TARGET) library.rs
16
- $(RUSTC) -g -Z sanitizer=address --crate-type bin --target $(TARGET) -llibrary program.rs
17
- LD_LIBRARY_PATH=$(TMPDIR) $(TMPDIR)/program 2>&1 | grep -q stack-buffer-overflow
19
+ $(RUSTC) -g -Z sanitizer=address --crate-type cdylib --target $(TARGET) $(EXTRA_RUSTFLAG) library.rs
20
+ $(RUSTC) -g -Z sanitizer=address --crate-type bin --target $(TARGET) $(EXTRA_RUSTFLAG) -llibrary program.rs
21
+ LD_LIBRARY_PATH=$(TMPDIR) $(TMPDIR)/program 2>&1 | tee $(LOG)
22
+ grep -q stack-buffer-overflow $(LOG)
18
23
endif
19
-
Original file line number Diff line number Diff line change 1
1
-include ../tools.mk
2
2
3
+ LOG := $(TMPDIR ) /log.txt
4
+
3
5
# This test builds a shared object, then an executable that links it as a native
4
6
# rust library (constrast to an rlib). The shared library and executable both
5
7
# are compiled with address sanitizer, and we assert that a fault in the dylib
6
8
# is correctly detected.
7
9
8
10
ifeq ($(TARGET ) ,x86_64-unknown-linux-gnu)
9
11
ASAN_SUPPORT =$(SANITIZER_SUPPORT )
10
- EXTRA_RUSTFLAG =
12
+
13
+ # See comment in sanitizer-address/Makefile for why this is here
14
+ EXTRA_RUSTFLAG =-C relocation-model=dynamic-no-pic
11
15
endif
12
16
13
17
all :
14
18
ifeq ($(ASAN_SUPPORT ) ,1)
15
- $(RUSTC) -g -Z sanitizer=address --crate-type dylib --target $(TARGET) library.rs
16
- $(RUSTC) -g -Z sanitizer=address --crate-type bin --target $(TARGET) -llibrary program.rs
17
- LD_LIBRARY_PATH=$(TMPDIR) $(TMPDIR)/program 2>&1 | grep -q stack-buffer-overflow
19
+ $(RUSTC) -g -Z sanitizer=address --crate-type dylib --target $(TARGET) $(EXTRA_RUSTFLAG) library.rs
20
+ $(RUSTC) -g -Z sanitizer=address --crate-type bin --target $(TARGET) $(EXTRA_RUSTFLAG) -llibrary program.rs
21
+ LD_LIBRARY_PATH=$(TMPDIR) $(TMPDIR)/program 2>&1 | tee $(LOG)
22
+ grep -q stack-buffer-overflow $(LOG)
18
23
endif
19
-
You can’t perform that action at this time.
0 commit comments