diff options
| author | David Gibson <david@gibson.dropbear.id.au> | 2025-12-11 14:54:36 +1100 |
|---|---|---|
| committer | Stefano Brivio <sbrivio@redhat.com> | 2025-12-12 22:23:14 +0100 |
| commit | 87f1a917d881d0881d6db5fdc2345f345a0e30d1 (patch) | |
| tree | 95df41d4baea3efe1113911da0985e5ff06adb08 /test/lib | |
| parent | e6612fe0a7cf4860b0d81d3b886f95273d979d1d (diff) | |
| download | passt-87f1a917d881d0881d6db5fdc2345f345a0e30d1.tar passt-87f1a917d881d0881d6db5fdc2345f345a0e30d1.tar.gz passt-87f1a917d881d0881d6db5fdc2345f345a0e30d1.tar.bz2 passt-87f1a917d881d0881d6db5fdc2345f345a0e30d1.tar.lz passt-87f1a917d881d0881d6db5fdc2345f345a0e30d1.tar.xz passt-87f1a917d881d0881d6db5fdc2345f345a0e30d1.tar.zst passt-87f1a917d881d0881d6db5fdc2345f345a0e30d1.zip | |
pasta: Clean up waiting pasta child on failures
When pasta is invoked with a command rather than an existing namespace to
attach to, it spawns a child process to run a shell or other command. We
create that process during conf(), since we need the namespace to exist for
much of our setup. However, we don't want the specified command to run
until the pasta network interface is ready for use. Therefore,
pasta_spawn_cmd() executing in the child waits before exec()ing. main()
signals the child to continue with SIGUSR1 shortly before entering the
main forwarding loop.
This has the downside that if we exit due to any kind of failure between
conf() and the SIGUSR1, the child process will be around waiting
indefinitely. The user must manually clean this up.
Make this cleaner, by having the child use PR_SET_PDEATHSIG to have
itself killed if the parent dies during this window. Technically
speaking this is racy: if the parent dies before the child can call
the prctl() it will be left zombie-like as before. However, as long
as the parent completes pasta_wait_for_ns() before dying, I wasn't
able to trigger the race. Since the consequences of this going wrong
are merely a bit ugly, I think that's good enough.
Suggested-by: Paul Holzinger <pholzing@redhat.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Reviewed-by: Paul Holzinger <pholzing@redhat.com>
Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
Diffstat (limited to 'test/lib')
0 files changed, 0 insertions, 0 deletions
