Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 290249
Collapse All | Expand All

(-)a/libsandbox/libsandbox.h (+2 lines)
Lines 52-57 bool before_syscall_access(int, int, const char *, const char *, int); Link Here
52
bool before_syscall_open_int(int, int, const char *, const char *, int);
52
bool before_syscall_open_int(int, int, const char *, const char *, int);
53
bool before_syscall_open_char(int, int, const char *, const char *, const char *);
53
bool before_syscall_open_char(int, int, const char *, const char *, const char *);
54
54
55
void *get_dlsym(const char *symname, const char *symver);
56
55
extern char sandbox_lib[SB_PATH_MAX];
57
extern char sandbox_lib[SB_PATH_MAX];
56
extern bool sandbox_on;
58
extern bool sandbox_on;
57
extern pid_t trace_pid;
59
extern pid_t trace_pid;
(-)a/libsandbox/memory.c (+18 lines)
Lines 15-20 Link Here
15
#include "libsandbox.h"
15
#include "libsandbox.h"
16
#include "sbutil.h"
16
#include "sbutil.h"
17
17
18
/* Well screw me sideways, someone decided to override mmap() #290249 */
19
static void *(*_sb_mmap)(void *addr, size_t length, int prot, int flags, int fd, off_t offset);
20
static void *sb_mmap(void *addr, size_t length, int prot, int flags, int fd, off_t offset)
21
{
22
	if (!_sb_mmap)
23
		_sb_mmap = get_dlsym("mmap", NULL);
24
	return _sb_mmap(addr, length, prot, flags, fd, offset);
25
}
26
#define mmap sb_mmap
27
static int (*_sb_munmap)(void *addr, size_t length);
28
static int sb_munmap(void *addr, size_t length)
29
{
30
	if (!_sb_munmap)
31
		_sb_munmap = get_dlsym("munmap", NULL);
32
	return _sb_munmap(addr, length);
33
}
34
#define munmap sb_munmap
35
18
#define SB_MALLOC_TO_MMAP(ptr) ((void*)(((size_t*)ptr) - 1))
36
#define SB_MALLOC_TO_MMAP(ptr) ((void*)(((size_t*)ptr) - 1))
19
#define SB_MMAP_TO_MALLOC(ptr) ((void*)(((size_t*)ptr) + 1))
37
#define SB_MMAP_TO_MALLOC(ptr) ((void*)(((size_t*)ptr) + 1))
20
#define SB_MALLOC_TO_SIZE(ptr) (*((size_t*)SB_MALLOC_TO_MMAP(ptr)))
38
#define SB_MALLOC_TO_SIZE(ptr) (*((size_t*)SB_MALLOC_TO_MMAP(ptr)))
(-)a/libsandbox/wrappers.c (-1 / +1 lines)
Lines 21-27 Link Here
21
21
22
static void *libc_handle = NULL;
22
static void *libc_handle = NULL;
23
23
24
static void *get_dlsym(const char *symname, const char *symver)
24
void *get_dlsym(const char *symname, const char *symver)
25
{
25
{
26
	void *symaddr = NULL;
26
	void *symaddr = NULL;
27
27

Return to bug 290249