Commit Graph

42438 Commits

Author SHA1 Message Date
Lennart Poettering e544601536 sd-event: refuse running default event loops in any other thread than the one they are default for 2019-12-04 10:36:28 +01:00
Lennart Poettering 8089643328 man: document the new sd-event pidfd magic 2019-12-04 10:36:10 +01:00
Lennart Poettering b350807200 man: mention that SIGCHLD has to be blocked before using sd_event_add_child() 2019-12-04 10:35:56 +01:00
Lennart Poettering 68765d94fe man: don't claim we'd unblock the specified signal in sd_event_add_signal()
We don't, the signal remains blocked. We use signalfd() to be able to
read the signal events without unblocking the signal.

While we are at it, mention that pthread_sigmask() is fine too.
2019-12-04 10:35:42 +01:00
Lennart Poettering 3ecb3bdc93 test: add test for pidfd support in sd-event 2019-12-04 10:35:39 +01:00
Lennart Poettering ee880b37c1 sd-event: refuse sd_event_add_child() if SIGCHLD is not blocked
We already refuse sd_event_add_signal() if the specified signal is not
blocked, let's do this also for sd_event_add_child(), since we might
need signalfd() to implement this, and this means the signal needs to be
blocked.
2019-12-04 10:35:27 +01:00
Lennart Poettering d1b75241ba sd-event: make use of new signal_is_blocked() helper 2019-12-04 10:35:16 +01:00
Lennart Poettering 90b15e18ee signal-util: add new helper signal_is_blocked() 2019-12-04 10:35:01 +01:00
Lennart Poettering f8f3f9263e sd-event: add pidfd support
This adds support for watching for process exits via Linux new pidfd
concept. This makes watching processes and killing them race-free if
properly used, fixing a long-standing UNIX misdesign.

This patch adds implicit and explicit pidfd support to sd-event: if a
process shall be watched and is specified by PID we will now internally
create a pidfd for it and use that, if available. Alternatively a new
constructor for child process event sources is added that takes pidfds
as input.

Besides mere watching of child processes via pidfd two additional
features are added:

→ sd_event_source_send_child_signal() allows sending a signal to the
  process being watched in the safest way possible (wrapping
  the new pidfd_send_signal() syscall).

→ sd_event_source_set_child_process_own() allows marking a process
  watched for destruction as soon as the event source is freed. This is
  currently implemented in userspace, but hopefully will become a kernel
  feature eventually.

Altogether this means an sd_event_source object is now a safe and stable
concept for referencing processes in race-free way, with automatic
fallback to pre-pidfd kernels.

Note that this patch adds support for this only to sd-event, not to PID
1. That's because PID 1 needs to use waitid(P_ALL) for reaping any
process that might get reparented to it. This currently semantically
conflicts with pidfd use for watching processes since we P_ALL is
undirected and thus might reap process earlier than the pidfd notifies
process end, which is hard to handle. The kernel will likely gain a
concept for excluding specific pidfds from P_ALL watching, as soon as
that is around we can start making use of this in PID 1 too.
2019-12-04 10:34:41 +01:00
Lennart Poettering 298f466f15 process-util: add helper pidfd_get_pid()
It returns the pid_t a pidfd refers to.
2019-12-04 10:34:26 +01:00
Lennart Poettering 5ead4e85f6 missing: add rt_sigqueueinfo() syscall definition
This is not a new system call at all (since kernel 2.2), however it's
not exposed in glibc (a wrapper is exposed however in sigqueue(), but it
substantially simplifies the system call). Since we want a nice fallback
for sending signals on non-pidfd systems for pidfd_send_signal() let's
wrap rt_sigqueueinfo() since it takes the same siginfo_t parameter.
2019-12-04 10:34:03 +01:00
Lennart Poettering 5f152f43d0 missing: define new pidfd syscalls 2019-12-04 10:33:41 +01:00
Lennart Poettering 5a795bff38 sd-event: (void)ify some epoll_ctl() syscall invocations 2019-12-04 10:33:38 +01:00
Lennart Poettering d1cf202374 sd-event: drop unnecessary local variable 2019-12-04 10:32:59 +01:00
Paul Davey 9f537ae310 udev: Ensure udev_event_spawn reads stdout
When running the program with udev_event_spawn it is possible to miss
output in stdout when the program exits causing the result to be empty
which can cause rules using the result to not function correctly.

This is due to the on_spawn_sigchld callback being processed while IO is
still pending and causing the event loop to exit.

To correct this the sigchld event source is made a lower priority than
the other event sources to ensure it is processed after IO.  This
requires changing the IO event source to oneshot and re-enabling it when
valid data is read but not for EOF, this prevents the empty pipes
constantly generating IO events.
2019-12-04 10:31:37 +01:00
Lennart Poettering eaadc03d61
Merge pull request #14133 from keur/clear_ambient_inherited
Clear ambient inherited
2019-12-04 10:30:58 +01:00
Lennart Poettering b51d61fec6
Merge pull request #14177 from keszybz/use-initrd.target
Use initrd.target in the initramfs
2019-12-04 10:30:32 +01:00
Christian Göttsche a9dfac21ec core: reload SELinux label cache on daemon-reload
Reloading the SELinux label cache here enables a light-wight follow-up of a SELinux policy change, e.g. adding a label for a RuntimeDirectory.

Closes: #13363
2019-12-04 10:29:46 +01:00
Lennart Poettering 97a3e8d582
Merge pull request #14189 from cgzones/selinux_tmpfiles
Selinux tmpfiles
2019-12-04 10:29:22 +01:00
Lennart Poettering 68d58f3869 pid1: add new kernel cmdline arg systemd.cpu_affinity=
Let's allow configuration of the CPU affinity via the kernel cmdline,
overriding CPUAffinity= in /etc/systemd/system.conf

Prompted by:

https://lists.freedesktop.org/archives/systemd-devel/2019-November/043754.html
2019-12-04 10:28:43 +01:00
Raphael 6355715e5b Fix DPI for MX Master 2s bluetooth mouse
Mouse behaviour is unusably slow disregardless of mouse speed settings.
2019-12-04 09:23:57 +01:00
Jérémy Rosen a652f050a7 Create parent directories when creating systemd-private subdirs
This is needed when systemd is compiled without systemd-tmpfiles
2019-12-04 09:22:52 +01:00
Zbigniew Jędrzejewski-Szmek 206056cf01
Merge pull request #14211 from yuwata/support-nlmsgerr_attr_msg
Support NLMSGERR_ATTR_MSG
2019-12-04 09:15:23 +01:00
Yu Watanabe e813de549b network: do not return error but return UINT64_MAX if speed meter is disabled
Fixes #14222.
2019-12-04 09:11:34 +01:00
lothrond cfd54b6a2e Alienware M17xR3 ejectcd button fix 2019-12-04 09:10:45 +01:00
Topi Miettinen 7477451b69 core: swap priority can be negative
Negative priorities are useful for swap targets which should be only used as
last resort.
2019-12-04 08:57:08 +01:00
xduugu 09e4b620e7 hwdb: Set trackball property for Logitech MX Ergo (#14231) 2019-12-04 09:32:50 +10:00
Yu Watanabe 33ebda2e81 networkctl: fix to show BSSID
This fixes an issue caused by a typo in
78404d22cc.
2019-12-03 20:00:05 +01:00
Zbigniew Jędrzejewski-Szmek 2fec5854ba systemctl: enhance message about kexec missing kernel
Fixes #7730.
2019-12-03 17:15:44 +01:00
Zbigniew Jędrzejewski-Szmek 6a2dc6a040 TODO: remove obsolete entries 2019-12-03 17:15:44 +01:00
Zbigniew Jędrzejewski-Szmek 23e5e79a51 initrd: fix systemd.debug-shell & friends
They would get assigned to an inactive target in the initramfs.
2019-12-03 14:48:27 +01:00
Slava Kardakov 1e904320aa Fixup typo in NEWS 2019-12-03 08:02:24 +09:00
Lennart Poettering cb51560803
Merge pull request #14216 from jwrdegoede/hwdb-teclast-sensors
hwdb: sort Teclast sensors entries and add a new quirk for the Teclast X89
2019-12-02 09:58:31 +01:00
Hans de Goede d0d7f11ca2 hwdb: Add accel orientation quirk for Teclast X89 tablet
Add a quirk to fix the accelerometer orientation on the Teclast X89 tablet.
2019-12-01 15:56:26 +01:00
Hans de Goede 3b681ace37 hwdb: Sort 60-sensor.hwdb Teclast entries alphabetically
Sort 60-sensor.hwdb Teclast entries alphabetically (by model name),
and add a comment with the model name to the few entries which were
missing this.
2019-12-01 15:56:26 +01:00
Michael Biebl 6d8f06368b semaphore: switch branch to debian/master 2019-11-30 19:05:53 +01:00
Yu Watanabe 5ecb131d94 network: include NLMSGERR_ATTR_MSG attribute in error message 2019-11-30 16:14:02 +09:00
Yu Watanabe e4a1e68d7a sd-netlink: support NLMSGERR_ATTR_MSG
From v4.12 the kernel appends some attributes to netlink acks
containing a textual description of the error and other fields.
This makes sd-netlink parse the attributes.
2019-11-30 16:13:51 +09:00
Lennart Poettering 0e7e854471 update TODO 2019-11-29 17:50:12 +01:00
Zbigniew Jędrzejewski-Szmek db9c5ae73e
Merge pull request #14201 from poettering/v244-final
V244 final
2019-11-29 17:32:36 +01:00
afg c152a2ba54 nspawn: allow Capability=all in systemd.nspawn [EXEC] section
Just like --capability=all is allowed in the systemd-nspawn
command line.
2019-11-29 14:42:27 +01:00
Lennart Poettering 78b2bb4eef hwdb: run another 'hwdb-update' 2019-11-29 14:35:54 +01:00
Lennart Poettering 8bf2a311f3 NEWS: update for final 244 2019-11-29 14:29:03 +01:00
Lennart Poettering dd08aa6488 README: move logo up, like on brand.systemd.io README 2019-11-29 12:57:22 +01:00
Lennart Poettering dc2d00962b README: use more appropriate logo format for README 2019-11-29 12:54:01 +01:00
Lennart Poettering 173c78739b update TODO 2019-11-29 12:54:01 +01:00
Zbigniew Jędrzejewski-Szmek 2b1daf24dc man: document initrd.target 2019-11-28 19:59:33 +01:00
Zbigniew Jędrzejewski-Szmek 8755dbad5b pid1: use initrd.target in the initramfs by default
This makes the code do what the documentation says. The code had no inkling
about initrd.target, so I think this change is fairly risky. As a fallback,
default.target will be loaded, so initramfses which relied on current behaviour
will still work, as along as they don't have a different initrd.target.

In an initramfs created with recent dracut:
$ ls -l usr/lib/systemd/system/{default.target,initrd.target}
lrwxrwxrwx. usr/lib/systemd/system/default.target -> initrd.target
-rw-r--r--. usr/lib/systemd/system/initrd.target
So at least for dracut, there should be no difference.

Also avoid a pointless allocation.
2019-11-28 19:59:33 +01:00
Yu Watanabe 3db7d5d2bf network: fix double free() 2019-11-28 19:50:45 +01:00
Yu Watanabe e681a2ee4d man: use literal tag at one more place 2019-11-28 19:50:12 +01:00