tor/src/common/sandbox.h

87 lines
1.3 KiB
C
Raw Normal View History

/* Copyright (c) 2001 Matej Pfajfar.
* Copyright (c) 2001-2004, Roger Dingledine.
* Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson.
* Copyright (c) 2007-2013, The Tor Project, Inc. */
/* See LICENSE for licensing information */
/**
* \file sandbox.h
* \brief Header file for sandbox.c.
**/
#ifndef SANDBOX_H_
#define SANDBOX_H_
#ifndef SYS_SECCOMP
/**
* Used by SIGSYS signal handler to check if the signal was issued due to a
* seccomp2 filter violation.
*/
#define SYS_SECCOMP 1
#endif
2013-07-23 09:14:25 +02:00
#include "torint.h"
/**
* Linux definitions
*/
#ifdef __linux__
#define __USE_GNU
#include <sys/ucontext.h>
#define MAX_PARAM_LEN 64
#define PARAM_PTR 0
#define PARAM_NUM 1
typedef struct {
int syscall;
char ptype;
2013-07-23 13:22:31 +02:00
char pindex;
intptr_t param;
char prot;
} ParFilterStatic;
struct pfd_elem {
int syscall;
char ptype;
char pindex;
intptr_t param;
char prot;
struct pfd_elem *next;
};
typedef struct pfd_elem ParFilterDynamic;
/**
* Linux 32 bit definitions
*/
#if defined(__i386__)
#define REG_SYSCALL REG_EAX
/**
* Linux 64 bit definitions
*/
#elif defined(__x86_64__)
#define REG_SYSCALL REG_RAX
#endif
#endif // __linux__
void sandbox_set_debugging_fd(int fd);
int tor_global_sandbox(void);
2013-07-18 17:11:47 +02:00
char* get_prot_param(char *param);
#endif /* SANDBOX_H_ */