platform/upstream/systemd.git
5 years agotests: Add capability tests for ProtectKernelLogs
Kevin Kuehler [Tue, 5 Nov 2019 01:20:47 +0000 (17:20 -0800)]
tests: Add capability tests for ProtectKernelLogs

5 years agocore: Add ProtectKernelLogs
Kevin Kuehler [Tue, 5 Nov 2019 01:18:42 +0000 (17:18 -0800)]
core: Add ProtectKernelLogs

If seccomp is enabled, load the SYSCALL_FILTER_SET_SYSLOG into the
seccomp filter set. Drop the CAP_SYSLOG capability.

5 years agoshared: Add ProtectKernelLogs property
Kevin Kuehler [Tue, 5 Nov 2019 01:17:01 +0000 (17:17 -0800)]
shared: Add ProtectKernelLogs property

Add seccomp_protect_syslog, which adds a filter rule for the syslog
system call.

5 years agojournal-file: delete some unnecessary braces
Vito Caputo [Sun, 10 Nov 2019 07:00:19 +0000 (23:00 -0800)]
journal-file: delete some unnecessary braces

Trivial change, just something I noticed skimming the code.

5 years agoMerge pull request #13975 from keszybz/more-seccomp-syscalls
Yu Watanabe [Sat, 9 Nov 2019 14:27:34 +0000 (23:27 +0900)]
Merge pull request #13975 from keszybz/more-seccomp-syscalls

Add more syscalls to the seccomp lists

5 years agoshared/sleep-config: fix potential SEGV
Zbigniew Jędrzejewski-Szmek [Fri, 8 Nov 2019 09:25:31 +0000 (10:25 +0100)]
shared/sleep-config: fix potential SEGV

We were looking at the wrong variable, and would always crash if this
comparison was reached. Fixes #13965.

Also, fix crash (_cleanup_ called on uninitialized variable) if we failed in
error path.

While at it, let's shorten some messages.

5 years agoAdd @pkey syscall group
Zbigniew Jędrzejewski-Szmek [Fri, 8 Nov 2019 11:56:56 +0000 (12:56 +0100)]
Add @pkey syscall group

Inspired by https://bugzilla.redhat.com/show_bug.cgi?id=1769299.
This change doesn't solve the issue, but makes it easier to whitelist the
syscall group.

5 years agoseccomp: add all *time64 syscalls
Zbigniew Jędrzejewski-Szmek [Fri, 8 Nov 2019 13:00:10 +0000 (14:00 +0100)]
seccomp: add all *time64 syscalls

From https://bugzilla.redhat.com/show_bug.cgi?id=1770154:
> utime is an obsolete system call. The current kernel interface is
> utimensat_time64. New 32-bit architectures do not even provide the utime
> system call.

Also add all other *time64 syscalls listed in
https://fedora.juszkiewicz.com.pl/syscalls.html.

5 years agoMerge pull request #13554 from keur/systemctl_status_timer
Zbigniew Jędrzejewski-Szmek [Fri, 8 Nov 2019 13:19:40 +0000 (14:19 +0100)]
Merge pull request #13554 from keur/systemctl_status_timer

systemctl: Add timer activation to status

5 years agolibblkid: open device in nonblock mode.
Michal Suchanek [Mon, 4 Nov 2019 20:23:15 +0000 (21:23 +0100)]
libblkid: open device in nonblock mode.

When autoclose is set (kernel default but many distributions reverse the
setting) opening a CD-rom device causes the tray to close.

The function of blkid is to report the current state of the device and
not to change it. Hence it should use O_NONBLOCK when opening the
device to avoid closing a CD-rom tray.

blkid is used liberally in scripts so it can potentially interfere with
the user operating the CD-rom hardware.

[kzak@redhat.com: add O_NONBLOCK also to:
                  - wipefs
                  - blkid_new_probe_from_filename()
                  - blkid_evaluate_tag()]

Signed-off-by: Michal Suchanek <msuchanek@suse.de>
Signed-off-by: Karel Zak <kzak@redhat.com>
(cherry picked from commit 39f5af25982d8b0244000e92a9d0e0e6557d0e17)

5 years agoMerge pull request #13962 from keszybz/man-ordering
Zbigniew Jędrzejewski-Szmek [Fri, 8 Nov 2019 09:18:46 +0000 (10:18 +0100)]
Merge pull request #13962 from keszybz/man-ordering

Describe ordering in case of Conflicts=

5 years agoman: describe ordering in case of Conflicts=
Zbigniew Jędrzejewski-Szmek [Wed, 6 Nov 2019 12:42:13 +0000 (13:42 +0100)]
man: describe ordering in case of Conflicts=

Fixes #13421.

5 years agodoc: Fix missing parenthesis
Alcaro [Thu, 7 Nov 2019 13:19:18 +0000 (14:19 +0100)]
doc: Fix missing parenthesis

5 years agoinclude missing_fcntl.h where needed
Anita Zhang [Thu, 7 Nov 2019 06:25:43 +0000 (22:25 -0800)]
include missing_fcntl.h where needed

