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>
pull/4622/head
Ashod Nakashian 2022-04-14 19:05:26 -04:00 committed by Ashod Nakashian
parent 6bc2d70dcb
commit 96adaa15d1
7 changed files with 4 additions and 87 deletions

1
.gitignore vendored
View File

@ -88,7 +88,6 @@ loolconfig
coolforkit-nocaps
loadtest
unittest
coolwsd_fuzzer
clientnb
# Fuzzer

View File

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

View File

@ -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());

View File

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

View File

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

View File

@ -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();

View File

@ -232,10 +232,6 @@ public:
#endif
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;