1
0
mirror of https://github.com/systemd/systemd.git synced 2024-11-01 17:51:22 +03:00
Commit Graph

40720 Commits

Author SHA1 Message Date
Lubomir Rintel
c4f885e7e0 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)
2019-06-25 10:22:18 +09:00
Lubomir Rintel
f053fc337e 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.
2019-06-25 10:20:48 +09:00
Lennart Poettering
330703fb22 man: beef up systemd.exec(5)
Prompted by:

https://lists.freedesktop.org/archives/systemd-devel/2019-May/042773.html
2019-06-24 18:31:36 +02:00
Yu Watanabe
270384b2d4 tree-wide: replace strjoina() with prefix_roota() 2019-06-25 01:31:26 +09:00
Zbigniew Jędrzejewski-Szmek
44e891bbf6 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.
2019-06-24 18:20:01 +02:00
Zbigniew Jędrzejewski-Szmek
b81b40d4c4 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.
2019-06-24 17:26:13 +02:00
Zbigniew Jędrzejewski-Szmek
f2330acda4 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.
2019-06-24 17:26:13 +02:00
Yu Watanabe
2d9b74ba87 tree-wide: replace strjoin() with path_join() 2019-06-24 23:59:38 +09:00
Michal Sekletar
b070c7c0e1 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.
2019-06-24 16:58:54 +02:00
Yu Watanabe
f9421dd847 test: add more testcases for prefix_roota() 2019-06-24 23:40:33 +09:00
Yu Watanabe
95bbf19e2f 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.
2019-06-24 23:37:11 +09:00
Lennart Poettering
5c6d40d132 core: migrate service directories back from private if needed
Fixes: #12131
2019-06-24 16:20:34 +02:00
Lennart Poettering
3f5b15084e core: add missing space to DynamicUser=1 directory comment
(also line break again)
2019-06-24 16:20:34 +02:00
Zbigniew Jędrzejewski-Szmek
c455677449
Merge pull request #12868 from poettering/doc-243-fixes
various man page fixes
2019-06-24 16:07:16 +02:00
Lennart Poettering
e5134f00f8 man: document that sd_bus_creds_get_exec() is not suitable for security decisions
Fixes: #12704
2019-06-24 15:30:10 +02:00
Lennart Poettering
eedaf7f322 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.)
2019-06-24 15:23:11 +02:00
Lennart Poettering
cd69e88ba3 doc: make clear that --system and --user only make sense with --test
Fixes: #12843
2019-06-24 14:51:52 +02:00
Lennart Poettering
b30772a403 man: correct that Sockets= may not be undone
Fixes: #12415
2019-06-24 14:22:43 +02:00
Lennart Poettering
e0e65f7d09 man: document that DynamicUser=1 implied sandboxing cannot be turned off
Fixes: #12476
2019-06-24 14:20:36 +02:00
Lennart Poettering
0d92a3088a
Merge pull request #12866 from yuwata/strv_consume_cleanups
tree-wide: use _cleanup_ attributes
2019-06-24 09:54:36 +02:00
Yu Watanabe
6abdec98f3 tree-wide: use _cleanup_ attribute and strv_consume() + TAKE_PTR() 2019-06-24 14:57:58 +09:00
Yu Watanabe
623550aff7 sd-path: use _cleanup_strv_free_ attribute 2019-06-24 14:57:50 +09:00
Lennart Poettering
ac5dca6489 update TODO 2019-06-23 16:13:26 +02:00
Peter A. Bigot
94c4bbe506 man: fix references to VTABLE property flags 2019-06-23 04:13:41 +09:00
Lennart Poettering
72bd85259b update TODO 2019-06-22 20:12:44 +02:00
Lennart Poettering
cee97d5768
Merge pull request #12836 from yuwata/tree-wide-replace-strjoin
tree-wide: replace strjoin() with path_join()
2019-06-22 20:02:46 +02:00
Anita Zhang
4c1567f29a 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.
2019-06-22 19:56:06 +02:00
Topi Miettinen
e48fcfef06 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.
2019-06-22 18:35:48 +02:00
Evgeny Vereshchagin
0127b1a05e coverity: stop setting _Float*
Should address https://github.com/systemd/systemd/issues/12854
2019-06-21 18:27:35 +03:00
Jan Synacek
6e9713f675 man: drop my copyright 2019-06-21 15:05:09 +09:00
Lennart Poettering
c6134d3e2f 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
2019-06-21 08:42:55 +09:00
Anita Zhang
f66ad46066 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
2019-06-20 21:46:36 +02:00
Yu Watanabe
a5a4dfa1bc
Merge pull request #12846 from poettering/cap-last-cap-fix
cap_last_cap() off by one fixes
2019-06-21 03:31:49 +09:00
Lennart Poettering
1e59b5455e bpf: use more TAKE_FD() 2019-06-21 03:28:24 +09:00
Yu Watanabe
a13de89d36 sd-path: use _cleanup_ attribute 2019-06-21 03:26:23 +09:00
Yu Watanabe
657ee2d82b tree-wide: replace strjoin() with path_join() 2019-06-21 03:26:16 +09:00
Lennart Poettering
3972004297 bus-creds: fix size calculation for storing caps data
This is a bit confusing, hence let's at an example comment.
2019-06-20 14:55:30 +02:00
Lennart Poettering
4a33a02e99 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.
2019-06-20 14:55:24 +02:00
Topi Miettinen
9af2820694 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.
2019-06-20 14:03:57 +02:00
Lennart Poettering
762267cdc1
Merge pull request #12762 from yuwata/network-introduce-carrier-and-network-state-12752
network: introduce carrier and address state to fix network_is_online()
2019-06-20 13:36:30 +02:00
Lennart Poettering
64ef83139c
Merge pull request #12837 from yuwata/tree-wide-lgtm-fixes
tree-wide: fix issues found by lgtm
2019-06-20 12:35:34 +02:00
Donald Buczek
0219b3524f 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
2019-06-20 10:16:53 +02:00
Yu Watanabe
b19eab1f74
Merge pull request #12806 from yuwata/networkctl-ethtool-12657
networkctl: show speed, duplex, auto negotiation, and port
2019-06-20 06:56:37 +09:00
Yu Watanabe
31a9be2372 util: use extract_first_word() instead of strsep() 2019-06-20 06:51:34 +09:00
Yu Watanabe
fe2e4b6961 tree-wide: use htobe{32,16}() instead of hton{l,s}() 2019-06-20 06:34:05 +09:00
Yu Watanabe
6d946490ba tree-wide: drop alloca() in loop 2019-06-20 06:29:19 +09:00
Yu Watanabe
c967d2c7ce networkctl: show link speed, duplex, auto negotiation, and port 2019-06-20 04:42:55 +09:00
Yu Watanabe
42a63431d3 network: change type of BitRates= bus property 2019-06-19 23:15:19 +09:00
Yu Watanabe
9ff27e6413 table: introduce FORMAT_BPS type 2019-06-19 23:15:19 +09:00
Yu Watanabe
049025a415 test: add tests for format_bytes() 2019-06-19 23:15:19 +09:00