f5947a5e925117c55b390460d592f57504277bf9 dropped missing.h and
replaced with the more specific headers but did not add
missing_fcntl.h in places that use O_TMPFILE. This is needed for
some older versions of glibc.

5 years agoMerge pull request #13904 from keur/job_mode_triggering
Zbigniew Jędrzejewski-Szmek [Thu, 7 Nov 2019 07:36:26 +0000 (08:36 +0100)]
Merge pull request #13904 from keur/job_mode_triggering

Job mode triggering

5 years agocore: change top-level drop-in from -.service.d to service.d
Anita Zhang [Tue, 5 Nov 2019 02:29:55 +0000 (18:29 -0800)]
core: change top-level drop-in from -.service.d to service.d

Discussed in #13743, the -.service semantic conflicts with the
existing root mount and slice names, making this feature not
uniformly extensible to all types. Change the name to be
<type>.d instead.

Updating to this format also extends the top-level dropin to
unit types.

5 years agoman: put description of Wants= above Requires=
Zbigniew Jędrzejewski-Szmek [Wed, 6 Nov 2019 12:26:29 +0000 (13:26 +0100)]
man: put description of Wants= above Requires=

We want users to use Wants, but we'd describe Requires first and ask users to
look for Wants instead. While at it, let's split the wall of text into sensible
paragraphs: syntax first, followed by semantics and longer description, and
finally hints and comparison to other configuration items last.

5 years agoMerge pull request #13960 from keszybz/meson-loop-fix
Anita Zhang [Wed, 6 Nov 2019 19:44:09 +0000 (11:44 -0800)]
Merge pull request #13960 from keszybz/meson-loop-fix

meson: remove strange dep that causes meson to enter infinite loop

5 years agoman: fix option typo in pam_systemd man page
Dominique Martinet [Wed, 6 Nov 2019 06:32:17 +0000 (07:32 +0100)]
man: fix option typo in pam_systemd man page

The session= option does not exist, XDG_SESSION_TYPE overrides the type=
option.

5 years agomeson: remove strange dep that causes meson to enter infinite loop
Zbigniew Jędrzejewski-Szmek [Wed, 6 Nov 2019 11:44:39 +0000 (12:44 +0100)]
meson: remove strange dep that causes meson to enter infinite loop

The value is obviously bogus, but didn't seem to cause problems so far.
With meson-0.52.0, it causes a hang. The number of aliases is always rather
small (usually just one or two, possibly up to a dozen in a few cases), so
even if this causes some looping, it is strange that it has such a huge impact.
But let's just remove it.

Fixes #13742.

Tested with meson-0.52.0-1.module_f31+6771+f5d842eb.noarch,
meson-0.51.1-1.fc29.noarch.

5 years agoman: save pull-raw example file without underscores
Anita Zhang [Wed, 6 Nov 2019 00:04:27 +0000 (16:04 -0800)]
man: save pull-raw example file without underscores

Destination file needs to be a valid hostname and underscores
are not valid hostname characters.

Closes #13542

5 years agoman: small grammatical/word choice fixes to crypttab man page
Anita Zhang [Wed, 6 Nov 2019 00:20:42 +0000 (16:20 -0800)]
man: small grammatical/word choice fixes to crypttab man page

Closes #13608

5 years agoMerge pull request #13936 from keszybz/format-table-uninhibited
Anita Zhang [Tue, 5 Nov 2019 23:03:15 +0000 (15:03 -0800)]
Merge pull request #13936 from keszybz/format-table-uninhibited

Output tables at full width if piped

5 years agoMerge pull request #13944 from yuwata/network-split-struct-prefix
Anita Zhang [Tue, 5 Nov 2019 23:02:01 +0000 (15:02 -0800)]
Merge pull request #13944 from yuwata/network-split-struct-prefix

network: split struct Prefix into Prefix and RoutePrefix

5 years agosd-device-enumerator: do not return error when a device is removed
Yu Watanabe [Tue, 5 Nov 2019 14:02:31 +0000 (23:02 +0900)]
sd-device-enumerator: do not return error when a device is removed

Fixes #13814.

5 years agosystemctl: simplify printing of Triggers/TriggeredBy
Zbigniew Jędrzejewski-Szmek [Tue, 5 Nov 2019 21:01:46 +0000 (22:01 +0100)]
systemctl: simplify printing of Triggers/TriggeredBy

5 years agosystemctl: Align all status outputs to TriggeredBy
Kevin Kuehler [Mon, 4 Nov 2019 22:52:13 +0000 (14:52 -0800)]
systemctl: Align all status outputs to TriggeredBy

5 years agosystemctl: Add TriggeredBy and Triggers to status
Kevin Kuehler [Mon, 4 Nov 2019 22:48:06 +0000 (14:48 -0800)]
systemctl: Add TriggeredBy and Triggers to status

For all units that aren't timers, if it is activated by another unit,
add the triggering unit under the  "TriggeredBy:" header. If a unit can
trigger other units, print the units it triggers other the "Triggers:"
header.

5 years agoman: Document --job-mode=triggering switch
Kevin Kuehler [Fri, 1 Nov 2019 08:47:37 +0000 (01:47 -0700)]
man: Document --job-mode=triggering switch

