Commit Graph

9 Commits

Author SHA1 Message Date
Chris Down 0d5840a6c2 kill: Support mandating the presence of a userspace signal handler
In production we've had several incidents over the years where a process
has a signal handler registered for SIGHUP or one of the SIGUSR signals
which can be used to signal a request to reload configs, rotate log
files, and the like. While this may seem harmless enough, what we've
seen happen repeatedly is something like the following:

1. A process is using SIGHUP/SIGUSR[12] to request some
   application-handled state change -- reloading configs, rotating a log
   file, etc;
2. This kind of request is deprecated and removed, so the signal handler
   is removed. However, a site where the signal might be sent from is
   missed (often logrotate or a service manager);
3. Because the default disposition of these signals is terminal, sooner
   or later these applications are going to be sent SIGHUP or similar
   and end up unexpectedly killed.

I know for a fact that we're not the only organistion experiencing this:
in general, signal use is pretty tricky to reason about and safely
remove because of the fairly aggressive SIG_DFL behaviour for some
common signals, especially for SIGHUP which has a particularly ambiguous
meaning. Especially in a large, highly interconnected codebase,
reasoning about signal interactions between system configuration and
applications can be highly complex, and it's inevitable that on occasion
a callsite will be missed.

In some cases the right call to avoid this will be to migrate services
towards other forms of IPC for this purpose, but inevitably there will
be some services which must continue using signals, so we need a safe
way to support them.

This patch adds support for the -r/--require-handler flag, which checks
if a userspace handler is present for the signal being sent. If it is
not, the process will be skipped.

With this flag we can enforce that all SIGHUP reload cases and SIGUSR
equivalents use --require-handler. This effectively mitigates the case
we've seen time and time again where SIGHUP is used to rotate log files
or reload configs, but the sending site is mistakenly left present after
the removal of signal handler, resulting in unintended termination of
the process.

Signed-off-by: Chris Down <chris@chrisdown.name>
2023-02-17 15:01:28 +08:00
Karel Zak 38835adcca lsblk: fix endless loop if device specified more than once
Fixes: https://github.com/util-linux/util-linux/issues/1814
Signed-off-by: Karel Zak <kzak@redhat.com>
2023-02-17 15:01:11 +08:00
Karel Zak a29f1fcdf0 uuidd: fix random UUIDs
Commit f27876f introduces copy & past bug and replaces
__uuid_generate_random() with __uuid_generate_time().

Fixes: https://github.com/util-linux/util-linux/issues/1837
Signed-off-by: Karel Zak <kzak@redhat.com>
2023-02-17 15:00:01 +08:00
Michael Trapp 03b7962e80 libuuid: Implement continuous clock handling for time based UUIDs
In a uuidd setup, the daemon is a singleton and can maintain it's own
resources for time based UUID generation. This requires a dedicated
'clock sequence range' but does not need any further lock/update of
the LIBUUID_CLOCK_FILE from uuidd. The range of available clock values
is extended by a continuous handling of the clock updates - instead of
updating the value to the current timestamp, it is incremented by
the number of requested UUIDs.
2023-02-17 14:59:41 +08:00
Chris Hofstaedtler c118fad68b Install lsfd into /usr/bin 2023-02-17 14:59:04 +08:00
Matthew Vernon 4d3a306bab util-linux: getopt(1) should point to where examples are on a Debian system
Debian BTS #913049
2023-02-17 14:47:16 +08:00
su-fang e72d587bc0 merge upstream 2.38.1 2023-02-17 14:33:46 +08:00
Karel Zak f29e698f8a lsblk: force to print PKNAME for partition
PKNAME (parent kernel device name) is based on printed tree according
to parent -> child relationship. The tree is optional and not printed
if partition specified (.e.g "lsblk -o+PKNAME /dev/sda1"), but old
versions print the PKNAME also in this case.

Addresses: https://github.com/karelzak/util-linux/issues/813
Signed-off-by: Karel Zak <kzak@redhat.com>

Gbp-Pq: Name lsblk-force-to-print-PKNAME-for-partition.patch
2022-05-14 03:14:50 +08:00
openKylinBot fa45c7ac50 Import Upstream version 2.34 2022-05-14 03:14:32 +08:00