Merge pull request #41428 from ClickHouse/remove-dlopen

Remove `dlopen`
This commit is contained in:
Alexey Milovidov 2022-09-18 00:09:57 +03:00 committed by GitHub
commit bac578b23a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
21 changed files with 7 additions and 41 deletions

View File

@ -8,6 +8,7 @@
* As a drawback, this only works if no dynamic object unloading happens after this point. * As a drawback, this only works if no dynamic object unloading happens after this point.
* This function is thread-safe. You should call it to update cache after loading new shared libraries. * This function is thread-safe. You should call it to update cache after loading new shared libraries.
* Otherwise exception handling from dlopened libraries won't work (will call std::terminate immediately). * Otherwise exception handling from dlopened libraries won't work (will call std::terminate immediately).
* NOTE: dlopen is forbidden in our code.
* *
* NOTE: It is disabled with Thread Sanitizer because TSan can only use original "dl_iterate_phdr" function. * NOTE: It is disabled with Thread Sanitizer because TSan can only use original "dl_iterate_phdr" function.
*/ */

View File

@ -1,2 +1 @@
extern int mainEntryClickHouseBenchmark(int argc, char ** argv); extern int mainEntryClickHouseBenchmark(int argc, char ** argv);
int main(int argc_, char ** argv_) { return mainEntryClickHouseBenchmark(argc_, argv_); }

View File

@ -1,2 +1 @@
int mainEntryClickHouseClient(int argc, char ** argv); int mainEntryClickHouseClient(int argc, char ** argv);
int main(int argc_, char ** argv_) { return mainEntryClickHouseClient(argc_, argv_); }

View File

@ -1,2 +1 @@
int mainEntryClickHouseCompressor(int argc, char ** argv); int mainEntryClickHouseCompressor(int argc, char ** argv);
int main(int argc_, char ** argv_) { return mainEntryClickHouseCompressor(argc_, argv_); }

View File

@ -1,2 +1 @@
int mainEntryClickHouseClusterCopier(int argc, char ** argv); int mainEntryClickHouseClusterCopier(int argc, char ** argv);
int main(int argc_, char ** argv_) { return mainEntryClickHouseClusterCopier(argc_, argv_); }

View File

@ -1,2 +1 @@
int mainEntryClickHouseDisks(int argc, char ** argv); int mainEntryClickHouseDisks(int argc, char ** argv);
int main(int argc_, char ** argv_) { return mainEntryClickHouseDisks(argc_, argv_); }

View File

@ -1,2 +1 @@
int mainEntryClickHouseExtractFromConfig(int argc, char ** argv); int mainEntryClickHouseExtractFromConfig(int argc, char ** argv);
int main(int argc_, char ** argv_) { return mainEntryClickHouseExtractFromConfig(argc_, argv_); }

View File

@ -1,2 +1 @@
int mainEntryClickHouseFormat(int argc, char ** argv); int mainEntryClickHouseFormat(int argc, char ** argv);
int main(int argc_, char ** argv_) { return mainEntryClickHouseFormat(argc_, argv_); }

View File

@ -1,2 +1 @@
int mainEntryClickHouseGitImport(int argc, char ** argv); int mainEntryClickHouseGitImport(int argc, char ** argv);
int main(int argc_, char ** argv_) { return mainEntryClickHouseGitImport(argc_, argv_); }

View File

@ -1,2 +1 @@
int mainEntryClickHouseKeeperConverter(int argc, char ** argv); int mainEntryClickHouseKeeperConverter(int argc, char ** argv);
int main(int argc_, char ** argv_) { return mainEntryClickHouseKeeperConverter(argc_, argv_); }

View File

@ -9,6 +9,7 @@ set (CLICKHOUSE_LIBRARY_BRIDGE_SOURCES
LibraryBridge.cpp LibraryBridge.cpp
LibraryBridgeHandlerFactory.cpp LibraryBridgeHandlerFactory.cpp
LibraryBridgeHandlers.cpp LibraryBridgeHandlers.cpp
SharedLibrary.cpp
library-bridge.cpp library-bridge.cpp
) )

View File

@ -7,12 +7,13 @@
#include <Columns/ColumnVector.h> #include <Columns/ColumnVector.h>
#include <Columns/ColumnsNumber.h> #include <Columns/ColumnsNumber.h>
#include <Columns/IColumn.h> #include <Columns/IColumn.h>
#include <Common/SharedLibrary.h>
#include <base/defines.h> #include <base/defines.h>
#include "SharedLibrary.h"
#include <chrono> #include <chrono>
#include <mutex> #include <mutex>
namespace DB namespace DB
{ {

View File

@ -1,6 +1,6 @@
#pragma once #pragma once
#include <Common/SharedLibrary.h> #include "SharedLibrary.h"
#include <Common/logger_useful.h> #include <Common/logger_useful.h>
#include "ExternalDictionaryLibraryUtils.h" #include "ExternalDictionaryLibraryUtils.h"

View File

@ -1,8 +1,7 @@
#include "SharedLibrary.h" #include "SharedLibrary.h"
#include <string> #include <string>
#include <boost/core/noncopyable.hpp>
#include <base/phdr_cache.h> #include <base/phdr_cache.h>
#include "Exception.h" #include <Common/Exception.h>
namespace DB namespace DB

View File

@ -1,2 +1 @@
int mainEntryClickHouseLocal(int argc, char ** argv); int mainEntryClickHouseLocal(int argc, char ** argv);
int main(int argc_, char ** argv_) { return mainEntryClickHouseLocal(argc_, argv_); }

View File

@ -422,6 +422,7 @@ int main(int argc_, char ** argv_)
/// PHDR cache is required for query profiler to work reliably /// PHDR cache is required for query profiler to work reliably
/// It also speed up exception handling, but exceptions from dynamically loaded libraries (dlopen) /// It also speed up exception handling, but exceptions from dynamically loaded libraries (dlopen)
/// will work only after additional call of this function. /// will work only after additional call of this function.
/// Note: we forbid dlopen in our code.
updatePHDRCache(); updatePHDRCache();
#ifndef DISABLE_HARMFUL_ENV_VAR_CHECK #ifndef DISABLE_HARMFUL_ENV_VAR_CHECK

View File

@ -1,3 +1 @@
int mainEntryClickHouseObfuscator(int argc, char ** argv); int mainEntryClickHouseObfuscator(int argc, char ** argv);
int main(int argc_, char ** argv_) { return mainEntryClickHouseObfuscator(argc_, argv_); }

View File

@ -1,24 +1 @@
#include <new>
#include <base/phdr_cache.h>
int mainEntryClickHouseServer(int argc, char ** argv); int mainEntryClickHouseServer(int argc, char ** argv);
/**
* This is the entry-point for the split build server. The initialization
* is copied from single-binary entry point in main.cpp.
*/
int main(int argc_, char ** argv_)
{
/// Reset new handler to default (that throws std::bad_alloc)
/// It is needed because LLVM library clobbers it.
std::set_new_handler(nullptr);
/// PHDR cache is required for query profiler to work reliably
/// It also speed up exception handling, but exceptions from dynamically loaded libraries (dlopen)
/// will work only after additional call of this function.
updatePHDRCache();
return mainEntryClickHouseServer(argc_, argv_);
}

View File

@ -1,2 +1 @@
int mainEntryClickHouseStaticFilesDiskUploader(int argc, char ** argv); int mainEntryClickHouseStaticFilesDiskUploader(int argc, char ** argv);
int main(int argc_, char ** argv_) { return mainEntryClickHouseStaticFilesDiskUploader(argc_, argv_); }

View File

@ -1,2 +1 @@
int mainEntryClickHouseSU(int argc, char ** argv); int mainEntryClickHouseSU(int argc, char ** argv);
int main(int argc_, char ** argv_) { return mainEntryClickHouseSU(argc_, argv_); }