platform/upstream/systemd.git
5 years agoMerge pull request #12887 from fbuihuu/coredump-cleanup-part-1
Zbigniew Jędrzejewski-Szmek [Fri, 28 Jun 2019 14:25:46 +0000 (16:25 +0200)]
Merge pull request #12887 from fbuihuu/coredump-cleanup-part-1

Coredump cleanup part 1

5 years agocryptsetup-generator: fix luks-* entry parsing from crypttab
Lubomir Rintel [Thu, 27 Jun 2019 11:02:28 +0000 (13:02 +0200)]
cryptsetup-generator: fix luks-* entry parsing from crypttab

This reverts a part of commit 49fe5c099639 ('tree-wide: port various places
over to STARTSWITH_SET()') that replaced a pair of startswith() calls
with STARTSWITH_SET().

They were in fact for a different strings (device vs. name), botching
the crypttap parsing.

5 years agobash-completion: support systemd-analyze condition
Yu Watanabe [Thu, 27 Jun 2019 17:48:53 +0000 (02:48 +0900)]
bash-completion: support systemd-analyze condition

5 years agocoredump: make use of the iovec-array helpers
Franck Bui [Wed, 26 Jun 2019 09:38:44 +0000 (11:38 +0200)]
coredump: make use of the iovec-array helpers

Previous code was allocating an array of iovecs big enough to store all the
fields added later by various functions.

This forced us to calculate the size of the array in advance which is too error
prone if for example one wants to add new fields or simply rework the
code. Various assertions were added to make sure there's no overflow but it's
still more code for no good reasons.

Instead, this patch switches to the new iovec array handling interface so the
array is grown dynamically when needed.

The other contraint was that some iovecs were supposed to be freed whereas some
others were not. This makes the code hard to (re)organize. The new code always
allocates fields so it becomes easier to rework the code.

5 years agoMerge pull request #12889 from keszybz/analyze-condition
Yu Watanabe [Thu, 27 Jun 2019 17:37:20 +0000 (02:37 +0900)]
Merge pull request #12889 from keszybz/analyze-condition

Add systemd-analyze condition

5 years agoio-util: introduce iovw_put_string_field() helper
Franck Bui [Tue, 25 Jun 2019 14:57:06 +0000 (16:57 +0200)]
io-util: introduce iovw_put_string_field() helper

5 years agojournal-import: extract helpers for handling arrays of iovec and make them available...
Franck Bui [Tue, 25 Jun 2019 13:54:44 +0000 (15:54 +0200)]
journal-import: extract helpers for handling arrays of iovec and make them available for others

5 years agocoredump: drop 2 useless assertions
Franck Bui [Tue, 25 Jun 2019 12:08:16 +0000 (14:08 +0200)]
coredump: drop 2 useless assertions

5 years agocoredump: slighlty simplify stack trace generation logic
Franck Bui [Tue, 25 Jun 2019 12:04:46 +0000 (14:04 +0200)]
coredump: slighlty simplify stack trace generation logic

The main advantage is to avoid the code duplication used to build MESSAGE=
field.

No functional changes.

5 years agocoredump: fix the check on the number of passed args in backtrace mode
Franck Bui [Fri, 21 Jun 2019 14:18:39 +0000 (16:18 +0200)]
coredump: fix the check on the number of passed args in backtrace mode

In backtrace mode, '--backtrace' option should also be counted.

5 years agocoredump: gather_pid_metadata() doesn't return 1 anymore
Franck Bui [Fri, 21 Jun 2019 13:34:01 +0000 (15:34 +0200)]
coredump: gather_pid_metadata() doesn't return 1 anymore

Since commit 92e92d71faea0f107312f296b7756cc04281ba99, gather_pid_metadata()
returns only 0 or a negative value.

5 years agocoredump: rename set_iovec_field_free() into set_iovec_string_field_free()
Franck Bui [Fri, 21 Jun 2019 12:48:02 +0000 (14:48 +0200)]
coredump: rename set_iovec_field_free() into set_iovec_string_field_free()

It's more in line with its counterpart set_iovec_string_field().

Also move the definition to io-util next to set_iovec_string_field().

5 years agoMerge pull request #12760 from zachsmith/systemd-sleep_resume_offset
Zbigniew Jędrzejewski-Szmek [Thu, 27 Jun 2019 11:37:27 +0000 (13:37 +0200)]
Merge pull request #12760 from zachsmith/systemd-sleep_resume_offset

systemd-sleep: use resume_offset value if set

5 years agocore: skip whitespace after "|" and "!" in the condition parser
Zbigniew Jędrzejewski-Szmek [Wed, 26 Jun 2019 14:23:18 +0000 (16:23 +0200)]
core: skip whitespace after "|" and "!" in the condition parser

We'd skip any whitespace immediately after "=", but then we'd treat whitespace
that is between "|" or "!" and the value as significant. This is rather
confusing, let's ignore it too.

5 years agoshared/condition: fix printing of ConditionNull=
Zbigniew Jędrzejewski-Szmek [Wed, 26 Jun 2019 14:21:34 +0000 (16:21 +0200)]
shared/condition: fix printing of ConditionNull=

ConditionNull= is the only condition where parameter==NULL is allowed,
and we'd print ConditionNull=(null) or ConditionNull=!(null).

5 years agoanalyze: add 'condition' verb
Zbigniew Jędrzejewski-Szmek [Wed, 26 Jun 2019 12:58:45 +0000 (14:58 +0200)]
analyze: add 'condition' verb

We didn't have a straightforward way to parse and evaluate those strings.
Prompted by #12881.

5 years agoMerge pull request #12894 from stapelberg/patch-1
Zbigniew Jędrzejewski-Szmek [Thu, 27 Jun 2019 08:43:48 +0000 (10:43 +0200)]
Merge pull request #12894 from stapelberg/patch-1

cryptsetup: comment: crypt_setup → crypt_format

5 years agodocs: fix typos and duplicate words
Michael Prokop [Thu, 27 Jun 2019 07:54:20 +0000 (09:54 +0200)]
docs: fix typos and duplicate words

s/and and/and/
s/explicity/explicitly/
s/that that/that/
s/the the/the/
s/is is/it is/
s/overriden/overridden/

5 years agocryptsetup: comment: crypt_setup → crypt_format
Michael Stapelberg [Thu, 27 Jun 2019 07:38:30 +0000 (09:38 +0200)]
cryptsetup: comment: crypt_setup → crypt_format

5 years agoMerge pull request #12890 from yuwata/fix-conf-parser-12883
Zbigniew Jędrzejewski-Szmek [Thu, 27 Jun 2019 06:13:14 +0000 (08:13 +0200)]
Merge pull request #12890 from yuwata/fix-conf-parser-12883

conf-parse: fix continuation handling

5 years agosystemd-sleep: refuse to calculate swapfile offset on Btrfs
Zach Smith [Wed, 26 Jun 2019 13:55:37 +0000 (06:55 -0700)]
systemd-sleep: refuse to calculate swapfile offset on Btrfs

If hibernation is requested but /sys/power/resume and
/sys/power/resume_offset are not configured correctly, systemd-sleep
attempts to calculate swapfile offset using fstat and fiemap.
Btrfs returns virtual device number for stat and a virtual offset
for fiemap which results in incorrect offset calculations. In the
case where offset would be calculated and the user is using Btrfs,
log a debug message and fail to write device and offset values.

5 years agosystemd-sleep: (bug) use resume_offset value if set
Zach Smith [Sun, 9 Jun 2019 03:44:34 +0000 (20:44 -0700)]
systemd-sleep: (bug) use resume_offset value if set

Use hibernation configuration as defined in
/sys/power/resume and /sys/power/resume_offset
if present before inspecting /proc/swaps and
attempting to calculate swapfile offset

5 years agoMerge pull request #12892 from yuwata/fix-test-format-util-12891
Evgeny Vereshchagin [Thu, 27 Jun 2019 04:56:59 +0000 (07:56 +0300)]
Merge pull request #12892 from yuwata/fix-test-format-util-12891

test: fix argument type of test_format_bytes_one()

5 years agotest: fix argument type of test_format_bytes_one()
Yu Watanabe [Thu, 27 Jun 2019 01:20:18 +0000 (10:20 +0900)]
test: fix argument type of test_format_bytes_one()

Closes #12891.

5 years agoutil,test: rename variable non_iec -> si
Yu Watanabe [Thu, 27 Jun 2019 01:17:20 +0000 (10:17 +0900)]
util,test: rename variable non_iec -> si

5 years agotest: add testcase for issue #12883
Yu Watanabe [Wed, 26 Jun 2019 18:03:45 +0000 (03:03 +0900)]
test: add testcase for issue #12883

5 years agoconf-parser: fix continuation handling
Yu Watanabe [Wed, 26 Jun 2019 18:00:22 +0000 (03:00 +0900)]
conf-parser: fix continuation handling

Before this commit, empty lines cannot break continuation.
The bug was introduced by 9adbfeb38ac101d6f73a033bb120d63513ffb240.

Closes #12883.

5 years agocore: do not enumerate units in MANAGER_TEST_RUN_MINIMAL mode
Zbigniew Jędrzejewski-Szmek [Wed, 26 Jun 2019 12:56:59 +0000 (14:56 +0200)]
core: do not enumerate units in MANAGER_TEST_RUN_MINIMAL mode

In this mode we are not supposed to "interact with the environment", so loading
all units and printing warnings about syntax errors and /var/run usage seems
inappropriate.

5 years agoman: move description of how conditions are combined to the beginning
Zbigniew Jędrzejewski-Szmek [Wed, 26 Jun 2019 12:56:04 +0000 (14:56 +0200)]
man: move description of how conditions are combined to the beginning

Originally the description of conditions was brief, so it was acceptable
to put this part at the end. But now we have a myriad conditions, and
this crucial bit of information is easy to miss.

5 years agocore: move assert before actual use of the variable
Zbigniew Jędrzejewski-Szmek [Wed, 26 Jun 2019 09:52:57 +0000 (11:52 +0200)]
core: move assert before actual use of the variable

No point in using u->id first, and doing assert(u) later.
-std=c89 strikes again.

5 years agocoredump: rely on /proc exclusively to get the name of the crashing process
Franck Bui [Fri, 21 Jun 2019 11:12:41 +0000 (13:12 +0200)]
coredump: rely on /proc exclusively to get the name of the crashing process

I couldn't see any reason why the kernel could provide COMM to the coredump
handler via the core_pattern command line but could not make it available in
/proc. So let's assume that this info is always available in /proc.

For "backtrace" mode (when --backtrace option is passed), I assumed that the
crashing process still exists at the time systemd-coredump is called.

Also changing the core_pattern line is an API breakage for any users of the
backtrace mode but given that systemd-coredump is installed in
/usr/lib/systemd, it's a private tool which has no internal users. At least no
one complained when the hostname was added to the core_pattern line
(f45b8015513)...

Indeed it's much easier to get it from /proc since the kernel substitutes '%e'
specifier with multiple strings if the process name contains spaces (!).

5 years agocoredump: fix one memleak in backtrace mode
Franck Bui [Wed, 26 Jun 2019 05:23:10 +0000 (07:23 +0200)]
coredump: fix one memleak in backtrace mode

Journal importer internal structures need to be freed.

5 years agocoredump: make use of STRINGIFY
Franck Bui [Thu, 20 Jun 2019 14:09:51 +0000 (16:09 +0200)]
coredump: make use of STRINGIFY

5 years agoexecute: drop SYNTHETIC_ERRNO because error code was received from the apply_numa_pol...
Michal Sekletar [Tue, 25 Jun 2019 10:57:01 +0000 (12:57 +0200)]
execute: drop SYNTHETIC_ERRNO because error code was received from the apply_numa_policy()

5 years agonetwork: further log message update
Yu Watanabe [Tue, 25 Jun 2019 07:42:34 +0000 (16:42 +0900)]
network: further log message update

Follow-up for 44e891bbf6908e494856fcf3011e88a70a12e087.

5 years agocore: factor root_directory application out of apply_working_directory
Joerg Behrmann [Fri, 21 Jun 2019 11:51:53 +0000 (13:51 +0200)]
core: factor root_directory application out of apply_working_directory

Fixes: #12498

5 years agocore: move config_parse_* functions to a shared module
Frantisek Sumsal [Thu, 20 Jun 2019 16:51:42 +0000 (18:51 +0200)]
core: move config_parse_* functions to a shared module

Apart from making the code a little bit more clean, it should allow us
to write a fuzzer around the config-parsing functions in the future

5 years agoman: change true/false to yes/no for DefaultDependencies.
INSUN PYO [Tue, 25 Jun 2019 11:38:02 +0000 (20:38 +0900)]
man: change true/false to yes/no for DefaultDependencies.

5 years agoMerge pull request #12877 from poettering/dynamic-user-re-migrate2
Lennart Poettering [Tue, 25 Jun 2019 10:20:26 +0000 (12:20 +0200)]
Merge pull request #12877 from poettering/dynamic-user-re-migrate2

DynamicUser=1 → = 0 migration follow-up

5 years agosome CODING_STYLE additions
Lennart Poettering [Tue, 25 Jun 2019 07:59:24 +0000 (09:59 +0200)]
some CODING_STYLE additions

5 years agoman: say D-Bus, not dbus
Lennart Poettering [Tue, 25 Jun 2019 08:47:13 +0000 (10:47 +0200)]
man: say D-Bus, not dbus

5 years agoman: improve --test documentation
Lennart Poettering [Tue, 25 Jun 2019 08:44:59 +0000 (10:44 +0200)]
man: improve --test documentation

Incorporates some suggestions from:

https://github.com/systemd/systemd/pull/12868#discussion_r296738370
https://github.com/systemd/systemd/commit/cd69e88ba3a692618048117b26fc9ea339aa1845#commitcomment-34060775

5 years agotest: add test for DynamicUser=0 → =1 migration (and back)
Lennart Poettering [Tue, 25 Jun 2019 08:40:16 +0000 (10:40 +0200)]
test: add test for DynamicUser=0 → =1 migration (and back)

5 years agocore: mention why we do migration for everything but ConfigurationDirectory=
Lennart Poettering [Tue, 25 Jun 2019 08:39:52 +0000 (10:39 +0200)]
core: mention why we do migration for everything but ConfigurationDirectory=

5 years agocore: log when we convert from DynamicUser=1 to =0 or vice versa
Lennart Poettering [Tue, 25 Jun 2019 08:39:37 +0000 (10:39 +0200)]
core: log when we convert from DynamicUser=1 to =0 or vice versa

5 years agosystemd-nspawn(1): update example section
camoz [Tue, 25 Jun 2019 08:28:19 +0000 (10:28 +0200)]
systemd-nspawn(1): update example section

Remove the retired flag -d from Example 4. "Boot a minimal Arch Linux
distribution in a container". It has been retired here:
https://git.archlinux.org/arch-install-scripts.git/commit/pacstrap.in?id=0af6884aca68dcb7eed0b85fbc2960903df3d968

5 years agoMerge pull request #12869 from poettering/dynamic-user-re-migrate
Lennart Poettering [Tue, 25 Jun 2019 08:06:03 +0000 (10:06 +0200)]
Merge pull request #12869 from poettering/dynamic-user-re-migrate

DynamicUser=1 state directory back migration

5 years agobpf-firewall: custom BPF programs through IP(Ingress|Egress)FilterPath=
Kai Lüke [Tue, 23 Apr 2019 10:14:20 +0000 (12:14 +0200)]
bpf-firewall: custom BPF programs through IP(Ingress|Egress)FilterPath=

Takes a single /sys/fs/bpf/pinned_prog string as argument, but may be
specified multiple times. An empty assignment resets all previous filters.

Closes https://github.com/systemd/systemd/issues/10227

5 years agoMerge pull request #12874 from yuwata/ethtool-make-ubsan-quiet
Lennart Poettering [Tue, 25 Jun 2019 07:28:21 +0000 (09:28 +0200)]
Merge pull request #12874 from yuwata/ethtool-make-ubsan-quiet

ethtool: make UBSan quiet and add missing link modes

5 years agoMerge pull request #12870 from yuwata/tree-wide-further-path-join-cleanups
Lennart Poettering [Tue, 25 Jun 2019 07:27:01 +0000 (09:27 +0200)]
Merge pull request #12870 from yuwata/tree-wide-further-path-join-cleanups

tree-wide: further path_join() and path_joina() cleanups

5 years agoMerge pull request #12871 from keszybz/various-printing-fixes
Yu Watanabe [Tue, 25 Jun 2019 04:02:33 +0000 (13:02 +0900)]
Merge pull request #12871 from keszybz/various-printing-fixes

Various printing/logging fixes

5 years agoethtool: reindent link mode table
Yu Watanabe [Tue, 25 Jun 2019 02:55:59 +0000 (11:55 +0900)]
ethtool: reindent link mode table

5 years agoethtool: add missing link mode
Yu Watanabe [Tue, 25 Jun 2019 02:55:04 +0000 (11:55 +0900)]
ethtool: add missing link mode

5 years agoethtool-util: fix returned value when ethtool_cmd_speed() is SPEED_UNKNOWN
Yu Watanabe [Tue, 25 Jun 2019 02:10:07 +0000 (11:10 +0900)]
ethtool-util: fix returned value when ethtool_cmd_speed() is SPEED_UNKNOWN

5 years agolinux: make UBSAN quiet
Yu Watanabe [Tue, 25 Jun 2019 02:36:51 +0000 (11:36 +0900)]
linux: make UBSAN quiet

5 years agolinux: update kernel headers
Yu Watanabe [Tue, 25 Jun 2019 02:16:57 +0000 (11:16 +0900)]
linux: update kernel headers

5 years agobootctl: fix display of options with embedeed newlines
Zbigniew Jędrzejewski-Szmek [Sat, 15 Jun 2019 14:37:55 +0000 (16:37 +0200)]
bootctl: fix display of options with embedeed newlines

I have an .efi image with embedded newlinews. Now I don't even remember if it
was created for testing or by accident, but it doesn't really matter. We should
display such files correctly.

(This isn't a problem with normal BLS entries, because input is split into lines
so newlines are consumed.)

5 years agosd-device: don't accept /sys as a device path
Lubomir Rintel [Mon, 24 Jun 2019 18:38:30 +0000 (20:38 +0200)]
sd-device: don't accept /sys as a device path

Because it's not a device path and (slightly) bad things happen if it
gets confused with one:

  $ udevadm info /sys/
  Assertion 'device->devpath[0] == '/'' failed at
      ../src/libsystemd/sd-device/sd-device.c:958,
      function sd_device_get_devpath(). Aborting.
  Aborted (core dumped)

5 years agoudevd: fix a reversed conditional on global property set
Lubomir Rintel [Mon, 24 Jun 2019 17:23:13 +0000 (19:23 +0200)]
udevd: fix a reversed conditional on global property set

  # udevadm control --property=HELLO=WORLD
  Received udev control message (ENV), unsetting 'HELLO'
  # udevadm control --property=HELLO=
  Received udev control message (ENV), setting 'HELLO='

Oh no, it's busted. Let's try removing this one little negation real quick
to see if it helps...

  # udevadm control --property=HELLO=WORLD
  Received udev control message (ENV), setting 'HELLO=WORLD'
  # udevadm control --property=HELLO=
  Received udev control message (ENV), unsetting 'HELLO'

Feels much better now.

5 years agoman: beef up systemd.exec(5)
Lennart Poettering [Tue, 28 May 2019 14:50:10 +0000 (16:50 +0200)]
man: beef up systemd.exec(5)

Prompted by:

https://lists.freedesktop.org/archives/systemd-devel/2019-May/042773.html

5 years agotree-wide: replace strjoina() with prefix_roota()
Yu Watanabe [Mon, 24 Jun 2019 15:24:23 +0000 (00:24 +0900)]
tree-wide: replace strjoina() with prefix_roota()

5 years agonetworkd: rework warning and debug messages about address addition and removal
Zbigniew Jędrzejewski-Szmek [Sat, 15 Jun 2019 11:19:58 +0000 (13:19 +0200)]
networkd: rework warning and debug messages about address addition and removal

Those messages were quite confusing. In particular "adding address" suggests
that we are assiging a new address to an interface, but in fact we're just
reacting to a notification about an addition. So let's call that "remembering"
and "forgetting". It's not fully gramatically correct, but I think it's much
clearer than "adding"/"removing" in this context.

And "received address without address" is too cryptic, let's say "address
message" to distinguish the message from its content.

Also, make failure to format address non-fatal, and print more details in
various places.

5 years agologind: log operation details when starting actions
Zbigniew Jędrzejewski-Szmek [Thu, 13 Jun 2019 16:11:56 +0000 (18:11 +0200)]
logind: log operation details when starting actions

For some reason, systemd-logind is trying to handle idle action in one of my containers:

Jun 07 10:28:08 rawhide systemd-logind[42]: System idle. Taking action.
Jun 07 10:28:08 rawhide systemd-logind[42]: Requested operation not supported, ignoring.

But we didn't log what exactly was being done. Let's put the name of the action in messages.

5 years agologind: remove unused check
Zbigniew Jędrzejewski-Szmek [Thu, 13 Jun 2019 16:03:14 +0000 (18:03 +0200)]
logind: remove unused check

All callers pass either a fixed action, or HANDLE_IGNORE is explicitly filtered
out. Let's remove this case here, because we cannot properly log what opreation
we are ignoring.

5 years agotree-wide: replace strjoin() with path_join()
Yu Watanabe [Mon, 24 Jun 2019 14:59:38 +0000 (23:59 +0900)]
tree-wide: replace strjoin() with path_join()

5 years agocore: introduce NUMAPolicy and NUMAMask options
Michal Sekletar [Tue, 12 Mar 2019 17:58:26 +0000 (18:58 +0100)]
core: introduce NUMAPolicy and NUMAMask options

Make possible to set NUMA allocation policy for manager. Manager's
policy is by default inherited to all forked off processes. However, it
is possible to override the policy on per-service basis. Currently we
support, these policies: default, prefer, bind, interleave, local.
See man 2 set_mempolicy for details on each policy.

Overall NUMA policy actually consists of two parts. Policy itself and
bitmask representing NUMA nodes where is policy effective. Node mask can
be specified using related option, NUMAMask. Default mask can be
overwritten on per-service level.

5 years agotest: add more testcases for prefix_roota()
Yu Watanabe [Mon, 24 Jun 2019 14:40:33 +0000 (23:40 +0900)]
test: add more testcases for prefix_roota()

5 years agopath-util: fix an issue when the path argument of prefix_roota() is not absolute
Yu Watanabe [Mon, 24 Jun 2019 14:36:38 +0000 (23:36 +0900)]
path-util: fix an issue when the path argument of prefix_roota() is not absolute

When the first argument is '/' and the second argument is not absolute,
the return value was not prefixed with '/'. This fixes the issue.

5 years agocore: migrate service directories back from private if needed
Lennart Poettering [Mon, 24 Jun 2019 14:18:49 +0000 (16:18 +0200)]
core: migrate service directories back from private if needed

Fixes: #12131

5 years agocore: add missing space to DynamicUser=1 directory comment
Lennart Poettering [Mon, 24 Jun 2019 14:02:02 +0000 (16:02 +0200)]
core: add missing space to DynamicUser=1 directory comment

(also line break again)

5 years agoMerge pull request #12868 from poettering/doc-243-fixes
Zbigniew Jędrzejewski-Szmek [Mon, 24 Jun 2019 14:07:16 +0000 (16:07 +0200)]
Merge pull request #12868 from poettering/doc-243-fixes

various man page fixes

5 years agoman: document that sd_bus_creds_get_exec() is not suitable for security decisions
Lennart Poettering [Mon, 24 Jun 2019 13:30:10 +0000 (15:30 +0200)]
man: document that sd_bus_creds_get_exec() is not suitable for security decisions

Fixes: #12704

5 years agoman: drop references to "syslog" and "syslog+console" from man page
Lennart Poettering [Mon, 24 Jun 2019 13:21:22 +0000 (15:21 +0200)]
man: drop references to "syslog" and "syslog+console" from man page

These options are pretty much equivalent to "journal" and
"journal+console" anyway, let's simplify things, and drop them from the
documentation hence.

For compat reasons let's keep them in the code.

(Note that they are not 100% identical to 'journal', but I doubt the
distinction in behaviour is really relevant to keep this in the docs.
And we should probably should drop 'syslog' entirely from our codebase
eventually, but it's problematic as long as we semi-support udev on
non-systemd systems still.)

5 years agodoc: make clear that --system and --user only make sense with --test
Lennart Poettering [Mon, 24 Jun 2019 12:51:52 +0000 (14:51 +0200)]
doc: make clear that --system and --user only make sense with --test

Fixes: #12843

5 years agoman: correct that Sockets= may not be undone
Lennart Poettering [Mon, 24 Jun 2019 12:22:43 +0000 (14:22 +0200)]
man: correct that Sockets= may not be undone

Fixes: #12415

5 years agoman: document that DynamicUser=1 implied sandboxing cannot be turned off
Lennart Poettering [Mon, 24 Jun 2019 12:20:36 +0000 (14:20 +0200)]
man: document that DynamicUser=1 implied sandboxing cannot be turned off

Fixes: #12476

5 years agoMerge pull request #12866 from yuwata/strv_consume_cleanups
Lennart Poettering [Mon, 24 Jun 2019 07:54:36 +0000 (09:54 +0200)]
Merge pull request #12866 from yuwata/strv_consume_cleanups

tree-wide: use _cleanup_ attributes

5 years agotree-wide: use _cleanup_ attribute and strv_consume() + TAKE_PTR()
Yu Watanabe [Mon, 24 Jun 2019 05:57:58 +0000 (14:57 +0900)]
tree-wide: use _cleanup_ attribute and strv_consume() + TAKE_PTR()

5 years agosd-path: use _cleanup_strv_free_ attribute
Yu Watanabe [Mon, 24 Jun 2019 05:57:50 +0000 (14:57 +0900)]
sd-path: use _cleanup_strv_free_ attribute

5 years agoupdate TODO
Lennart Poettering [Sun, 23 Jun 2019 14:13:26 +0000 (16:13 +0200)]
update TODO

5 years agoman: fix references to VTABLE property flags
Peter A. Bigot [Sat, 22 Jun 2019 17:43:49 +0000 (12:43 -0500)]
man: fix references to VTABLE property flags

5 years agoupdate TODO
Lennart Poettering [Sat, 22 Jun 2019 18:12:44 +0000 (20:12 +0200)]
update TODO

5 years agoMerge pull request #12836 from yuwata/tree-wide-replace-strjoin
Lennart Poettering [Sat, 22 Jun 2019 18:02:46 +0000 (20:02 +0200)]
Merge pull request #12836 from yuwata/tree-wide-replace-strjoin

tree-wide: replace strjoin() with path_join()

5 years agobpf-firewall: optimization for IPAddressXYZ="any" (and unprivileged users)
Anita Zhang [Mon, 20 May 2019 21:43:53 +0000 (14:43 -0700)]
bpf-firewall: optimization for IPAddressXYZ="any" (and unprivileged users)

This is a workaround to make IPAddressDeny=any/IPAddressAllow=any work
for non-root users that have CAP_NET_ADMIN. "any" was chosen since
all or nothing network access is one of the most common use cases for
isolation.

Allocating BPF LPM TRIE maps require CAP_SYS_ADMIN while BPF_PROG_TYPE_CGROUP_SKB
only needs CAP_NET_ADMIN. In the case of IPAddressXYZ="any" we can just
consistently return false/true to avoid allocating the map and limit the user
to having CAP_NET_ADMIN.

5 years agocgroup-util: kill also threads
Topi Miettinen [Mon, 20 May 2019 09:20:58 +0000 (12:20 +0300)]
cgroup-util: kill also threads

It's possible for a zombie process to have live threads. These are not listed
in /sys in "cgroup.procs" for cgroupsv2, but they show up in
"cgroup.threads" (cgroupv2) or "tasks" (cgroupv1) nodes. When killing a
cgroup (v2 only) with SIGKILL, let's also kill threads after killing processes,
so the live threads of a zombie get killed too.

Closes #12262.

5 years agocoverity: stop setting _Float*
Evgeny Vereshchagin [Fri, 21 Jun 2019 00:21:09 +0000 (02:21 +0200)]
coverity: stop setting _Float*

Should address https://github.com/systemd/systemd/issues/12854

5 years agoman: drop my copyright
Jan Synacek [Fri, 21 Jun 2019 05:53:15 +0000 (07:53 +0200)]
man: drop my copyright

5 years agopath-util: get rid of prefix_root()
Lennart Poettering [Wed, 19 Jun 2019 13:20:13 +0000 (15:20 +0200)]
path-util: get rid of prefix_root()

prefix_root() is equivalent to path_join() in almost all ways, hence
let's remove it.

There are subtle differences though: prefix_root() will try shorten
multiple "/" before and after the prefix. path_join() doesn't do that.
This means prefix_root() might return a string shorter than both its
inputs combined, while path_join() never does that. I like the
path_join() semantics better, hence I think dropping prefix_root() is
totally OK. In the end the strings generated by both functon should
always be identical in terms of path_equal() if not streq().

This leaves prefix_roota() in place. Ideally we'd have path_joina(), but
I don't think we can reasonably implement that as a macro. or maybe we
can? (if so, sounds like something for a later PR)

Also add in a few missing OOM checks

5 years agonspawn: don't hard fail when setting capabilities
Anita Zhang [Mon, 3 Jun 2019 23:25:43 +0000 (16:25 -0700)]
nspawn: don't hard fail when setting capabilities

The OCI changes in #9762 broke a use case in which we use nspawn from
inside a container that has dropped capabilities from the bounding set
that nspawn expected to retain. In an attempt to keep OCI compliance
and support our use case, I made hard failing on setting capabilities
not in the bounding set optional (hard fail if using OCI and log only
if using nspawn cmdline).

Fixes #12539

5 years agoMerge pull request #12846 from poettering/cap-last-cap-fix
Yu Watanabe [Thu, 20 Jun 2019 18:31:49 +0000 (03:31 +0900)]
Merge pull request #12846 from poettering/cap-last-cap-fix

cap_last_cap() off by one fixes

5 years agobpf: use more TAKE_FD()
Lennart Poettering [Thu, 20 Jun 2019 12:41:09 +0000 (14:41 +0200)]
bpf: use more TAKE_FD()

5 years agosd-path: use _cleanup_ attribute
Yu Watanabe [Thu, 20 Jun 2019 18:14:05 +0000 (03:14 +0900)]
sd-path: use _cleanup_ attribute

5 years agotree-wide: replace strjoin() with path_join()
Yu Watanabe [Thu, 20 Jun 2019 18:07:01 +0000 (03:07 +0900)]
tree-wide: replace strjoin() with path_join()

5 years agobus-creds: fix size calculation for storing caps data
Lennart Poettering [Thu, 20 Jun 2019 12:54:40 +0000 (14:54 +0200)]
bus-creds: fix size calculation for storing caps data

This is a bit confusing, hence let's at an example comment.

5 years agocapability: fix loops for cap_last_cap()
Lennart Poettering [Thu, 20 Jun 2019 12:44:47 +0000 (14:44 +0200)]
capability: fix loops for cap_last_cap()

cap_last_cap() returns the last valid cap (instead of the number of
valid caps). to iterate through all known caps we hence need to use a <=
check, and not a < check like for all other cases. We got this right
usually, but in three cases we did not.

5 years agounits: deny access to block devices
Topi Miettinen [Wed, 1 May 2019 12:28:36 +0000 (15:28 +0300)]
units: deny access to block devices

While the need for access to character devices can be tricky to determine for
the general case, it's obvious that most of our services have no need to access
block devices. For logind and timedated this can be tightened further.

5 years agoMerge pull request #12762 from yuwata/network-introduce-carrier-and-network-state...
Lennart Poettering [Thu, 20 Jun 2019 11:36:30 +0000 (13:36 +0200)]
Merge pull request #12762 from yuwata/network-introduce-carrier-and-network-state-12752

network: introduce carrier and address state to fix network_is_online()

5 years agoMerge pull request #12837 from yuwata/tree-wide-lgtm-fixes
Lennart Poettering [Thu, 20 Jun 2019 10:35:34 +0000 (12:35 +0200)]
Merge pull request #12837 from yuwata/tree-wide-lgtm-fixes

tree-wide: fix issues found by lgtm

5 years agocgroup: Continue unit reset if cgroup is busy
Donald Buczek [Thu, 25 Apr 2019 07:39:41 +0000 (09:39 +0200)]
cgroup: Continue unit reset if cgroup is busy

When part of the cgroup hierarchy cannot be deleted (e.g. because there
are still processes in it), do not exit unit_prune_cgroup early, but
continue so that u->cgroup_realized is reset.

Log the known case of non-empty cgroups at debug level and other errors
at warning level.

Fixes https://github.com/systemd/systemd/issues/12386

5 years agoMerge pull request #12806 from yuwata/networkctl-ethtool-12657
Yu Watanabe [Wed, 19 Jun 2019 21:56:37 +0000 (06:56 +0900)]
Merge pull request #12806 from yuwata/networkctl-ethtool-12657

networkctl: show speed, duplex, auto negotiation, and port