blob: 26a923ab03943c989c1c3f43e8aade148b81c365 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
#define _GNU_SOURCE
#include <stdio.h>
#include <string.h>
#include <sys/stat.h>
#include <unistd.h>
#include <dlfcn.h>
static const char sandbox_path[] = "/chrome-sandbox";
int __xstat(int ver, const char* path, struct stat* stat_buf) {
static int (*original_xstat)(int, const char*, struct stat*) = NULL;
if (original_xstat == NULL) {
int (*fun)(int, const char*, struct stat*) = dlsym(RTLD_NEXT, "__xstat");
if (fun == NULL) {
return -1;
};
original_xstat = fun;
};
int res = (*original_xstat)(ver, path, stat_buf);
if (res == 0) {
char* pos = strstr(path, sandbox_path);
if (pos != NULL && *(pos + sizeof(sandbox_path) - 1) == '\0') {
printf("Lying about chrome-sandbox access rights...\n");
stat_buf->st_uid = 0;
stat_buf->st_gid = 0;
stat_buf->st_mode = 0104755;
};
}
return res;
}
|