[GH-ISSUE #231] Faster exit #160

Closed
opened 2026-05-05 05:12:12 -06:00 by gitea-mirror · 2 comments
Owner

Originally created by @ivan on GitHub (Jan 16, 2016).
Original GitHub issue: https://github.com/netblue30/firejail/issues/231

I'm launching firejail very frequently to jail a few interactive programs, and I noticed there's usually a delay of about one second between the time the program exits and the time firejail exits. Is there any way you could make this faster to handle that interactive use case?

My profile is

include /opt/firejail/etc/firejail/disable-mgmt.inc
include /opt/firejail/etc/firejail/disable-secret.inc
include /opt/firejail/etc/firejail/disable-common.inc
include /opt/firejail/etc/firejail/disable-devel.inc
caps.drop all
seccomp
protocol unix,inet,inet6
netfilter
noroot

blacklist /mnt
blacklist /media
blacklist ${HOME}

tmpfs /tmp

and I'm running

firejail --quiet "--profile=$(dirname "$0")/my.profile" --private --private-dev "$@"

on Ubuntu 15.10

Originally created by @ivan on GitHub (Jan 16, 2016). Original GitHub issue: https://github.com/netblue30/firejail/issues/231 I'm launching firejail very frequently to jail a few interactive programs, and I noticed there's usually a delay of about one second between the time the program exits and the time firejail exits. Is there any way you could make this faster to handle that interactive use case? My profile is ``` include /opt/firejail/etc/firejail/disable-mgmt.inc include /opt/firejail/etc/firejail/disable-secret.inc include /opt/firejail/etc/firejail/disable-common.inc include /opt/firejail/etc/firejail/disable-devel.inc caps.drop all seccomp protocol unix,inet,inet6 netfilter noroot blacklist /mnt blacklist /media blacklist ${HOME} tmpfs /tmp ``` and I'm running ``` firejail --quiet "--profile=$(dirname "$0")/my.profile" --private --private-dev "$@" ``` on Ubuntu 15.10
Author
Owner

@ivan commented on GitHub (Jan 16, 2016):

It exits quickly after patching my local copy with

diff --git a/src/firejail/sandbox.c b/src/firejail/sandbox.c
index 5ba6158..92adfca 100644
--- a/src/firejail/sandbox.c
+++ b/src/firejail/sandbox.c
@@ -131,7 +131,7 @@ static void chk_chroot(void) {

 static void monitor_application(pid_t app_pid) {
    while (app_pid) {
-       sleep(1);
+       usleep(20000);

        int status;
        unsigned rv = waitpid(app_pid, &status, 0);
<!-- gh-comment-id:172182847 --> @ivan commented on GitHub (Jan 16, 2016): It exits quickly after patching my local copy with ``` diff diff --git a/src/firejail/sandbox.c b/src/firejail/sandbox.c index 5ba6158..92adfca 100644 --- a/src/firejail/sandbox.c +++ b/src/firejail/sandbox.c @@ -131,7 +131,7 @@ static void chk_chroot(void) { static void monitor_application(pid_t app_pid) { while (app_pid) { - sleep(1); + usleep(20000); int status; unsigned rv = waitpid(app_pid, &status, 0); ```
Author
Owner

@netblue30 commented on GitHub (Jan 16, 2016):

I've merged your patch, thanks!

<!-- gh-comment-id:172210956 --> @netblue30 commented on GitHub (Jan 16, 2016): I've merged your patch, thanks!
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: github-starred/firejail#160
No description provided.