diff options
author | Yang Gao <yangg@google.com> | 2019-09-05 21:31:52 -0700 |
---|---|---|
committer | Abhishek Arya <inferno@chromium.org> | 2019-09-05 21:31:52 -0700 |
commit | 7f8013db108e62727fba1c3cbcccac07d543682b (patch) | |
tree | c4aafd2d2baf9155fab940f686706f87cbff9a55 /projects/grpc | |
parent | 1144fe75e2d6c88f8aa5b29483a46a7ad661960b (diff) | |
download | oss-fuzz-7f8013db108e62727fba1c3cbcccac07d543682b.tar.gz |
gRPC improvements (#2807)
Diffstat (limited to 'projects/grpc')
-rw-r--r-- | projects/grpc/Dockerfile | 6 | ||||
-rwxr-xr-x | projects/grpc/build.sh | 29 |
2 files changed, 28 insertions, 7 deletions
diff --git a/projects/grpc/Dockerfile b/projects/grpc/Dockerfile index a66bbed70..aeac4c199 100644 --- a/projects/grpc/Dockerfile +++ b/projects/grpc/Dockerfile @@ -43,12 +43,6 @@ RUN pip install futures==2.2.0 enum34==1.0.4 protobuf==3.5.2.post1 six==1.10.0 t #======================== # Bazel installation -ENV DISABLE_BAZEL_WRAPPER 1 - -RUN apt-get update && apt-get install -y wget && apt-get clean -RUN wget -q https://github.com/bazelbuild/bazel/releases/download/0.26.0/bazel-0.26.0-linux-x86_64 -O /usr/local/bin/bazel -RUN chmod 755 /usr/local/bin/bazel - RUN git clone --recursive https://github.com/grpc/grpc grpc WORKDIR $SRC/grpc/ COPY build.sh $SRC/ diff --git a/projects/grpc/build.sh b/projects/grpc/build.sh index 1909c0667..4fd9c6d09 100755 --- a/projects/grpc/build.sh +++ b/projects/grpc/build.sh @@ -59,6 +59,7 @@ test/core/end2end/fuzzers:api_fuzzer \ test/core/end2end/fuzzers:client_fuzzer \ test/core/end2end/fuzzers:server_fuzzer \ test/core/security:ssl_server_fuzzer \ +test/core/security:alts_credentials_fuzzer \ " # build grpc @@ -88,12 +89,37 @@ then fi )" -bazel build --dynamic_mode=off --spawn_strategy=standalone --genrule_strategy=standalone \ +tools/bazel build --dynamic_mode=off --spawn_strategy=standalone --genrule_strategy=standalone \ $NO_VPTR \ --strip=never \ --linkopt=-lc++ --linkopt=-pthread ${EXTRA_BAZEL_FLAGS} \ $FUZZER_TARGETS --verbose_failures +# Profiling with coverage requires that we resolve+copy all Bazel symlinks and +# also remap everything under proc/self/cwd to correspond to Bazel build paths. +if [ "$SANITIZER" = "coverage" ] +then + # The build invoker looks for sources in $SRC, but it turns out that we need + # to not be buried under src/, paths are expected at out/proc/self/cwd by + # the profiler. + declare -r REMAP_PATH="${OUT}/proc/self/cwd" + mkdir -p "${REMAP_PATH}" + rsync -av "${SRC}"/grpc/src "${REMAP_PATH}" + rsync -av "${SRC}"/grpc/test "${REMAP_PATH}" + # Remove filesystem loop manually. + rm -rf "${SRC}"/grpc/bazel-grpc/external/grpc + # Clean up symlinks with a missing referrant. + find "${SRC}"/grpc/bazel-grpc/external -follow -type l -ls -delete || echo "Symlink cleanup soft fail" + rsync -avLk "${SRC}"/grpc/bazel-grpc/external "${REMAP_PATH}" + # For .h, and some generated artifacts, we need bazel-out/. Need to heavily + # filter out the build objects from bazel-out/. Also need to resolve symlinks, + # since they don't make sense outside the build container. + declare -r RSYNC_FILTER_ARGS=("--include" "*.h" "--include" "*.cc" "--include" \ + "*.hpp" "--include" "*.cpp" "--include" "*.c" "--include" "*/" "--exclude" "*") + rsync -avLk "${RSYNC_FILTER_ARGS[@]}" "${SRC}"/grpc/bazel-out "${REMAP_PATH}" + rsync -avLkR "${RSYNC_FILTER_ARGS[@]}" "${HOME}" "${OUT}" + rsync -avLkR "${RSYNC_FILTER_ARGS[@]}" /tmp "${OUT}" +fi for target in $FUZZER_TARGETS; do # replace : with / @@ -124,3 +150,4 @@ zip $OUT/api_fuzzer_seed_corpus.zip test/core/end2end/fuzzers/api_fuzzer_corpus/ zip $OUT/client_fuzzer_seed_corpus.zip test/core/end2end/fuzzers/client_fuzzer_corpus/* zip $OUT/server_fuzzer_seed_corpus.zip test/core/end2end/fuzzers/server_fuzzer_corpus/* zip $OUT/ssl_server_fuzzer_seed_corpus.zip test/core/security/corpus/ssl_server_corpus/* +zip $OUT/alts_credentials_fuzzer_seed_corpus.zip test/core/security/corpus/alts_credentials_corpus/* |