diff options
author | Cristian Toader <cristian.matei.toader@gmail.com> | 2013-07-24 17:15:57 +0300 |
---|---|---|
committer | Cristian Toader <cristian.matei.toader@gmail.com> | 2013-07-24 17:15:57 +0300 |
commit | abe082e7d03ad81d7f28d3f5c0070214aa525bfb (patch) | |
tree | ce2202713fbf3d7c40c5612d95c9642f9c859540 | |
parent | 962d814e52beb8d3ca8c73f3ab48d8566778dcc5 (diff) | |
download | tor-abe082e7d03ad81d7f28d3f5c0070214aa525bfb.tar.gz tor-abe082e7d03ad81d7f28d3f5c0070214aa525bfb.zip |
dynamic parameter filter bug fixes
-rw-r--r-- | src/common/sandbox.c | 15 | ||||
-rw-r--r-- | src/common/sandbox.h | 2 |
2 files changed, 17 insertions, 0 deletions
diff --git a/src/common/sandbox.c b/src/common/sandbox.c index 2657cbaaf2..1a842f9ed8 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 b75161d93b..dc765c758e 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_ */ |