Skip to content

Commit 5b5aa11

Browse files
committed
patch 8.2.1579: reports from asan are not optimal
Problem: Reports from asan are not optimal. Solution: Use clang with ubsan. (James McCoy, closes #6811)
1 parent 62f93f4 commit 5b5aa11

2 files changed

Lines changed: 28 additions & 8 deletions

File tree

.travis.yml

Lines changed: 26 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ language: c
22

33
env:
44
global:
5-
- BUILD=yes TEST=test CONFOPT= LEAK_CFLAGS="-DEXITFREE" SHADOWOPT= SRCDIR=./src CHECK_AUTOCONF=no
5+
- BUILD=yes TEST=test CONFOPT= LEAK_CFLAGS="-DEXITFREE" SHADOWOPT= SRCDIR=./src CHECK_AUTOCONF=no LOG_DIR="$TRAVIS_BUILD_DIR/logs"
66

77
_anchors:
88
envs:
@@ -25,8 +25,8 @@ _anchors:
2525
- &coverage
2626
CFLAGS="--coverage -DUSE_GCOV_FLUSH" LDFLAGS=--coverage
2727
- &asan # ASAN build
28-
SANITIZER_CFLAGS="-g -O1 -DABORT_ON_INTERNAL_ERROR -DEXITFREE -fsanitize=address -fno-omit-frame-pointer"
29-
ASAN_OPTIONS="print_stacktrace=1 log_path=asan" LSAN_OPTIONS="suppressions=$TRAVIS_BUILD_DIR/src/testdir/lsan-suppress.txt"
28+
SANITIZER_CFLAGS="-g -O1 -DABORT_ON_INTERNAL_ERROR -DEXITFREE -fsanitize-recover=all -fsanitize=address -fsanitize=undefined -fno-omit-frame-pointer"
29+
ASAN_OPTIONS="print_stacktrace=1 log_path=$LOG_DIR/asan" UBSAN_OPTIONS="print_stacktrace=1 log_path=$LOG_DIR/ubsan" LSAN_OPTIONS="suppressions=$TRAVIS_BUILD_DIR/src/testdir/lsan-suppress.txt"
3030
- &shadowopt
3131
SHADOWOPT="-C src/shadow" SRCDIR=./src/shadow
3232

@@ -35,7 +35,7 @@ _anchors:
3535
dist: bionic
3636
addons:
3737
apt:
38-
packages:
38+
packages: &apt-packages
3939
- autoconf
4040
- clang
4141
- lcov
@@ -108,13 +108,14 @@ _anchors:
108108
# Update pyenv to fix the error "/opt/pyenv/libexec/pyenv: line 43: cd: asan_symbolize-6.0: Not a directory".
109109
# https://github.com/pyenv/pyenv/issues/580
110110
- (cd "${PYENV_ROOT}" && git fetch -p origin && git checkout "$(git rev-list --tags -n1)") &>/dev/null || true
111-
- find . -type f -name 'asan.*' -size +0 2>/dev/null | xargs grep -l '^==[[:digit:]]*==ERROR:' | xargs -I{} -n1 -t asan_symbolize -l{}
111+
- for f in $(grep -l '#[[:digit:]]* *0x[[:digit:]a-fA-F]*' "$LOG_DIR"/*); do asan_symbolize-11 -l "$f"; done
112112

113113
branches:
114114
except:
115115
- /^v[0-9]/
116116

117117
script:
118+
- mkdir -p "$LOG_DIR"
118119
- NPROC=$(getconf _NPROCESSORS_ONLN)
119120
- set -o errexit
120121
- echo -e "\\033[33;1mConfiguring Vim\\033[0m" && echo -en "travis_fold:start:configure\\r\\033[0K"
@@ -135,7 +136,7 @@ script:
135136
# Append various warning flags to CFLAGS.
136137
# BSD sed needs backup extension specified.
137138
sed -i.bak -f ci/config.mk.sed ${SRCDIR}/auto/config.mk
138-
if [[ "${TRAVIS_OS_NAME}" = "osx" ]]; then
139+
if [[ "${TRAVIS_OS_NAME}" = "osx" ]] || [[ "${CC}" = "clang-11" ]]; then
139140
# On macOS, the entity of gcc is clang.
140141
sed -i.bak -f ci/config.mk.clang.sed ${SRCDIR}/auto/config.mk
141142
else
@@ -155,6 +156,15 @@ script:
155156
- echo -e "\\033[33;1mTesting Vim\\033[0m" && echo -en "travis_fold:start:test\\r\\033[0K"
156157
- do_test make ${SHADOWOPT} ${TEST} && FOLD_MARKER=travis_fold
157158
- echo -en "${FOLD_MARKER}:end:test\\r\\033[0K"
159+
- |
160+
# Not all sanitizers will cause the tests to fail. This helps since we can
161+
# see all the failures instead of just the first one, but we still want the
162+
# test phase to fail if any sanitizer issues are detected.
163+
if [[ -n "${ASAN_OPTIONS}" ]]; then
164+
if grep -q '#[[:digit:]]* *0x[[:digit:]a-fA-F]*' "$LOG_DIR"/*; then
165+
false
166+
fi
167+
fi
158168
159169
# Instead of using all environments with both compilers on both systems,
160170
# exclude some builds on mac os x and linux.
@@ -241,8 +251,16 @@ jobs:
241251
- *coverage
242252
after_success: *eval-coverage
243253
- <<: *linux # ASAN
244-
name: huge+asan/gcc
245-
compiler: gcc
254+
name: huge+asan/clang
255+
compiler: clang-11
256+
addons:
257+
apt:
258+
sources:
259+
- sourceline: 'deb http://apt.llvm.org/bionic/ llvm-toolchain-bionic-11 main'
260+
key_url: 'https://apt.llvm.org/llvm-snapshot.gpg.key'
261+
packages:
262+
- *apt-packages
263+
- clang-11
246264
env:
247265
- *linux-huge
248266
- *asan

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -754,6 +754,8 @@ static char *(features[]) =
754754

755755
static int included_patches[] =
756756
{ /* Add new patch number below this line */
757+
/**/
758+
1579,
757759
/**/
758760
1578,
759761
/**/

0 commit comments

Comments
 (0)