Compare commits

...

4 Commits

Author SHA1 Message Date
Yu Watanabe 403e4b4728
Merge pull request #14160 from mwilck/fix-shutdown-hang
Fix shutdown hang caused by recent udev change
2019-11-27 19:16:12 +09:00
Paul Menzel a19b9a3827 man/systemd.link: Add missing verb *be* 2019-11-27 13:35:29 +09:00
Martin Wilck 030f457167 udevd: don't use monitor after manager_exit()
If udevd receives an exit signal, it releases its reference on the udev
monitor in manager_exit(). If at this time a worker is hanging, and if
the event timeout for this worker expires before udevd exits, udevd
crashes in on_sigchld()->udev_monitor_send_device(), because the monitor
has already been freed.

Fix this by testing the validity of manager->monitor in on_sigchld().
2019-11-26 20:38:28 +01:00
Martin Wilck 3cabdc2345 Revert "udevd: fix crash when workers time out after exit is signal caught"
This reverts commit 5db454b803.
See https://github.com/systemd/systemd/issues/14128
2019-11-26 20:38:28 +01:00
2 changed files with 9 additions and 7 deletions

View File

@ -668,7 +668,7 @@ MACAddress=00:a0:de:63:7a:e6
Name=dmz0</programlisting>
<para><varname>NamePolicy=</varname> is not set, so <varname>Name=</varname> takes effect. We use the
<literal>10-</literal> prefix to order this file early in the list. Note that it needs to before
<literal>10-</literal> prefix to order this file early in the list. Note that it needs to be before
<literal>99-link</literal>, i.e. it needs a numerical prefix, to have any effect at all.</para>
</example>

View File

@ -293,8 +293,6 @@ static void manager_free(Manager *manager) {
if (!manager)
return;
manager->monitor = sd_device_monitor_unref(manager->monitor);
udev_builtin_exit();
if (manager->pid == getpid_cached())
@ -791,6 +789,8 @@ static void manager_exit(Manager *manager) {
manager->inotify_event = sd_event_source_unref(manager->inotify_event);
manager->fd_inotify = safe_close(manager->fd_inotify);
manager->monitor = sd_device_monitor_unref(manager->monitor);
/* discard queued events and kill workers */
event_queue_cleanup(manager, EVENT_QUEUED);
manager_kill_workers(manager);
@ -1311,11 +1311,13 @@ static int on_sigchld(sd_event_source *s, const struct signalfd_siginfo *si, voi
device_delete_db(worker->event->dev);
device_tag_index(worker->event->dev, NULL, false);
if (manager->monitor) {
/* forward kernel event without amending it */
r = device_monitor_send_device(manager->monitor, NULL, worker->event->dev_kernel);
if (r < 0)
log_device_error_errno(worker->event->dev_kernel, r, "Failed to send back device to kernel: %m");
}
}
worker_free(worker);
}