Skip to content

Sio2jail leaves zombie processes #33

@otargowski

Description

@otargowski

This can be observed (seems like at least on master and all sandboxed releases from 1.1.0 above) by:

  1. Compiling a simple executable, like main(){}
  2. Adding sth like this:
--- a/src/sio2jail.cc
+++ b/src/sio2jail.cc
@@ -2,10 +2,14 @@
 #include "s2japp/Application.h"
 
 #include <iostream>
+#include <sys/wait.h>
 
 int main(int argc, const char* argv[]) {
     try {
-        return s2j::app::Application(argc, argv).main();
+        int ret = s2j::app::Application(argc, argv).main();
+        while (wait(NULL)>0)
+            std::cerr << "bruh";
+        return ret;
     }
     catch (const std::exception& ex) {
         std::cerr << "Exception occurred: " << ex.what() << std::endl;
  1. Building and running sio2jail with arbitrary (?) args, for example --mount-namespace off ~/a; adding -t 1 gives the same result
  2. Witnessing the bruh

Alternatively, one can add sleep(100) before the while and check htop or sth of this nature.

One way to fix this is executing the while from above silently, though that may be more of a workaround than an actual solution.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions