aboutsummaryrefslogtreecommitdiff
path: root/src/init.cpp
diff options
context:
space:
mode:
authorAndrew Chow <github@achow101.com>2023-06-27 17:48:15 -0400
committerAndrew Chow <github@achow101.com>2023-06-27 18:19:21 -0400
commitcaff95a0237facddb46fbbdf87e31ff6294b8c70 (patch)
treefd3d4ff0920d2e0cd73c47301531f50544909fdf /src/init.cpp
parent5cce4d293e8065ddd69838c7279fa5b4ddcc2daa (diff)
parent32e2ffc39374f61bb2435da507f285459985df9e (diff)
Merge bitcoin/bitcoin#27896: Remove the syscall sandbox
32e2ffc39374f61bb2435da507f285459985df9e Remove the syscall sandbox (fanquake) Pull request description: After initially being merged in #20487, it's no-longer clear that an internal syscall sandboxing mechanism is something that Bitcoin Core should have/maintain, especially when compared to better maintained/supported alterantives, i.e [firejail](https://github.com/netblue30/firejail). There is more related discussion in #24771. Note that given where it's used, the sandbox also gets dragged into the kernel. If it's removed, this should not require any sort of deprecation, as this was only ever an opt-in, experimental feature. Closes #24771. ACKs for top commit: davidgumberg: crACK https://github.com/bitcoin/bitcoin/pull/27896/commits/32e2ffc39374f61bb2435da507f285459985df9e achow101: ACK 32e2ffc39374f61bb2435da507f285459985df9e dergoegge: ACK 32e2ffc39374f61bb2435da507f285459985df9e Tree-SHA512: 8cf71c5623bb642cb515531d4a2545d806e503b9d57bfc15a996597632b06103d60d985fd7f843a3c1da6528bc38d0298d6b8bcf0be6f851795a8040d71faf16
Diffstat (limited to 'src/init.cpp')
-rw-r--r--src/init.cpp41
1 files changed, 1 insertions, 40 deletions
diff --git a/src/init.cpp b/src/init.cpp
index e86180017a..c38352ee38 100644
--- a/src/init.cpp
+++ b/src/init.cpp
@@ -80,7 +80,6 @@
#include <util/result.h>
#include <util/strencodings.h>
#include <util/string.h>
-#include <util/syscall_sandbox.h>
#include <util/syserror.h>
#include <util/thread.h>
#include <util/threadnames.h>
@@ -630,10 +629,6 @@ void SetupServerArgs(ArgsManager& argsman)
hidden_args.emplace_back("-daemonwait");
#endif
-#if defined(USE_SYSCALL_SANDBOX)
- argsman.AddArg("-sandbox=<mode>", "Use the experimental syscall sandbox in the specified mode (-sandbox=log-and-abort or -sandbox=abort). Allow only expected syscalls to be used by bitcoind. Note that this is an experimental new feature that may cause bitcoind to exit or crash unexpectedly: use with caution. In the \"log-and-abort\" mode the invocation of an unexpected syscall results in a debug handler being invoked which will log the incident and terminate the program (without executing the unexpected syscall). In the \"abort\" mode the invocation of an unexpected syscall results in the entire process being killed immediately by the kernel without executing the unexpected syscall.", ArgsManager::ALLOW_ANY, OptionsCategory::OPTIONS);
-#endif // USE_SYSCALL_SANDBOX
-
// Add the hidden options
argsman.AddHiddenArgs(hidden_args);
}
@@ -844,7 +839,7 @@ bool AppInitBasicSetup(const ArgsManager& args, std::atomic<int>& exit_status)
return true;
}
-bool AppInitParameterInteraction(const ArgsManager& args, bool use_syscall_sandbox)
+bool AppInitParameterInteraction(const ArgsManager& args)
{
const CChainParams& chainparams = Params();
// ********************************************************* Step 2: parameter interactions
@@ -991,40 +986,6 @@ bool AppInitParameterInteraction(const ArgsManager& args, bool use_syscall_sandb
if (args.GetIntArg("-rpcserialversion", DEFAULT_RPC_SERIALIZE_VERSION) > 1)
return InitError(Untranslated("Unknown rpcserialversion requested."));
-#if defined(USE_SYSCALL_SANDBOX)
- if (args.IsArgSet("-sandbox") && !args.IsArgNegated("-sandbox")) {
- const std::string sandbox_arg{args.GetArg("-sandbox", "")};
- bool log_syscall_violation_before_terminating{false};
- if (sandbox_arg == "log-and-abort") {
- log_syscall_violation_before_terminating = true;
- } else if (sandbox_arg == "abort") {
- // log_syscall_violation_before_terminating is false by default.
- } else {
- return InitError(Untranslated("Unknown syscall sandbox mode (-sandbox=<mode>). Available modes are \"log-and-abort\" and \"abort\"."));
- }
- // execve(...) is not allowed by the syscall sandbox.
- const std::vector<std::string> features_using_execve{
- "-alertnotify",
- "-blocknotify",
- "-signer",
- "-startupnotify",
- "-walletnotify",
- };
- for (const std::string& feature_using_execve : features_using_execve) {
- if (!args.GetArg(feature_using_execve, "").empty()) {
- return InitError(Untranslated(strprintf("The experimental syscall sandbox feature (-sandbox=<mode>) is incompatible with %s (which uses execve).", feature_using_execve)));
- }
- }
- if (!SetupSyscallSandbox(log_syscall_violation_before_terminating)) {
- return InitError(Untranslated("Installation of the syscall sandbox failed."));
- }
- if (use_syscall_sandbox) {
- SetSyscallSandboxPolicy(SyscallSandboxPolicy::INITIALIZATION);
- }
- LogPrintf("Experimental syscall sandbox enabled (-sandbox=%s): bitcoind will terminate if an unexpected (not allowlisted) syscall is invoked.\n", sandbox_arg);
- }
-#endif // USE_SYSCALL_SANDBOX
-
// Also report errors from parsing before daemonization
{
KernelNotifications notifications{};