[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [tor/master] dynamic parameter filter bug fixes



commit abe082e7d03ad81d7f28d3f5c0070214aa525bfb
Author: Cristian Toader <cristian.matei.toader@xxxxxxxxx>
Date:   Wed Jul 24 17:15:57 2013 +0300

    dynamic parameter filter bug fixes
---
 src/common/sandbox.c |   15 +++++++++++++++
 src/common/sandbox.h |    2 ++
 2 files changed, 17 insertions(+)

diff --git a/src/common/sandbox.c b/src/common/sandbox.c
index 2657cba..1a842f9 100644
--- a/src/common/sandbox.c
+++ b/src/common/sandbox.c
@@ -192,6 +192,7 @@ char*
 get_prot_param(char *param)
 {
   int i, filter_size;
+  ParFilterDynamic *elem;
 
   if (param == NULL)
     return NULL;
@@ -209,6 +210,13 @@ get_prot_param(char *param)
     }
   }
 
+  for (elem = filter_dynamic; elem != NULL; elem = elem->next) {
+    if (elem->prot  && elem->ptype == PARAM_PTR
+        && !strncmp(param, (char*)(elem->param), MAX_PARAM_LEN)) {
+      return (char*)(elem->param);
+    }
+  }
+
   log_warn(LD_BUG, "(Sandbox) Parameter %s not found", param);
   return param;
 }
@@ -272,6 +280,13 @@ add_dynamic_param_filter(char *syscall, char ptype, char pindex, intptr_t val)
     break;
   }
 
+  // TODO: and so on ..?
+  if (!strcmp(syscall, "open")) {
+    (*elem)->syscall = SCMP_SYS(open);
+  } else if (!strcmp(syscall, "rt_sigaction")) {
+    (*elem)->syscall = SCMP_SYS(rt_sigaction);
+  }
+
   return 0;
 }
 
diff --git a/src/common/sandbox.h b/src/common/sandbox.h
index b75161d..dc765c7 100644
--- a/src/common/sandbox.h
+++ b/src/common/sandbox.h
@@ -81,6 +81,8 @@ typedef struct pfd_elem ParFilterDynamic;
 void sandbox_set_debugging_fd(int fd);
 int tor_global_sandbox(void);
 char* get_prot_param(char *param);
+int add_dynamic_param_filter(char *syscall, char ptype, char pindex,
+    intptr_t val);
 
 #endif /* SANDBOX_H_ */
 



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits