public inbox for util-linux@vger.kernel.org
 help / color / mirror / Atom feed
From: Kiran Rangoon <kiranrangoon0@gmail.com>
To: util-linux@vger.kernel.org
Cc: kzak@redhat.com, Kiran Rangoon <kiranrangoon0@gmail.com>
Subject: [Patch V2 0/4] unshare: fix signal forwarding to child processes
Date: Tue, 13 Jan 2026 12:29:38 -0500	[thread overview]
Message-ID: <20260113172942.10678-1-kiranrangoon0@gmail.com> (raw)
In-Reply-To: <3tysdpabjulwlmr3hkm4pr7romwtf6cofhghth7buyuxnmwr5r@pliehv2xicmy>

Changes in V2 (responding to feedback from karelzak):
- Made signal forwarding opt-in via new --forward-signals flag
- Preserves default behavior (signals blocked) for backward compatibility
- Addresses concerns from PR #1087 about "impatient parent" problem

This adds --forward-signals to enable graceful shutdown of child processes
during system reboot. Since util-linux 2.36, unshare blocks SIGTERM/SIGINT
to prevent premature parent exit, but this prevents children from receiving
shutdown signals for cleanup.

The new flag installs signal handlers instead of blocking, forwards signals
to the child, and properly handles EINTR in waitpid(). Includes tests for
basic forwarding and --kill-child compatibility.


Kiran Rangoon (4):
  unshare: add --forward-signals option to argument parser
  unshare: implement signal forwarding when --forward-signals is used
  unshare: document --forward-signals in man page
  tests: add tests for unshare --forward-signals

 sys-utils/unshare.1.adoc                      | 13 ++++
 sys-utils/unshare.c                           | 67 +++++++++++++++++--
 tests/expected/unshare/forward-signals        |  1 +
 .../unshare/forward-signals-kill-child        |  1 +
 tests/ts/unshare/forward-signals              | 55 +++++++++++++++
 tests/ts/unshare/forward-signals-kill-child   | 56 ++++++++++++++++
 6 files changed, 186 insertions(+), 7 deletions(-)
 create mode 100644 tests/expected/unshare/forward-signals
 create mode 100644 tests/expected/unshare/forward-signals-kill-child
 create mode 100755 tests/ts/unshare/forward-signals
 create mode 100755 tests/ts/unshare/forward-signals-kill-child

-- 
2.47.3


  reply	other threads:[~2026-01-13 17:29 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-08 18:31 [PATCH 0/5] unshare: fix signal forwarding to child processes Kiran Rangoon
2026-01-08 18:31 ` [PATCH 1/5] unshare: add global child_pid variable for signal forwarding Kiran Rangoon
2026-01-08 18:31 ` [PATCH 2/5] unshare: add signal forwarding handler Kiran Rangoon
2026-01-08 18:31 ` [PATCH 3/5] unshare: replace signal blocking with signal handlers Kiran Rangoon
2026-01-08 18:31 ` [PATCH 4/5] unshare: store child PID in global variable Kiran Rangoon
2026-01-08 18:31 ` [PATCH 5/5] unshare: handle EINTR in waitpid loop Kiran Rangoon
2026-01-12 14:05 ` [PATCH 0/5] unshare: fix signal forwarding to child processes Karel Zak
2026-01-13 17:29   ` Kiran Rangoon [this message]
2026-01-13 17:29     ` [V2 1/4] unshare: add --forward-signals option to argument parser Kiran Rangoon
2026-01-13 17:29     ` [V2 2/4] unshare: implement signal forwarding when --forward-signals is used Kiran Rangoon
2026-01-13 17:29     ` [V2 3/4] unshare: document --forward-signals in man page Kiran Rangoon
2026-01-13 17:29     ` [V2 4/4] tests: add tests for unshare --forward-signals Kiran Rangoon
2026-01-16 17:06       ` [PATCH V3 0/4] unshare: add --forward-signals option Kiran Rangoon
2026-01-16 17:06         ` [Patch V3 1/4] unshare: add --forward-signals option to argument parser Kiran Rangoon
2026-01-16 17:06         ` [Patch V3 2/4] unshare: implement signal forwarding when --forward-signals is used Kiran Rangoon
2026-01-16 17:06         ` [Patch V3 3/4] unshare: document --forward-signals in man page Kiran Rangoon
2026-01-16 17:06         ` [Patch V3 4/4] tests: add tests for unshare --forward-signals Kiran Rangoon
2026-01-21  8:37         ` [PATCH V3 0/4] unshare: add --forward-signals option Karel Zak

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260113172942.10678-1-kiranrangoon0@gmail.com \
    --to=kiranrangoon0@gmail.com \
    --cc=kzak@redhat.com \
    --cc=util-linux@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox