summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAshod Nakashian <ashod.nakashian@collabora.co.uk>2022-04-14 19:05:26 -0400
committerAndras Timar <andras.timar@collabora.com>2022-04-21 11:34:59 +0200
commitb87ab22633403fb6214f7d6dc3af5ebb370289bd (patch)
tree79d910e468e457adb46467422d79942dc855cd58
parentconfigure: choose the correct sanitizer library when fuzzing (diff)
downloadonline-b87ab22633403fb6214f7d6dc3af5ebb370289bd.tar.gz
online-b87ab22633403fb6214f7d6dc3af5ebb370289bd.zip
wsd: kill coolwsd_fuzzer
coolwsd_fuzzer predates actual fuzzing with libfuzzer and is currently unsused. Change-Id: Id095b165943ba14dbf525ddc607ad329f5d952d4 Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
-rw-r--r--.gitignore1
-rw-r--r--Makefile.am12
-rw-r--r--kit/ForKit.cpp2
-rw-r--r--kit/Kit.cpp17
-rw-r--r--test/helpers.hpp8
-rw-r--r--wsd/COOLWSD.cpp47
-rw-r--r--wsd/COOLWSD.hpp4
7 files changed, 4 insertions, 87 deletions
diff --git a/.gitignore b/.gitignore
index d0d24bd1ba..05b8697c86 100644
--- a/.gitignore
+++ b/.gitignore
@@ -88,7 +88,6 @@ loolconfig
coolforkit-nocaps
loadtest
unittest
-coolwsd_fuzzer
clientnb
# Fuzzer
diff --git a/Makefile.am b/Makefile.am
index 8b53ccadcc..4d4c5059c6 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -79,13 +79,10 @@ AM_LDFLAGS = -pthread -Wl,-E -lpam $(ZLIB_LIBS)
if ENABLE_SSL
AM_LDFLAGS += -lssl -lcrypto
else
-coolwsd_fuzzer_LDADD = -lssl -lcrypto
coolwsd_LDADD = -lssl -lcrypto
coolconfig_LDADD = -lssl -lcrypto
endif
-coolwsd_fuzzer_CPPFLAGS = -DKIT_IN_PROCESS=1 -DFUZZER=1 -DTDOC=\"$(abs_top_srcdir)/test/data\" $(AM_CPPFLAGS)
-
AM_ETAGSFLAGS = --c++-kinds=+p --fields=+iaS --extra=+q -R --totals=yes --exclude=browser *
AM_CTAGSFLAGS = $(AM_ETAGSFLAGS)
@@ -154,8 +151,6 @@ noinst_PROGRAMS += \
admin_fuzzer \
clientsession_fuzzer \
httpresponse_fuzzer
-else
-noinst_PROGRAMS += coolwsd_fuzzer
endif
connect_SOURCES = tools/Connect.cpp \
@@ -182,11 +177,6 @@ coolforkit_json = $(patsubst %.cpp,%.cmd,$(coolforkit_sources))
coolforkit_SOURCES = $(coolforkit_sources) \
$(shared_sources)
-coolwsd_fuzzer_SOURCES = $(coolwsd_sources) \
- $(coolforkit_sources) \
- $(shared_sources) \
- kit/DummyLibreOfficeKit.cpp
-
if ENABLE_LIBFUZZER
admin_fuzzer_CPPFLAGS = \
@@ -425,7 +415,7 @@ clean-local:
if test "z@SYSTEMPLATE_PATH@" != "z"; then rm -rf "@SYSTEMPLATE_PATH@"; fi
rm -rf "${top_srcdir}/loleaflet"
rm -rf loolconfig loolconvert loolforkit loolmap loolmount # kill old binaries
- rm -rf loolwsd loolwsd_fuzzer loolstress loolsocketdump
+ rm -rf loolwsd loolwsd_fuzzer coolwsd_fuzzer loolstress loolsocketdump
if ENABLE_DEBUG
# can write to /tmp/coolwsd.log
diff --git a/kit/ForKit.cpp b/kit/ForKit.cpp
index 6fed576b60..a1effd5b97 100644
--- a/kit/ForKit.cpp
+++ b/kit/ForKit.cpp
@@ -543,10 +543,8 @@ int main(int argc, char** argv)
}
}
-#ifndef FUZZER
SigUtil::setFatalSignals("forkit startup of " COOLWSD_VERSION " " COOLWSD_VERSION_HASH);
SigUtil::setTerminationSignals();
-#endif
Util::setApplicationPath(Poco::Path(argv[0]).parent().toString());
diff --git a/kit/Kit.cpp b/kit/Kit.cpp
index 23d590f94f..ec805039ec 100644
--- a/kit/Kit.cpp
+++ b/kit/Kit.cpp
@@ -83,11 +83,6 @@
#include <utility>
#endif
-#ifdef FUZZER
-#include <kit/DummyLibreOfficeKit.hpp>
-#include <wsd/COOLWSD.hpp>
-#endif
-
#if MOBILEAPP
#include "COOLWSD.hpp"
#endif
@@ -1867,7 +1862,7 @@ private:
bool _inputProcessingEnabled;
};
-#if !defined FUZZER && !defined BUILDING_TESTS && !MOBILEAPP
+#if !defined BUILDING_TESTS && !MOBILEAPP
// When building the fuzzer we link COOLWSD.cpp into the same executable so the
// Protected::emitOneRecording() there gets used. When building the unit tests the one in
@@ -2468,10 +2463,8 @@ void lokit_main(
{
#if !MOBILEAPP
-#ifndef FUZZER
SigUtil::setFatalSignals("kit startup of " COOLWSD_VERSION " " COOLWSD_VERSION_HASH);
SigUtil::setTerminationSignals();
-#endif
Util::setThreadName("kit_spare_" + Util::encodeId(numericIdentifier, 3));
@@ -2687,10 +2680,6 @@ void lokit_main(
kit = UnitKit::get().lok_init(instdir, userdir);
#else
kit = nullptr;
-#ifdef FUZZER
- if (COOLWSD::DummyLOK)
- kit = dummy_lok_init_2(instdir, userdir);
-#endif
#endif
if (!kit)
{
@@ -2927,10 +2916,6 @@ std::string anonymizeUrl(const std::string& url)
/// Initializes LibreOfficeKit for cross-fork re-use.
bool globalPreinit(const std::string &loTemplate)
{
-#ifdef FUZZER
- if (COOLWSD::DummyLOK)
- return true;
-#endif
const std::string libSofficeapp = loTemplate + "/program/" LIB_SOFFICEAPP;
const std::string libMerged = loTemplate + "/program/" LIB_MERGED;
diff --git a/test/helpers.hpp b/test/helpers.hpp
index 70810eb74a..29f69bf542 100644
--- a/test/helpers.hpp
+++ b/test/helpers.hpp
@@ -129,11 +129,7 @@ inline void getDocumentPathAndURL(const std::string& docFilename, std::string& d
inline
void sendTextFrame(COOLWebSocket& socket, const std::string& string, const std::string& testname)
{
-#ifndef FUZZER
TST_LOG("Sending " << string.size() << " bytes: " << COOLProtocol::getAbbreviatedMessage(string));
-#else
- (void) testname;
-#endif
socket.sendFrame(string.data(), string.size());
}
@@ -146,12 +142,8 @@ void sendTextFrame(const std::shared_ptr<COOLWebSocket>& socket, const std::stri
inline void sendTextFrame(const std::shared_ptr<http::WebSocketSession>& ws,
const std::string& string, const std::string& testname = std::string())
{
-#ifndef FUZZER
TST_LOG("Sending " << string.size()
<< " bytes: " << COOLProtocol::getAbbreviatedMessage(string));
-#else
- (void)testname;
-#endif
ws->sendMessage(string);
}
diff --git a/wsd/COOLWSD.cpp b/wsd/COOLWSD.cpp
index 6d85727fdd..45deb86a89 100644
--- a/wsd/COOLWSD.cpp
+++ b/wsd/COOLWSD.cpp
@@ -144,10 +144,6 @@ using Poco::Net::PartHandler;
#include <common/ConfigUtil.hpp>
#include <common/TraceEvent.hpp>
-#ifdef FUZZER
-# include <tools/Replay.hpp>
-#endif
-
#include <common/SigUtil.hpp>
#include <ServerSocket.hpp>
@@ -858,10 +854,6 @@ bool COOLWSD::UnattendedRun = false;
bool COOLWSD::SingleKit = false;
#endif
#endif
-#ifdef FUZZER
-bool COOLWSD::DummyLOK = false;
-std::string COOLWSD::FuzzFileName;
-#endif
std::string COOLWSD::SysTemplate;
std::string COOLWSD::LoTemplate = LO_PATH;
std::string COOLWSD::ChildRoot;
@@ -2329,15 +2321,6 @@ void COOLWSD::defineOptions(OptionSet& optionSet)
.repeatable(false));
#endif
-#ifdef FUZZER
- optionSet.addOption(Option("dummy-lok", "", "Use empty (dummy) LibreOfficeKit implementation instead a real LibreOffice.")
- .required(false)
- .repeatable(false));
- optionSet.addOption(Option("fuzz", "", "Read input from the specified file for fuzzing.")
- .required(false)
- .repeatable(false)
- .argument("trace_file_name"));
-#endif
#endif
}
@@ -2402,13 +2385,6 @@ void COOLWSD::handleOption(const std::string& optionName,
if (latencyMs)
SimulatedLatencyMs = std::stoi(latencyMs);
#endif
-
-#ifdef FUZZER
- if (optionName == "dummy-lok")
- DummyLOK = true;
- else if (optionName == "fuzz")
- FuzzFileName = value;
-#endif
#endif
}
@@ -2586,26 +2562,7 @@ void PrisonPoll::wakeupHook()
{
// No children have died.
// Make sure we have sufficient reserves.
- if (prespawnChildren())
- {
- // Nothing more to do this round, unless we are fuzzing
-#if FUZZER
- if (!COOLWSD::FuzzFileName.empty())
- {
- StressSocketHandler::replaySync(
-#if ENABLE_SSL
- "wss://127.0.0.1:" + std::to_string(ClientPortNumber),
-#else
- "ws://127.0.0.1:" + std::to_string(ClientPortNumber),
-#endif
- "" /* FIXME: what local path are these traces replayed into ? */,
- COOLWSD::FuzzFileName);
-
- LOG_INF("Setting TerminationFlag");
- SigUtil::setTerminationFlag();
- }
-#endif
- }
+ prespawnChildren();
}
#endif
std::unique_lock<std::mutex> docBrokersLock(DocBrokersMutex, std::defer_lock);
@@ -4687,7 +4644,7 @@ std::string COOLWSD::getServerURL()
int COOLWSD::innerMain()
{
-#if !defined FUZZER && !MOBILEAPP
+#if !MOBILEAPP
SigUtil::setUserSignals();
SigUtil::setFatalSignals("wsd " COOLWSD_VERSION " " COOLWSD_VERSION_HASH);
SigUtil::setTerminationSignals();
diff --git a/wsd/COOLWSD.hpp b/wsd/COOLWSD.hpp
index abb5c82d15..82b059ba7b 100644
--- a/wsd/COOLWSD.hpp
+++ b/wsd/COOLWSD.hpp
@@ -233,10 +233,6 @@ public:
static std::shared_ptr<ForKitProcess> ForKitProc;
static std::atomic<int> ForKitProcId;
#endif
-#ifdef FUZZER
- static bool DummyLOK;
- static std::string FuzzFileName;
-#endif
static std::string UserInterface;
static std::string ConfigFile;
static std::string ConfigDir;