Commit a390325f by Evgeny Vereshchagin

oss-fuzz: always turn off logging on OSS-Fuzz

Apparently /proc/self/cmd can't be used (reliably) on OSS-Fuzz to figure out whether the code is run inside the fuzz targets, which causes the fuzz targets to fill the filesystem with log files. Related: https://github.com/google/oss-fuzz/issues/5509 Should address https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=33835Signed-off-by: 's avatarEvgeny Vereshchagin <evvers@ya.ru>
parent 122413ad
......@@ -488,7 +488,11 @@ if test "x$enable_fuzzers" = "xyes"; then
if test "x$LIB_FUZZING_ENGINE" = x; then
CC_CHECK_FLAGS_APPEND([AM_CFLAGS],[CFLAGS],[ \
-DFUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION \
-DRUN_ON_OSS_FUZZ=0 \
-fsanitize=fuzzer-no-link])
else
CC_CHECK_FLAGS_APPEND([AM_CFLAGS],[CFLAGS],[ \
-DRUN_ON_OSS_FUZZ=1])
fi
else
CC_CHECK_FLAGS_APPEND([AM_CFLAGS],[CFLAGS],[-flto=thin])
......
......@@ -508,7 +508,7 @@ static int build_dir(const char *name)
#ifndef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
ret = lxc_unpriv(mkdir(n, 0755));
#else
if (is_in_comm("fuzz-lxc-") > 0)
if (RUN_ON_OSS_FUZZ || is_in_comm("fuzz-lxc-") > 0)
ret = errno = EEXIST;
else
ret = lxc_unpriv(mkdir(n, 0755));
......@@ -529,7 +529,7 @@ static int log_open(const char *name)
#ifndef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
fd = lxc_unpriv(open(name, O_CREAT | O_WRONLY | O_APPEND | O_CLOEXEC, 0660));
#else
if (is_in_comm("fuzz-lxc-") <= 0)
if (!RUN_ON_OSS_FUZZ && is_in_comm("fuzz-lxc-") <= 0)
fd = lxc_unpriv(open(name, O_CREAT | O_WRONLY | O_APPEND | O_CLOEXEC, 0660));
#endif /* !FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION */
if (fd < 0)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment