Patch tor

This commit is contained in:
Emery Hemingway 2020-12-03 12:22:18 +01:00
parent abe28a02dc
commit 264ea72e3c
2 changed files with 79 additions and 0 deletions

View File

@ -137,6 +137,13 @@ in {
solo5-tools = callPackage ./solo5-tools { };
tor = overrideAttrsHost (attrs: {
configureFlags = attrs.configureFlags or [ ]
++ [ "--disable-tool-name-check" ];
patches = attrs.patches or [ ] ++ [ ./tor/genode.patch ];
postPatch = null; # Avoid torsocks patching
}) tor;
zlib = overrideAttrsHost (attrs: {
postInstall = attrs.postInstall or "" + ''
pushd ''${!outputLib}/lib

72
overlay/tor/genode.patch Normal file
View File

@ -0,0 +1,72 @@
From b361fa6da5a5892ada665dcabfc6a0327419db63 Mon Sep 17 00:00:00 2001
From: Emery Hemingway <ehmry@posteo.net>
Date: Wed, 2 Dec 2020 19:27:10 +0100
Subject: [PATCH] Skip user/group checks for Genode hosts
---
src/app/main/main.c | 4 ++++
src/lib/fs/dir.c | 5 +++++
src/lib/process/setuid.c | 9 +++++++++
3 files changed, 18 insertions(+)
diff --git a/src/app/main/main.c b/src/app/main/main.c
index e7ffb31b4f..a1a9037f09 100644
--- a/src/app/main/main.c
+++ b/src/app/main/main.c
@@ -670,6 +670,10 @@ static tor_lockfile_t *lockfile = NULL;
int
try_locking(const or_options_t *options, int err_if_locked)
{
+#ifdef __GENODE__
+ /* platform does not support exclusive file-system locks */
+ return 0;
+#endif
if (lockfile)
return 0;
else {
diff --git a/src/lib/fs/dir.c b/src/lib/fs/dir.c
index 3432df0299..e33595a006 100644
--- a/src/lib/fs/dir.c
+++ b/src/lib/fs/dir.c
@@ -168,6 +168,11 @@ check_private_dir,(const char *dirname, cpd_check_t check,
return -1;
}
+#ifdef __GENODE__
+ /* platform lacks users and groups */
+ return 0;
+#endif
+
if (effective_user) {
/* Look up the user and group information.
* If we have a problem, bail out. */
diff --git a/src/lib/process/setuid.c b/src/lib/process/setuid.c
index 3cfd520a4f..bf1857ad2a 100644
--- a/src/lib/process/setuid.c
+++ b/src/lib/process/setuid.c
@@ -50,6 +50,10 @@
static int
log_credential_status(void)
{
+#ifdef __GENODE__
+ /* platform lacks "credentials" */
+ return 0;
+#endif
/** Log level to use when describing non-error UID/GID status. */
#define CREDENTIAL_LOG_LEVEL LOG_INFO
/* Real, effective and saved UIDs */
@@ -229,6 +233,11 @@ drop_capabilities(int pre_setuid)
int
switch_id(const char *user, const unsigned flags)
{
+#ifdef __GENODE__
+ /* platform lacks users and groups */
+ return 0;
+#endif
+
#ifndef _WIN32
const struct passwd *pw = NULL;
uid_t old_uid;
--
2.29.2