[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.
This commit is contained in:
Evgeny Vereshchagin 2021-03-31 16:53:03 +03:00 committed by GitHub
parent d9d81a1011
commit 19ec1ffbe5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 2 additions and 69 deletions

View File

@ -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/

View File

@ -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

View File

@ -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;
}