Code Monkey home page Code Monkey logo

Comments (5)

joshmyzie2 avatar joshmyzie2 commented on June 6, 2024

This workaround seems to do what I wanted:

cmd="bwrap ..."
setsid sh -c "$cmd; kill -s KILL -- -\$\$"

Feels free to close this ticket if it doesn't make sense to add this to bubblewrap.

from bubblewrap.

alexlarsson avatar alexlarsson commented on June 6, 2024

The origin of the bwrap code comes from flatpak, which doesn't need this feature (because in general you don't know if the "main" process is the app or if it forks one. However, technically there is no reason you could not implement this feature.

In particular, if you use --unshare-pid then every process of the sandbox is guaranteed by the kernel to die when pid 1 in the sandbox dies. The pid1 code already detects when the initial process dies and could easilty be made to optionally die at that point.

from bubblewrap.

cgwalters avatar cgwalters commented on June 6, 2024

I think we should also add --bind-lifecycle-parent which does PR_SET_PDEATHSIG in the init process. That would be convenient for test suites, then you can do e.g. bwrap --blah inside a make check suite, and you'd be guaranteed the test containers die when make does.

from bubblewrap.

cgwalters avatar cgwalters commented on June 6, 2024

Otherwise, yeah, using --unshare-pid should suffice for this? In the latest version we'd recommend --unshare-all.

from bubblewrap.

cgwalters avatar cgwalters commented on June 6, 2024

I took a quick stab at using PDEATHSIG but it doesn't appear to work with a pid namespace. We'd need an "outer init" process outside the namespace.

from bubblewrap.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.