From 6427b3d52f2253dc0df77fbb8ae33d12e93df26e Mon Sep 17 00:00:00 2001 From: AdamKorcz Date: Wed, 28 Oct 2020 17:31:58 +0000 Subject: [PATCH 1/6] [teleport] Initial integration --- projects/teleport/Dockerfile | 19 +++++++++++++++++++ projects/teleport/build.sh | 31 +++++++++++++++++++++++++++++++ projects/teleport/project.yaml | 9 +++++++++ 3 files changed, 59 insertions(+) create mode 100644 projects/teleport/Dockerfile create mode 100644 projects/teleport/build.sh create mode 100644 projects/teleport/project.yaml diff --git a/projects/teleport/Dockerfile b/projects/teleport/Dockerfile new file mode 100644 index 000000000000..bd065812983e --- /dev/null +++ b/projects/teleport/Dockerfile @@ -0,0 +1,19 @@ +# Copyright 2020 Google Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +################################################################################ + +FROM gcr.io/oss-fuzz-base/base-builder +COPY build.sh $SRC/ +WORKDIR $SRC/ diff --git a/projects/teleport/build.sh b/projects/teleport/build.sh new file mode 100644 index 000000000000..137d79e52c1e --- /dev/null +++ b/projects/teleport/build.sh @@ -0,0 +1,31 @@ +#/bin/bash -eu +# Copyright 2020 Google Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +################################################################################ +function compile_fuzzer { + path=$1 + function=$2 + fuzzer=$3 + + go-fuzz -func $function -o $fuzzer.a $path + + $CXX $CXXFLAGS $LIB_FUZZING_ENGINE $fuzzer.a -o $OUT/$fuzzer +} +mkdir -p $GOPATH/src/github.com/gravitational +cd $GOPATH/src/github.com/gravitational +git clone https://github.com/gravitational/teleport.git + +compile_fuzzer github.com/gravitational/teleport/lib/fuzz FuzzParseProxyJump utils_fuzz +compile_fuzzer github.com/gravitational/teleport/lib/fuzz FuzzNewExpression parse_fuzz diff --git a/projects/teleport/project.yaml b/projects/teleport/project.yaml new file mode 100644 index 000000000000..ac85d90b244f --- /dev/null +++ b/projects/teleport/project.yaml @@ -0,0 +1,9 @@ +homepage: "https://github.com/gravitational/teleport" +primary_contact: "andrew@awly.dev" +auto_ccs : + - "adam@adalogics.com" +language: go +fuzzing_engines: + - libfuzzer +sanitizers: + - address From 8bd5cc5401ec53fd08214ca01d3120e0d9f6fe18 Mon Sep 17 00:00:00 2001 From: AdamKorcz Date: Wed, 11 Nov 2020 21:28:52 +0000 Subject: [PATCH 2/6] Minor update to run tests again --- projects/teleport/build.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/teleport/build.sh b/projects/teleport/build.sh index 137d79e52c1e..68f3595d74f9 100644 --- a/projects/teleport/build.sh +++ b/projects/teleport/build.sh @@ -23,6 +23,7 @@ function compile_fuzzer { $CXX $CXXFLAGS $LIB_FUZZING_ENGINE $fuzzer.a -o $OUT/$fuzzer } + mkdir -p $GOPATH/src/github.com/gravitational cd $GOPATH/src/github.com/gravitational git clone https://github.com/gravitational/teleport.git From 6837d1525e5ab164ff13ae3502d70abf41eb0c13 Mon Sep 17 00:00:00 2001 From: AdamKorcz Date: Sat, 12 Dec 2020 11:54:12 +0000 Subject: [PATCH 3/6] [jerryscript] Initial integration --- projects/jerryscript/Dockerfile | 25 +++++++++++++++++++++++++ projects/jerryscript/build.sh | 24 ++++++++++++++++++++++++ projects/jerryscript/project.yaml | 10 ++++++++++ 3 files changed, 59 insertions(+) create mode 100644 projects/jerryscript/Dockerfile create mode 100644 projects/jerryscript/build.sh create mode 100644 projects/jerryscript/project.yaml diff --git a/projects/jerryscript/Dockerfile b/projects/jerryscript/Dockerfile new file mode 100644 index 000000000000..6e909f2f41fc --- /dev/null +++ b/projects/jerryscript/Dockerfile @@ -0,0 +1,25 @@ +# Copyright 2020 Google Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +################################################################################ + +FROM gcr.io/oss-fuzz-base/base-builder +RUN add-apt-repository ppa:deadsnakes/ppa + +RUN apt-get update && apt-get install -y make \ + cmake python-all-dev python3-all-dev python-pip + +RUN git clone --depth 1 https://github.com/jerryscript-project/jerryscript +WORKDIR jerryscript +COPY build.sh $SRC/ diff --git a/projects/jerryscript/build.sh b/projects/jerryscript/build.sh new file mode 100644 index 000000000000..63ac7d7d9905 --- /dev/null +++ b/projects/jerryscript/build.sh @@ -0,0 +1,24 @@ +#!/bin/bash -eu +# Copyright 2020 Google Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +################################################################################ + +python tools/build.py \ + --linker-flag '${LIB_FUZZING_ENGINE} ${CC} ${CFLAGS}' \ + --compile-flag '${CC} ${CFLAGS}' \ + --lto 'OFF' \ + --libfuzzer 'ON' + +mv ./build/bin/jerry-libfuzzer $OUT/ diff --git a/projects/jerryscript/project.yaml b/projects/jerryscript/project.yaml new file mode 100644 index 000000000000..f07406ad559a --- /dev/null +++ b/projects/jerryscript/project.yaml @@ -0,0 +1,10 @@ +homepage: "https://github.com/jerryscript-project/jerryscript" +language: c +primary_contact: "" +auto_ccs: + - "Adam@adalogics.com" +sanitizers: + - address + - undefined + - memory +main_repo: "https://github.com/jerryscript-project/jerryscript" From 3f5e0c1c6a9ae3d75624e8703e9ac39c15ac7e60 Mon Sep 17 00:00:00 2001 From: AdamKorcz Date: Sat, 12 Dec 2020 11:56:53 +0000 Subject: [PATCH 4/6] Minor fix --- projects/teleport/build.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/teleport/build.sh b/projects/teleport/build.sh index 7188f6f494b9..90d9e8c53f09 100644 --- a/projects/teleport/build.sh +++ b/projects/teleport/build.sh @@ -15,6 +15,7 @@ # ################################################################################ + mkdir -p $GOPATH/src/github.com/gravitational cd $GOPATH/src/github.com/gravitational git clone https://github.com/gravitational/teleport.git From 94b0ba5ad3b41802e575853dbd3a7377db6e5afc Mon Sep 17 00:00:00 2001 From: AdamKorcz Date: Wed, 30 Dec 2020 11:11:02 +0000 Subject: [PATCH 5/6] Updated build script --- projects/jerryscript/build.sh | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/projects/jerryscript/build.sh b/projects/jerryscript/build.sh index 63ac7d7d9905..92efd0745879 100644 --- a/projects/jerryscript/build.sh +++ b/projects/jerryscript/build.sh @@ -15,10 +15,26 @@ # ################################################################################ +# Build Jerryscript python tools/build.py \ - --linker-flag '${LIB_FUZZING_ENGINE} ${CC} ${CFLAGS}' \ - --compile-flag '${CC} ${CFLAGS}' \ - --lto 'OFF' \ - --libfuzzer 'ON' + --linker-flag '${CC} ${CFLAGS}' \ + --compile-flag '${CC} ${CFLAGS}' \ + --lto 'OFF' \ + --libfuzzer 'OFF' +cd $SRC/jerryscript -mv ./build/bin/jerry-libfuzzer $OUT/ +# Build fuzzer +$CC $CFLAGS \ + -I/src/jerryscript/jerry-core/include \ + -I/src/jerryscript/jerry-libm/include \ + -I/src/jerryscript/jerry-port/default/include \ + -c ./jerry-main/libfuzzer.c \ + -o libfuzzer.o + + +$CC $CFLAGS $LIB_FUZZING_ENGINE \ + libfuzzer.o -o $OUT/jerry_fuzzer \ + ./build/lib/libjerry-core.a \ + ./build/lib/libjerry-port-default.a \ + ./build/lib/libjerry-core.a \ + ./build/lib/libjerry-libm.a From 74978eb9ece4b4eb144a2dd40da943a4e6f52450 Mon Sep 17 00:00:00 2001 From: AdamKorcz Date: Wed, 30 Dec 2020 11:25:51 +0000 Subject: [PATCH 6/6] Updated build script --- projects/jerryscript/build.sh | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/projects/jerryscript/build.sh b/projects/jerryscript/build.sh index 92efd0745879..b882886d0f4f 100644 --- a/projects/jerryscript/build.sh +++ b/projects/jerryscript/build.sh @@ -17,14 +17,16 @@ # Build Jerryscript python tools/build.py \ - --linker-flag '${CC} ${CFLAGS}' \ - --compile-flag '${CC} ${CFLAGS}' \ + --linker-flag '${CXX} ${CXXFLAGS}' \ + --compile-flag '${CXX} ${CXXFLAGS}' \ --lto 'OFF' \ --libfuzzer 'OFF' cd $SRC/jerryscript + # Build fuzzer -$CC $CFLAGS \ +sed 's/int LLVMFuzzerTestOneInput/extern "C" int LLVMFuzzerTestOneInput/g' -i jerry-main/libfuzzer.c +$CXX $CXXFLAGS \ -I/src/jerryscript/jerry-core/include \ -I/src/jerryscript/jerry-libm/include \ -I/src/jerryscript/jerry-port/default/include \ @@ -32,7 +34,7 @@ $CC $CFLAGS \ -o libfuzzer.o -$CC $CFLAGS $LIB_FUZZING_ENGINE \ +$CXX $CXXFLAGS $LIB_FUZZING_ENGINE \ libfuzzer.o -o $OUT/jerry_fuzzer \ ./build/lib/libjerry-core.a \ ./build/lib/libjerry-port-default.a \