5 years agocore: Add triggering job mode
Kevin Kuehler [Fri, 1 Nov 2019 07:54:03 +0000 (00:54 -0700)]
core: Add triggering job mode

When used with systemctl stop, follows TRIGGERED_BY dependencies and
adds them to the same transaction.

Fixes: #3043

5 years agoshared/format-table: disable ellipsization when piped
Zbigniew Jędrzejewski-Szmek [Mon, 4 Nov 2019 13:59:31 +0000 (14:59 +0100)]
shared/format-table: disable ellipsization when piped

Fixes #13461.

Before:
$ systemd-inhibit --no-pager
WHO            UID  USER    PID   COMM           WHAT                                  WHY          MODE
ModemManager   0    root    1093  ModemManager   sleep                                 ModemManage… delay
NetworkManager 0    root    1400  NetworkManager sleep                                 NetworkMana… delay
UPower         0    root    5141  upowerd        sleep                                 Pause devic… delay
zbyszek        1000 zbyszek 10036 gsd-power      handle-lid-switch                     External mo… block
zbyszek        1000 zbyszek 10035 gsd-media-keys handle-power-key:handle-suspend-key:… GNOME handl… block
zbyszek        1000 zbyszek 10035 gsd-media-keys sleep                                 GNOME handl… delay
zbyszek        1000 zbyszek 10036 gsd-power      sleep                                 GNOME needs… delay

7 inhibitors listed.
$ systemd-inhibit --no-pager|grep suspend
$ systemd-inhibit --no-pager|cat
WHO            UID  USER    PID   COMM           WHAT                WHY   MODE
ModemManager   0    root    1093  ModemManager   sleep               Mode… delay
NetworkManager 0    root    1400  NetworkManager sleep               Netw… delay
UPower         0    root    5141  upowerd        sleep               Paus… delay
zbyszek        1000 zbyszek 10036 gsd-power      handle-lid-switch   Exte… block
zbyszek        1000 zbyszek 10035 gsd-media-keys handle-power-key:h… GNOM… block
zbyszek        1000 zbyszek 10035 gsd-media-keys sleep               GNOM… delay
zbyszek        1000 zbyszek 10036 gsd-power      sleep               GNOM… delay

After:
$ build/systemd-inhibit --no-pager
(same as above)

$ build/systemd-inhibit --no-pager|grep suspend
zbyszek        1000 zbyszek 10035 gsd-media-keys handle-power-key:handle-suspend-key:handle-hibernate-key GNOME handling keypresses                                   block
$ build/systemd-inhibit --no-pager|cat
WHO            UID  USER    PID   COMM           WHAT                                                     WHY                                                         MODE
ModemManager   0    root    1093  ModemManager   sleep                                                    ModemManager needs to reset devices                         delay
NetworkManager 0    root    1400  NetworkManager sleep                                                    NetworkManager needs to turn off networks                   delay
UPower         0    root    5141  upowerd        sleep                                                    Pause device polling                                        delay
zbyszek        1000 zbyszek 10036 gsd-power      handle-lid-switch                                        External monitor attached or configuration changed recently block
zbyszek        1000 zbyszek 10035 gsd-media-keys handle-power-key:handle-suspend-key:handle-hibernate-key GNOME handling keypresses                                   block
zbyszek        1000 zbyszek 10035 gsd-media-keys sleep                                                    GNOME handling keypresses                                   delay
zbyszek        1000 zbyszek 10036 gsd-power      sleep                                                    GNOME needs to lock the screen                              delay

7 inhibitors listed.

Note that this affect all tools that use format-table.c: machinectl, busctl,
loginctl, systemd-analyze, networkctl, portablectl.

5 years agonetwork: split struct Prefix into Prefix and RoutePrefix
Yu Watanabe [Tue, 5 Nov 2019 13:31:20 +0000 (22:31 +0900)]
network: split struct Prefix into Prefix and RoutePrefix

5 years agoMerge pull request #13939 from yuwata/network-fix-memleak-and-13938
Yu Watanabe [Tue, 5 Nov 2019 11:16:06 +0000 (20:16 +0900)]
Merge pull request #13939 from yuwata/network-fix-memleak-and-13938

network: fix memleak and invalid free function

5 years agojournal: refresh cached credentials of stdout streams
Lorenz Bauer [Mon, 4 Nov 2019 16:35:46 +0000 (16:35 +0000)]
journal: refresh cached credentials of stdout streams

journald assumes that getsockopt(SO_PEERCRED) correctly identifies the
process on the remote end of the socket. However, this is incorrect
according to man 7 socket:

    The returned  credentials  are  those that were in effect at the
    time of the call to connect(2) or socketpair(2).

This becomes a problem when a new process inherits the stdout stream
from a parent. First, log messages from the child process will
be attributed to the parent. Second, the struct ucred used by journald
becomes invalid as soon as the parent exits. Further sendmsg calls then
fail with ENOENT. Logs for the child process then vanish from the journal.

Fix this by using recvmsg on the stdout stream, and refreshing the cached
struct ucred if SCM_CREDENTIALS indicate a new process.

