**Use case**

https://colab.research.google.com/drive/1wzYn59PA9EDyra6356a8rUpwd3zUX0Zt?usp=sharing

**Describe the solution you'd like**

There are multiple ways to prevent LD_PRELOAD:

- link statically with musl to prevent any chance for LD_PRELOAD working;
- add some flag to the binary like capabilities or setuid to also prevent LD_PRELOAD working;
- don't allow it with some env variable;
- implement our own dynamic loader.

Also possible workaround:

- check if LD_PRELOAD is set very early at program startup. If it is, reset it and exec ourself with the same argc, argv.
{
    inside_main = true;
    SCOPE_EXIT({ inside_main = false; });
    
    
    std::set_new_handler(nullptr);
    
    
    
    updatePHDRCache();
    std::vector<char *> argv(argv_, argv_ + argc_);
    
    MainFunc main_func = printHelp;
    for (auto & application : clickhouse_applications)
    {
        if (isClickhouseApp(application.first, argv))
        {
            main_func = application.second;
            break;
        }
    }
    return main_func(static_cast<int>(argv.size()), argv.data());
}
#endif