diff options
author | 2016-12-05 21:16:10 -0500 | |
---|---|---|
committer | 2016-12-05 21:16:10 -0500 | |
commit | 4d0797b12c8163e9e94ae0f0c7f4178bff9bdd4a (patch) | |
tree | 5455f89e1a029582e45b44f45a631165a795e1c9 /src | |
parent | Merge branch 'master' of https://github.com/netblue30/firejail (diff) | |
download | firejail-4d0797b12c8163e9e94ae0f0c7f4178bff9bdd4a.tar.gz firejail-4d0797b12c8163e9e94ae0f0c7f4178bff9bdd4a.tar.zst firejail-4d0797b12c8163e9e94ae0f0c7f4178bff9bdd4a.zip |
testing
Diffstat (limited to 'src')
-rw-r--r-- | src/firejail/profile.c | 3 | ||||
-rw-r--r-- | src/firejail/rlimit.c | 12 | ||||
-rw-r--r-- | src/firejail/sandbox.c | 9 |
3 files changed, 24 insertions, 0 deletions
diff --git a/src/firejail/profile.c b/src/firejail/profile.c index 63678514f..da3daf95a 100644 --- a/src/firejail/profile.c +++ b/src/firejail/profile.c | |||
@@ -1053,6 +1053,9 @@ void profile_read(const char *fname) { | |||
1053 | // else { | 1053 | // else { |
1054 | // free(ptr); | 1054 | // free(ptr); |
1055 | // } | 1055 | // } |
1056 | #ifdef HAVE_GCOV | ||
1057 | __gcov_flush(); | ||
1058 | #endif | ||
1056 | } | 1059 | } |
1057 | fclose(fp); | 1060 | fclose(fp); |
1058 | } | 1061 | } |
diff --git a/src/firejail/rlimit.c b/src/firejail/rlimit.c index a774fd6f5..47dd846d2 100644 --- a/src/firejail/rlimit.c +++ b/src/firejail/rlimit.c | |||
@@ -27,6 +27,9 @@ void set_rlimits(void) { | |||
27 | if (arg_rlimit_nofile) { | 27 | if (arg_rlimit_nofile) { |
28 | rl.rlim_cur = (rlim_t) cfg.rlimit_nofile; | 28 | rl.rlim_cur = (rlim_t) cfg.rlimit_nofile; |
29 | rl.rlim_max = (rlim_t) cfg.rlimit_nofile; | 29 | rl.rlim_max = (rlim_t) cfg.rlimit_nofile; |
30 | #ifdef HAVE_GCOV // gcov-instrumented programs might crash at this point | ||
31 | __gcov_dump(); | ||
32 | #endif | ||
30 | if (setrlimit(RLIMIT_NOFILE, &rl) == -1) | 33 | if (setrlimit(RLIMIT_NOFILE, &rl) == -1) |
31 | errExit("setrlimit"); | 34 | errExit("setrlimit"); |
32 | if (arg_debug) | 35 | if (arg_debug) |
@@ -36,6 +39,9 @@ void set_rlimits(void) { | |||
36 | if (arg_rlimit_nproc) { | 39 | if (arg_rlimit_nproc) { |
37 | rl.rlim_cur = (rlim_t) cfg.rlimit_nproc; | 40 | rl.rlim_cur = (rlim_t) cfg.rlimit_nproc; |
38 | rl.rlim_max = (rlim_t) cfg.rlimit_nproc; | 41 | rl.rlim_max = (rlim_t) cfg.rlimit_nproc; |
42 | #ifdef HAVE_GCOV | ||
43 | __gcov_dump(); | ||
44 | #endif | ||
39 | if (setrlimit(RLIMIT_NPROC, &rl) == -1) | 45 | if (setrlimit(RLIMIT_NPROC, &rl) == -1) |
40 | errExit("setrlimit"); | 46 | errExit("setrlimit"); |
41 | if (arg_debug) | 47 | if (arg_debug) |
@@ -45,6 +51,9 @@ void set_rlimits(void) { | |||
45 | if (arg_rlimit_fsize) { | 51 | if (arg_rlimit_fsize) { |
46 | rl.rlim_cur = (rlim_t) cfg.rlimit_fsize; | 52 | rl.rlim_cur = (rlim_t) cfg.rlimit_fsize; |
47 | rl.rlim_max = (rlim_t) cfg.rlimit_fsize; | 53 | rl.rlim_max = (rlim_t) cfg.rlimit_fsize; |
54 | #ifdef HAVE_GCOV | ||
55 | __gcov_dump(); | ||
56 | #endif | ||
48 | if (setrlimit(RLIMIT_FSIZE, &rl) == -1) | 57 | if (setrlimit(RLIMIT_FSIZE, &rl) == -1) |
49 | errExit("setrlimit"); | 58 | errExit("setrlimit"); |
50 | if (arg_debug) | 59 | if (arg_debug) |
@@ -54,6 +63,9 @@ void set_rlimits(void) { | |||
54 | if (arg_rlimit_sigpending) { | 63 | if (arg_rlimit_sigpending) { |
55 | rl.rlim_cur = (rlim_t) cfg.rlimit_sigpending; | 64 | rl.rlim_cur = (rlim_t) cfg.rlimit_sigpending; |
56 | rl.rlim_max = (rlim_t) cfg.rlimit_sigpending; | 65 | rl.rlim_max = (rlim_t) cfg.rlimit_sigpending; |
66 | #ifdef HAVE_GCOV | ||
67 | __gcov_dump(); | ||
68 | #endif | ||
57 | if (setrlimit(RLIMIT_SIGPENDING, &rl) == -1) | 69 | if (setrlimit(RLIMIT_SIGPENDING, &rl) == -1) |
58 | errExit("setrlimit"); | 70 | errExit("setrlimit"); |
59 | if (arg_debug) | 71 | if (arg_debug) |
diff --git a/src/firejail/sandbox.c b/src/firejail/sandbox.c index 68b8f554d..50fcd6ed0 100644 --- a/src/firejail/sandbox.c +++ b/src/firejail/sandbox.c | |||
@@ -286,6 +286,9 @@ void start_application(void) { | |||
286 | //**************************************** | 286 | //**************************************** |
287 | if (arg_audit) { | 287 | if (arg_audit) { |
288 | assert(arg_audit_prog); | 288 | assert(arg_audit_prog); |
289 | #ifdef HAVE_GCOV | ||
290 | __gcov_dump(); | ||
291 | #endif | ||
289 | execl(arg_audit_prog, arg_audit_prog, NULL); | 292 | execl(arg_audit_prog, arg_audit_prog, NULL); |
290 | } | 293 | } |
291 | //**************************************** | 294 | //**************************************** |
@@ -309,6 +312,9 @@ void start_application(void) { | |||
309 | if (!arg_command && !arg_quiet) | 312 | if (!arg_command && !arg_quiet) |
310 | printf("Child process initialized\n"); | 313 | printf("Child process initialized\n"); |
311 | 314 | ||
315 | #ifdef HAVE_GCOV | ||
316 | __gcov_dump(); | ||
317 | #endif | ||
312 | execvp(cfg.original_argv[cfg.original_program_index], &cfg.original_argv[cfg.original_program_index]); | 318 | execvp(cfg.original_argv[cfg.original_program_index], &cfg.original_argv[cfg.original_program_index]); |
313 | exit(1); | 319 | exit(1); |
314 | } | 320 | } |
@@ -356,6 +362,9 @@ void start_application(void) { | |||
356 | 362 | ||
357 | if (!arg_command && !arg_quiet) | 363 | if (!arg_command && !arg_quiet) |
358 | printf("Child process initialized\n"); | 364 | printf("Child process initialized\n"); |
365 | #ifdef HAVE_GCOV | ||
366 | __gcov_dump(); | ||
367 | #endif | ||
359 | execvp(arg[0], arg); | 368 | execvp(arg[0], arg); |
360 | } | 369 | } |
361 | 370 | ||