Fixes #13708

5 years agohwdb: add XKB_FIXED_MODEL to the keyboard hwdb
Sebastian Wick [Thu, 31 Oct 2019 13:27:24 +0000 (14:27 +0100)]
hwdb: add XKB_FIXED_MODEL to the keyboard hwdb

Chromebook keyboards have a top row which generates f1-f10 key codes but
the keys have media symbols printed on them. A simple scan code to key
code mapping to the correct media keys makes the f1-f10 inaccessible. To
properly use the keyboard a custom key code to symbol mapping in xbk is
required (a variant of the chromebook xkb model is already upstream).
Other devices have similar problems.
This commit makes it possible to specify which xkb model should be used
for a specific device by setting XKB_FIXED_MODEL.

5 years agoMerge pull request #13935 from poettering/bootctl-random-seed-mkdir
Anita Zhang [Tue, 5 Nov 2019 06:57:12 +0000 (22:57 -0800)]
Merge pull request #13935 from poettering/bootctl-random-seed-mkdir

bootctl: create leading dirs when "bootctl random-seed" is called if …

5 years agosd-radv: fix memleak
Yu Watanabe [Tue, 5 Nov 2019 04:30:00 +0000 (13:30 +0900)]
sd-radv: fix memleak

5 years agotest: add testcase for issue #13938
Yu Watanabe [Tue, 5 Nov 2019 01:49:07 +0000 (10:49 +0900)]
test: add testcase for issue #13938

5 years agonetwork: fix memleak in route_prefix_free()
Yu Watanabe [Tue, 5 Nov 2019 01:46:44 +0000 (10:46 +0900)]
network: fix memleak in route_prefix_free()

5 years agonetwork: fix typo
Yu Watanabe [Tue, 5 Nov 2019 01:42:19 +0000 (10:42 +0900)]
network: fix typo

5 years agonetwork: fix invalid cleanup function
Yu Watanabe [Tue, 5 Nov 2019 01:39:15 +0000 (10:39 +0900)]
network: fix invalid cleanup function

5 years agonetwork: fix memleak
Yu Watanabe [Tue, 5 Nov 2019 00:39:44 +0000 (09:39 +0900)]
network: fix memleak

5 years agonetwork: use fix invalid free function
Yu Watanabe [Tue, 5 Nov 2019 00:36:39 +0000 (09:36 +0900)]
network: use fix invalid free function

Fixes #13938.

5 years agocore, job: fix breakage of ordering dependencies by systemctl reload command
HATAYAMA Daisuke [Mon, 28 Oct 2019 10:35:24 +0000 (19:35 +0900)]
core, job: fix breakage of ordering dependencies by systemctl reload command

Currently, systemctl reload command breaks ordering dependencies if it's
executed when its target service unit is in activating state.

For example, prepare A.service, B.service and C.target as follows:

    # systemctl cat A.service B.service C.target
    # /etc/systemd/system/A.service
    [Unit]
    Description=A

    [Service]
    Type=oneshot
    ExecStart=/usr/bin/echo A1
    ExecStart=/usr/bin/sleep 60
    ExecStart=/usr/bin/echo A2
    ExecReload=/usr/bin/echo A reloaded
    RemainAfterExit=yes

    # /etc/systemd/system/B.service
    [Unit]
    Description=B
    After=A.service

    [Service]
    Type=oneshot
    ExecStart=/usr/bin/echo B
    RemainAfterExit=yes

    # /etc/systemd/system/C.target
    [Unit]
    Description=C
    Wants=A.service B.service

Start them.

    # systemctl daemon-reload
    # systemctl start C.target

