aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEvgeny Vereshchagin <evvers@ya.ru>2021-03-31 16:53:03 +0300
committerGitHub <noreply@github.com>2021-03-31 06:53:03 -0700
commit19ec1ffbe50fd3745973471e82b349073a867205 (patch)
tree9b368aeca2e0dc8990d1406ed55dafed94d507e9
parentd9d81a1011d5f0a1fb7943026a2342a353ae86b1 (diff)
downloadoss-fuzz-19ec1ffbe50fd3745973471e82b349073a867205.tar.gz
[lxc] move the build script and fuzz target upstream (#5514)
Now that https://github.com/lxc/lxc/pull/3733 is merged, it should be safe to point OSS-Fuzz to the lxc repository.
-rw-r--r--projects/lxc/Dockerfile2
-rwxr-xr-xprojects/lxc/build.sh28
-rw-r--r--projects/lxc/fuzz-lxc-config-read.c41
3 files changed, 2 insertions, 69 deletions
diff --git a/projects/lxc/Dockerfile b/projects/lxc/Dockerfile
index 3d581d4cd..375c22485 100644
--- a/projects/lxc/Dockerfile
+++ b/projects/lxc/Dockerfile
@@ -19,4 +19,4 @@ RUN apt-get update && \
apt-get install -y pkgconf make libtool automake autoconf
RUN git clone --depth 1 https://github.com/lxc/lxc
WORKDIR lxc
-COPY build.sh *.c $SRC/
+COPY build.sh $SRC/
diff --git a/projects/lxc/build.sh b/projects/lxc/build.sh
index 9f41c6cfe..1f18a7ec0 100755
--- a/projects/lxc/build.sh
+++ b/projects/lxc/build.sh
@@ -14,30 +14,4 @@
# limitations under the License.
#
################################################################################
-
-# -fsanitize=... isn't compatible with -Wl,-no-undefined
-# https://github.com/google/sanitizers/issues/380
-sed -i 's/-Wl,-no-undefined *\\/\\/' src/lxc/Makefile.am
-
-# AFL++ and hoggfuzz are both incompatible with lto=thin apparently
-sed -i '/-flto=thin/d' configure.ac
-
-# turn off the libutil dependency
-sed -i 's/^AC_CHECK_LIB(util/#/' configure.ac
-
-./autogen.sh
-./configure \
- --disable-tools \
- --disable-commands \
- --disable-apparmor \
- --disable-openssl \
- --disable-selinux \
- --disable-seccomp \
- --disable-capabilities
-
-make -j$(nproc)
-
-$CC -c -o fuzz-lxc-config-read.o $CFLAGS -Isrc -Isrc/lxc $SRC/fuzz-lxc-config-read.c
-$CXX $CXXFLAGS $LIB_FUZZING_ENGINE fuzz-lxc-config-read.o src/lxc/.libs/liblxc.a -o $OUT/fuzz-lxc-config-read
-
-zip -r $OUT/fuzz-lxc-config-read_seed_corpus.zip doc/examples
+src/tests/oss-fuzz.sh
diff --git a/projects/lxc/fuzz-lxc-config-read.c b/projects/lxc/fuzz-lxc-config-read.c
deleted file mode 100644
index 27d1e5528..000000000
--- a/projects/lxc/fuzz-lxc-config-read.c
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
-# Copyright 2021 Google LLC
-#
-# 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.
-#
-################################################################################
-*/
-
-#include <stddef.h>
-#include <stdint.h>
-
-#include "conf.h"
-#include "confile.h"
-#include "utils.h"
-
-int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
- int fd = -1;
- char tmpf[] = "fuzz-lxc-config-read-XXXXXX";
- struct lxc_conf *conf = NULL;
-
- fd = lxc_make_tmpfile(tmpf, false);
- lxc_write_nointr(fd, data, size);
- close(fd);
-
- conf = lxc_conf_init();
- lxc_config_read(tmpf, conf, false);
- lxc_conf_free(conf);
-
- (void) unlink(tmpf);
- return 0;
-}