Then, we have:

    # LANG=C journalctl --no-pager -u A.service -u B.service -u C.target -b
    -- Logs begin at Mon 2019-09-09 00:25:06 EDT, end at Thu 2019-10-24 22:28:47 EDT. --
    Oct 24 22:27:47 localhost.localdomain systemd[1]: Starting A...
    Oct 24 22:27:47 localhost.localdomain systemd[1]: A.service: Child 967 belongs to A.service.
    Oct 24 22:27:47 localhost.localdomain systemd[1]: A.service: Main process exited, code=exited, status=0/SUCCESS
    Oct 24 22:27:47 localhost.localdomain systemd[1]: A.service: Running next main command for state start.
    Oct 24 22:27:47 localhost.localdomain systemd[1]: A.service: Passing 0 fds to service
    Oct 24 22:27:47 localhost.localdomain systemd[1]: A.service: About to execute: /usr/bin/sleep 60
    Oct 24 22:27:47 localhost.localdomain systemd[1]: A.service: Forked /usr/bin/sleep as 968
    Oct 24 22:27:47 localhost.localdomain systemd[968]: A.service: Executing: /usr/bin/sleep 60
    Oct 24 22:27:52 localhost.localdomain systemd[1]: A.service: Trying to enqueue job A.service/reload/replace
    Oct 24 22:27:52 localhost.localdomain systemd[1]: A.service: Merged into running job, re-running: A.service/reload as 1288
    Oct 24 22:27:52 localhost.localdomain systemd[1]: A.service: Enqueued job A.service/reload as 1288
    Oct 24 22:27:52 localhost.localdomain systemd[1]: A.service: Unit cannot be reloaded because it is inactive.
    Oct 24 22:27:52 localhost.localdomain systemd[1]: A.service: Job 1288 A.service/reload finished, result=invalid
    Oct 24 22:27:52 localhost.localdomain systemd[1]: B.service: Passing 0 fds to service
    Oct 24 22:27:52 localhost.localdomain systemd[1]: B.service: About to execute: /usr/bin/echo B
    Oct 24 22:27:52 localhost.localdomain systemd[1]: B.service: Forked /usr/bin/echo as 970
    Oct 24 22:27:52 localhost.localdomain systemd[970]: B.service: Executing: /usr/bin/echo B
    Oct 24 22:27:52 localhost.localdomain systemd[1]: B.service: Failed to send unit change signal for B.service: Connection reset by peer
    Oct 24 22:27:52 localhost.localdomain systemd[1]: B.service: Changed dead -> start
    Oct 24 22:27:52 localhost.localdomain systemd[1]: Starting B...
    Oct 24 22:27:52 localhost.localdomain echo[970]: B
    Oct 24 22:27:52 localhost.localdomain systemd[1]: B.service: Child 970 belongs to B.service.
    Oct 24 22:27:52 localhost.localdomain systemd[1]: B.service: Main process exited, code=exited, status=0/SUCCESS
    Oct 24 22:27:52 localhost.localdomain systemd[1]: B.service: Changed start -> exited
    Oct 24 22:27:52 localhost.localdomain systemd[1]: B.service: Job 1371 B.service/start finished, result=done
    Oct 24 22:27:52 localhost.localdomain systemd[1]: Started B.
    Oct 24 22:27:52 localhost.localdomain systemd[1]: C.target: Job 1287 C.target/start finished, result=done
    Oct 24 22:27:52 localhost.localdomain systemd[1]: Reached target C.
    Oct 24 22:27:52 localhost.localdomain systemd[1]: C.target: Failed to send unit change signal for C.target: Connection reset by peer
    Oct 24 22:28:47 localhost.localdomain systemd[1]: A.service: Child 968 belongs to A.service.
    Oct 24 22:28:47 localhost.localdomain systemd[1]: A.service: Main process exited, code=exited, status=0/SUCCESS
    Oct 24 22:28:47 localhost.localdomain systemd[1]: A.service: Running next main command for state start.
    Oct 24 22:28:47 localhost.localdomain systemd[1]: A.service: Passing 0 fds to service
    Oct 24 22:28:47 localhost.localdomain systemd[1]: A.service: About to execute: /usr/bin/echo A2
    Oct 24 22:28:47 localhost.localdomain systemd[1]: A.service: Forked /usr/bin/echo as 972
    Oct 24 22:28:47 localhost.localdomain systemd[972]: A.service: Executing: /usr/bin/echo A2
    Oct 24 22:28:47 localhost.localdomain echo[972]: A2
    Oct 24 22:28:47 localhost.localdomain systemd[1]: A.service: Child 972 belongs to A.service.
    Oct 24 22:28:47 localhost.localdomain systemd[1]: A.service: Main process exited, code=exited, status=0/SUCCESS
    Oct 24 22:28:47 localhost.localdomain systemd[1]: A.service: Changed start -> exited

The issue occurs not only in reload command, i.e.:

  - reload
  - try-restart
  - reload-or-restart
  - reload-or-try-restart commands

The cause of this issue is that job_type_collapse() doesn't take care of the
activating state.

Fixes: #10464

5 years agojournalctl: allow running vacuum on remote journals, too
Jan Kundrát [Sat, 2 Nov 2019 15:42:01 +0000 (16:42 +0100)]
journalctl: allow running vacuum on remote journals, too

Right now the `systemd-journal-remote` service does not constrain its
resource usage (I just run out of space on my 100GB partition, for
example). This patch does not change that, but it at least makes it
possible to run something like:

  journalctl --directory /var/log/journal/remote --rotate --vacuum-size=90G

fixes #2376

Co-authored-by: Mike Auty <ikelos@gentoo.org>
5 years agobootctl: create leading dirs when "bootctl random-seed" is called if needed
Lennart Poettering [Mon, 4 Nov 2019 13:25:57 +0000 (14:25 +0100)]
bootctl: create leading dirs when "bootctl random-seed" is called if needed

Prompted by: #13603

5 years agoMerge pull request #13906 from yuwata/drop-missing-take2
Zbigniew Jędrzejewski-Szmek [Mon, 4 Nov 2019 12:41:37 +0000 (13:41 +0100)]
Merge pull request #13906 from yuwata/drop-missing-take2

tree-wide: drop xxx.h when xxx-util.h is included

5 years agosd-boot: Skip adding boot entries when the loader does not exist
Jan Janssen [Fri, 1 Nov 2019 11:31:07 +0000 (12:31 +0100)]
sd-boot: Skip adding boot entries when the loader does not exist

5 years agoallow an empty DefaultInstance= in configuration files
Jérémy Rosen [Fri, 1 Nov 2019 23:03:54 +0000 (00:03 +0100)]
allow an empty DefaultInstance= in configuration files

It is currently possible to override the DefaultInstance via drop-ins but
not remove it completely. Allow to do that by specifying an empty
DefaultInstance=

5 years agoman/systemd.net-naming-scheme: fix typo
Jan Synacek [Mon, 4 Nov 2019 09:43:05 +0000 (10:43 +0100)]
man/systemd.net-naming-scheme: fix typo

5 years agoutil: drop unnecessary headers from util.c
Yu Watanabe [Sun, 3 Nov 2019 15:40:37 +0000 (00:40 +0900)]
util: drop unnecessary headers from util.c

5 years agotree-wide: drop double newline
Yu Watanabe [Fri, 1 Nov 2019 09:33:24 +0000 (18:33 +0900)]
tree-wide: drop double newline

5 years agotree-wide: drop input.h when missing_input.h is included
Yu Watanabe [Fri, 1 Nov 2019 09:28:32 +0000 (18:28 +0900)]
tree-wide: drop input.h when missing_input.h is included

5 years agotree-wide: drop stdio.h when stdio-util.h is included
Yu Watanabe [Fri, 1 Nov 2019 09:27:33 +0000 (18:27 +0900)]
tree-wide: drop stdio.h when stdio-util.h is included

5 years agotree-wide: drop signal.h when signal-util.h is included
Yu Watanabe [Fri, 1 Nov 2019 09:27:01 +0000 (18:27 +0900)]
tree-wide: drop signal.h when signal-util.h is included

5 years agotree-wide: drop mman.h when missing_mman.h is included
Yu Watanabe [Fri, 1 Nov 2019 09:26:26 +0000 (18:26 +0900)]
tree-wide: drop mman.h when missing_mman.h is included

5 years agotree-wide: drop magic.h when missing_magic.h is included
Yu Watanabe [Fri, 1 Nov 2019 09:24:45 +0000 (18:24 +0900)]
tree-wide: drop magic.h when missing_magic.h is included

5 years agotree-wide: drop stat.h or statfs.h when stat-util.h is included
Yu Watanabe [Fri, 1 Nov 2019 09:23:26 +0000 (18:23 +0900)]
tree-wide: drop stat.h or statfs.h when stat-util.h is included

5 years agotree-wide: drop socket.h when socket-util.h is included
Yu Watanabe [Fri, 1 Nov 2019 09:22:48 +0000 (18:22 +0900)]
tree-wide: drop socket.h when socket-util.h is included

5 years agotree-wide: drop mntent.h when fstab-util.h is included
Yu Watanabe [Fri, 1 Nov 2019 09:21:33 +0000 (18:21 +0900)]
tree-wide: drop mntent.h when fstab-util.h is included

5 years agotree-wide: drop libkmod.h when module-util.h is included
Yu Watanabe [Fri, 1 Nov 2019 09:20:59 +0000 (18:20 +0900)]
tree-wide: drop libkmod.h when module-util.h is included

5 years agotree-wide: drop blkid.h when blkid-util.h is included
Yu Watanabe [Fri, 1 Nov 2019 09:20:31 +0000 (18:20 +0900)]
tree-wide: drop blkid.h when blkid-util.h is included

5 years agotree-wide: drop acl.h when acl-util.h is included
Yu Watanabe [Fri, 1 Nov 2019 09:19:54 +0000 (18:19 +0900)]
tree-wide: drop acl.h when acl-util.h is included

5 years agotree-wide: drop pwd.h and grp.h when user-util.h is included
Yu Watanabe [Fri, 1 Nov 2019 09:18:31 +0000 (18:18 +0900)]
tree-wide: drop pwd.h and grp.h when user-util.h is included

5 years agotree-wide: drop time.h when time-util.h is included
Yu Watanabe [Fri, 1 Nov 2019 09:17:53 +0000 (18:17 +0900)]
tree-wide: drop time.h when time-util.h is included

5 years agotree-wide: drop capability.h when capability-util.h is included
Yu Watanabe [Fri, 1 Nov 2019 09:17:16 +0000 (18:17 +0900)]
tree-wide: drop capability.h when capability-util.h is included

5 years agotree-wide: drop sched.h when missing_sched.h is included
Yu Watanabe [Fri, 1 Nov 2019 09:16:18 +0000 (18:16 +0900)]
tree-wide: drop sched.h when missing_sched.h is included

5 years agotree-wide: drop gcrypt.h when gcrypt-util.h is included
Yu Watanabe [Fri, 1 Nov 2019 08:57:13 +0000 (17:57 +0900)]
tree-wide: drop gcrypt.h when gcrypt-util.h is included

5 years agotree-wide: drop locale.h when locale-util.h is included
Yu Watanabe [Fri, 1 Nov 2019 08:56:33 +0000 (17:56 +0900)]
tree-wide: drop locale.h when locale-util.h is included

5 years agotree-wide: drop glob.h when glob-util.h is included
Yu Watanabe [Fri, 1 Nov 2019 08:56:05 +0000 (17:56 +0900)]
tree-wide: drop glob.h when glob-util.h is included

5 years agotree-wide: drop dirent.h when dirent-util.h is included
Yu Watanabe [Fri, 1 Nov 2019 08:55:16 +0000 (17:55 +0900)]
tree-wide: drop dirent.h when dirent-util.h is included

5 years agotree-wide: drop alloca.h when alloc-util.h is included
Yu Watanabe [Fri, 1 Nov 2019 08:46:59 +0000 (17:46 +0900)]
tree-wide: drop alloca.h when alloc-util.h is included

5 years agotree-wide: drop string.h when string-util.h or friends are included
Yu Watanabe [Fri, 1 Nov 2019 08:44:54 +0000 (17:44 +0900)]
tree-wide: drop string.h when string-util.h or friends are included

5 years agoMerge pull request #13899 from poettering/in-gid-tweak
Yu Watanabe [Sun, 3 Nov 2019 13:54:32 +0000 (22:54 +0900)]
Merge pull request #13899 from poettering/in-gid-tweak

user-util: tweak to in_gid()

5 years agoMerge pull request #13909 from poettering/env-copy-pid
Yu Watanabe [Sun, 3 Nov 2019 13:46:42 +0000 (22:46 +0900)]
Merge pull request #13909 from poettering/env-copy-pid

Fixes for the "saved_env" copy logic

5 years agonspawn: respect quiet on capabilities warning
Justin Trudell [Fri, 1 Nov 2019 19:00:16 +0000 (12:00 -0700)]
nspawn: respect quiet on capabilities warning

5 years agofs-util: let's avoid unnecessary strerror()
Lennart Poettering [Fri, 1 Nov 2019 10:43:34 +0000 (11:43 +0100)]
fs-util: let's avoid unnecessary strerror()

strerror() is not thread safe. Let's avoid it where it is easy hence.

(Ideally we'd not use it at all anymore, but that's sometimes a bit
nasty, not in this case though, where it is very easy to avoid)

Follow-up for: 27c3112dcbd1b5f171c36c32550d9c6331375b0b

5 years agoMerge pull request #13916 from ddstreet/test-network
Yu Watanabe [Sun, 3 Nov 2019 12:42:15 +0000 (21:42 +0900)]
Merge pull request #13916 from ddstreet/test-network

test-network: minor changes to work better on Debian/Ubuntu autopkgtest

5 years agonspawn: mangle slice name
Lennart Poettering [Fri, 1 Nov 2019 10:21:05 +0000 (11:21 +0100)]
nspawn: mangle slice name

It's user-facing, parsed from the command line and we typically mangle
in these cases, let's do so here too. (In particular as the identical
switch for systemd-run already does it.)

5 years agobasic/signal-util: drop unnecessary parens
Zbigniew Jędrzejewski-Szmek [Wed, 30 Oct 2019 13:36:05 +0000 (14:36 +0100)]
basic/signal-util: drop unnecessary parens

5 years agoMerge pull request #13905 from poettering/cpuset-fixes
Lennart Poettering [Fri, 1 Nov 2019 22:44:36 +0000 (23:44 +0100)]
Merge pull request #13905 from poettering/cpuset-fixes

fixes to the cpuset cgroup logic

5 years agotest-network: Remove/replace non-capturing group regex
Dan Streetman [Thu, 31 Oct 2019 16:19:23 +0000 (12:19 -0400)]
test-network: Remove/replace non-capturing group regex

The systemd-networkd-tests.py has some regex that uses non-capturing
groups, but there is no need to use that with assertRegex; the
groups aren't referenced so it doesn't matter if it's capturing or
non-capturing.  However, there are a few places where optional groups
should have been used instead, so this changes that.

Specifically, groups like this:
(?:whatever |)
should actually be:
(whatever )?

Additionally, this is specifically needed for these tests to run on
Debian systems, because this assertRegex:
'Link File: (?:/usr)/lib/systemd/network/99-default.link'
needs to be:
'Link File: (/usr)?/lib/systemd/network/99-default.link'

5 years agotest: check /usr/lib and /lib for systemd binaries
Dan Streetman [Thu, 31 Oct 2019 10:44:20 +0000 (06:44 -0400)]
test: check /usr/lib and /lib for systemd binaries

Fedora uses /usr/lib while Debian uses /lib; find the right location

5 years agotest/test-network/systemd-networkd-tests.py: suppress stderr for functionality checks
Dan Streetman [Thu, 31 Oct 2019 10:07:33 +0000 (06:07 -0400)]
test/test-network/systemd-networkd-tests.py: suppress stderr for functionality checks

5 years agomkosi: Find hostname command on Arch Linux
Kevin Kuehler [Thu, 31 Oct 2019 22:41:32 +0000 (15:41 -0700)]
mkosi: Find hostname command on Arch Linux

exec-specifier.service: Executing: /usr/bin/sh -c 'test mkosi-7d5e81c7b81c42338d060a6b98edd44a = $(hostname)'
/usr/bin/sh: hostname: command not found
/usr/bin/sh: line 0: test: mkosi-7d5e81c7b81c42338d060a6b98edd44a: unary operator expected
Received SIGCHLD from PID 7389 (sh).
Child 7389 (sh) died (code=exited, status=2/INVALIDARGUMENT)

gettext provides the hostname binary, but puts it in
/usr/lib/gettext/hostname, which is not part of the default $PATH. Using
inetutils instead puts the binary in /usr/bin/hostname.

5 years agoupdate TODO
Lennart Poettering [Fri, 1 Nov 2019 12:07:51 +0000 (13:07 +0100)]
update TODO

5 years agostatic-destruct: add missing closing '(' in comment
Lennart Poettering [Fri, 1 Nov 2019 10:31:20 +0000 (11:31 +0100)]
static-destruct: add missing closing '(' in comment

5 years agopid1: rework environment block copy logic
Lennart Poettering [Fri, 1 Nov 2019 10:26:05 +0000 (11:26 +0100)]
pid1: rework environment block copy logic

This reworks the logic introduced in
a5cede8c24fddda9b73f142e09b18b49adde1b9c (#13693).

First of all, let's move this out of util.c, since only PID 1 really
needs this, and there's no real need to have it in util.c.

Then, fix freeing of the variable. It previously relied on
STATIC_DESTRUCTOR_REGISTER() which however relies on static_destruct()
to be called explicitly. Currently only the main-func.h macros do that,
and PID 1 does not. (It might be worth investigating whether to do that,
but it's not trivial.) Hence the freeing wasn't applied.

Finally, an OOM check was missing, add it in.

5 years agocgroup: add missing OOM check, and shorten code a bit
Lennart Poettering [Fri, 1 Nov 2019 09:22:03 +0000 (10:22 +0100)]
cgroup: add missing OOM check, and shorten code a bit

cpu_set_to_range_string() can fail due to OOM. Handle that.

unit_write_settingf() exists, use it instead of formatting a string
beforehand.

cpu_set_add_all() can fail due to OOM. Let's avoid it if we don't have
to use it, just copy over the cpuset directly.

5 years agocpuset: fix indentation and log about OOM we otherwise ignore
Lennart Poettering [Fri, 1 Nov 2019 09:21:53 +0000 (10:21 +0100)]
cpuset: fix indentation and log about OOM we otherwise ignore

5 years agocgroup: add some basic OOM safety where it was missing
Lennart Poettering [Fri, 1 Nov 2019 09:21:35 +0000 (10:21 +0100)]
cgroup: add some basic OOM safety where it was missing

5 years agoNEWS: mention NetworkEmulatorDuplicateRate= setting
Yu Watanabe [Fri, 1 Nov 2019 02:46:00 +0000 (11:46 +0900)]
NEWS: mention NetworkEmulatorDuplicateRate= setting

5 years agoMerge pull request #13888 from ssahani/qdisc
Yu Watanabe [Fri, 1 Nov 2019 02:44:10 +0000 (11:44 +0900)]
Merge pull request #13888 from ssahani/qdisc

tc qdisc: netem add support to duplicate packets.

5 years agonetwork: DHCP server remove duplicate free
Susant Sahani [Thu, 31 Oct 2019 20:55:48 +0000 (21:55 +0100)]
network: DHCP server remove duplicate free

5 years agoFix CID 1406578: Resource leaks (RESOURCE_LEAK)
Susant Sahani [Thu, 31 Oct 2019 13:25:16 +0000 (14:25 +0100)]
Fix CID 1406578:  Resource leaks  (RESOURCE_LEAK)

** CID 1406578:  Resource leaks  (RESOURCE_LEAK)
/src/libsystemd-network/sd-dhcp-server.c: 155 in sd_dhcp_raw_option_new()

5 years agotest: add really basic in_gid() test
Lennart Poettering [Thu, 31 Oct 2019 19:28:49 +0000 (20:28 +0100)]
test: add really basic in_gid() test

5 years agouser-util: tweak to in_gid()
Lennart Poettering [Thu, 31 Oct 2019 19:27:34 +0000 (20:27 +0100)]
user-util: tweak to in_gid()

Let's make this robust towards parallel updates to group lists. This is
not going to happen IRL, but it makes me sleep better at night: let's
iterate a couple of times in case the list is updated while we are at
it.

Follow-up for: f5e0b942af1e86993c21f4e5c84342bb10403dac

5 years agoMerge pull request #13895 from jsynacek/master
Anita Zhang [Thu, 31 Oct 2019 18:39:08 +0000 (11:39 -0700)]
Merge pull request #13895 from jsynacek/master

sd-dhcp: fix resource leak

5 years agoMerge pull request #13891 from yuwata/basic-drop-missing
Anita Zhang [Thu, 31 Oct 2019 18:35:58 +0000 (11:35 -0700)]
Merge pull request #13891 from yuwata/basic-drop-missing

tree-wide: drop missing.h

5 years agoMerge pull request #13892 from keur/mkosi_arch
Anita Zhang [Thu, 31 Oct 2019 18:22:37 +0000 (11:22 -0700)]
Merge pull request #13892 from keur/mkosi_arch

Fix mkosi on Arch Linux