Commit Graph

48267 Commits

Author SHA1 Message Date
Gaurav 6ef03f7a0d Handle escape characters in interface name
Updated the patch as per review comments.
2020-12-15 17:47:03 +01:00
Gaurav 17f8a21fd0 Detect special character in dbus interface name
Added debug log to detect special character in dbus interface names.
Helps to detect a case mentioned in https://github.com/systemd/systemd/issues/14636
2020-12-15 17:47:03 +01:00
Fabian Affolter 04b2224957 Translated using Weblate (German)
Currently translated at 61.4% (115 of 187 strings)

Co-authored-by: Fabian Affolter <mail@fabian-affolter.ch>
Translate-URL: https://translate.fedoraproject.org/projects/systemd/master/de/
Translation: systemd/master
2020-12-15 17:40:56 +01:00
Ondrej Mosnacek 7b87bece5d resolved: create stub-resolv.conf symlink with correct security label
Use symlink_atomic_label() instead of symlink_atomic() as the symlink
may need a different label than the parent directory.

Signed-off-by: Ondrej Mosnacek <omosnace@redhat.com>
2020-12-15 14:12:08 +01:00
Yu Watanabe fc874bf3bf
Merge pull request #17977 from yuwata/namespace-mount-procfs-follow-up
core/namespace: do not ignore non-EPERM mount error
2020-12-15 12:07:30 +09:00
Andrew Balmos 361f41645c efi: Only use arm flags if supported
Support gcc 8 on arm
2020-12-15 12:06:52 +09:00
Yu Watanabe 7843706caf
Merge pull request #17936 from keszybz/more-nss-logging
Add debug logging for varlink
2020-12-15 12:05:45 +09:00
Susant Sahani e81a44bf5f timesync: Make delaying attempts to contact servers configurable
```
❯ ssh sus@xx.xx.xx.xx
Last login: Sat Nov 14 17:32:08 2020 from 10.104.45.138
 17:36:19 up 0 min,  0 users,  load average: 0.00, 0.00, 0.00
> systemd-analyze blame
Bootup is not yet finished (org.freedesktop.systemd1.Manager.FinishTimestampMonotonic=0).
Please try again later.
Hint: Use 'systemctl list-jobs' to see active jobs
> systemd-analyze blame
43.954s systemd-time-wait-sync.service
 1.969s systemd-networkd-wait-online.service
 1.559s cloud-init-local.service
 1.039s cloud-init.service
  414ms cloud-final.service
  387ms dracut-initqueue.service
  382ms initrd-switch-root.service
  380ms cloud-config.service
  198ms systemd-journal-flush.service
  136ms systemd-udev-trigger.service
  115ms initrd-parse-etc.service
   97ms systemd-timesyncd.service
   84ms systemd-journald.service

```

After made it configurable and set to 5s

```
❯ ssh sus@xx.xx.xx.xx
Last login: Sat Nov 14 18:41:42 2020 from 10.104.45.138
 18:42:36 up 0 min,  0 users,  load average: 0.16, 0.03, 0.01
> systemd-analyze blame
10.450s systemd-time-wait-sync.service
 8.303s systemd-networkd-wait-online.service
 1.621s cloud-init-local.service
 1.068s cloud-init.service
```
2020-12-15 08:52:51 +09:00
Luca Boccassi e3284031ae
Merge pull request #17960 from yuwata/network-log-routing-policy-rule
network: introduce log_routing_policy_rule()
2020-12-14 22:22:51 +00:00
Luca Boccassi e1f3685750
Merge pull request #17959 from yuwata/network-log-address
network: introduce log_address_debug()
2020-12-14 22:21:50 +00:00
Luca Boccassi e82b77e984
Merge pull request #17958 from yuwata/network-route-log
network: introduce log_route_debug()
2020-12-14 22:17:33 +00:00
Yu Watanabe bcdb3b7d50 core: detect_container() may return negative errno 2020-12-14 19:35:11 +01:00
Zbigniew Jędrzejewski-Szmek db3d4222e9 varlink: add debug logging
When something fails, we need some logs to figure out what happened.
This is primarily relevant for connection errors, but in general we
want to log about all errors, even if they are relatively unlikely.

We want one log on failure, and generally no logs on success.
The general idea is to not log in static functions, and to log in the
non-static functions. Non-static functions which call other functions
may thus log or not log as appropriate to have just one log entry in the
end.
2020-12-14 19:21:55 +01:00
Yu Watanabe c4837f4567 Revert "core/namespace: ignore ENOENT for /proc/sys/kernel/domainname and hostname"
This reverts commit 0ebc9f23fa.

With the previous commit, these files should always exist.

Closes #17979.
2020-12-15 02:38:35 +09:00
Yu Watanabe ad74f28a13 core/namespace: do not ignore non-EPERM mount error
Follow-up for 61f8a7bd3e.
2020-12-15 02:37:03 +09:00
Yu Watanabe 23d8003bb6 time-util: fix typo 2020-12-14 17:56:01 +01:00
Yu Watanabe 61f8a7bd3e core/namespace: use existing /proc when not enough priviledge
Fixes #17860.
2020-12-14 16:12:43 +01:00
Yu Watanabe c18c53c36e network: use netlink_message_read_in_addr_union() where applicable 2020-12-14 23:32:25 +09:00
Yu Watanabe ea81208f03 network: introduce log_routing_policy_rule_debug() 2020-12-14 23:32:20 +09:00
Yu Watanabe 40424f1ad9 network: introduce routing_policy_rule_equal() 2020-12-14 23:30:16 +09:00
Yu Watanabe 18f2ee3310 network: make routing_policy_rule_remove() take Manager instead of Link
As routing policy rules are managed by Manager.
2020-12-14 23:30:16 +09:00
Yu Watanabe 1db01a3339 network: make address_drop() accept NULL 2020-12-14 23:28:11 +09:00
Yu Watanabe 24f50382af network: introduce log_address_debug() 2020-12-14 23:28:07 +09:00
Yu Watanabe 4055ec9323 network: merge manager_drop_routes() and manager_drop_foreign_routes() 2020-12-14 23:26:49 +09:00
Yu Watanabe 167a5561cd network: introduce log_route_debug() 2020-12-14 23:26:45 +09:00
Yu Watanabe ad6df71759 network: use netlink_message_read_in_addr_union() where applicable 2020-12-14 23:25:09 +09:00
Yu Watanabe 0ebc9f23fa core/namespace: ignore ENOENT for /proc/sys/kernel/domainname and hostname
If they do not exist, hostname or domainname cannot be modified. So, it is ok.

Fixes #17866, especially https://github.com/systemd/systemd/issues/17866#issuecomment-744118614.
2020-12-14 14:15:28 +00:00
Lennart Poettering 38abd1bfc5 Update TODO 2020-12-14 13:51:10 +01:00
Yu Watanabe 28423d9a75 tree-wide: fix typo 2020-12-14 12:05:55 +00:00
Ilya Dmitrichenko 65af8442df nspawn: remove outdated comment regarding bpffs
bpffs fully respects mount namespaces since kernel version 4.7

References:

- e27f4a942a
- 612bacad78
2020-12-14 10:50:42 +01:00
Yu Watanabe 8d80f27530 sd-device: make TAGS= property prefixed and suffixed with ":"
The commit 6f3ac0d517 drops the prefix and
suffix in TAGS= property. But there exists several rules that have like
`TAGS=="*:tag:*"`. So, the property must be always prefixed and suffixed
with ":".

Fixes #17930.
2020-12-14 14:04:53 +09:00
Yu Watanabe ba9385d91f
Merge pull request #17928 from keszybz/nss-logging
Enable logging in nss modules
2020-12-14 09:48:23 +09:00
Jameer Pathan 292420ce4b Add Pull Request Labeler 2020-12-14 09:43:38 +09:00
Vito Caputo 258190a0d5 mmap-cache: drop ret_size from mmap_cache_get()
The ret_size result is a bit of an awkward optimization that in a
sense enables bypassing the mmap-cache API, while encouraging
duplication of logic it already implements.

It's only utilized in one place; journal_file_move_to_object(),
apparently to avoid the overhead of remapping the whole object
again once its header, and thus its actual size, is known.

With mmap-cache's context cache, the overhead of simply
re-getting the object with the now known size should already be
negligible.  So it's not clear what benefit this brings, unless
avoiding some function calls that do very little in the hot
context-cache hit case is of such a priority.

There's value in having all object-sized gets pass through
mmap_cache_get(), as it provides a single entrypoint for
instrumentation in profiling/statistics gathering.  When
journal_file_move_to_object() bypasses getting the full object
size, you don't capture the full picture on the mmap-cache side
in terms of object sizes explicitly loaded from a journal file.

I'd like to see additional accounting in mmap_cache_get() in a
future commit, taking advantage of this change.
2020-12-13 11:14:43 +00:00
dropsignal 52fc66635d Update 60-keyboard.hwdb
added support for samsung series 3 np355v4c laptop keyboard
2020-12-13 10:49:46 +00:00
Khem Raj 5bb20fd3d3 meson: Fix reallocarray check
reallocarray() is defined in stdlib.h, so that would be right header to
check for its presense.

Signed-off-by: Khem Raj <raj.khem@gmail.com>
2020-12-13 09:44:29 +01:00
Zbigniew Jędrzejewski-Szmek 4eb105fa4a pid1: stop making /dev noexec
Quoting Andy Lutomirski:
> The upcoming Linux SGX driver has a device node /dev/sgx.  User code opens
> it, does various setup things, mmaps it, and needs to be able to create
> PROT_EXEC mappings.  This gets quite awkward if /dev is mounted noexec.

We already didn't use noexec in spawn, and this extends this behaviour to other
systems.

Afaik, the kernel would refuse execve() on a character or block device
anyway. Thus noexec on /dev matters only for actual binaries copied to /dev,
which requires root privileges in the first place.

We don't do noexec on either /tmp or /dev/shm (because that causes immediate
problems with stuff like Java and cffi). And if you have those two at your
disposal anyway, having noexec on /dev doesn't seem important. So the 'noexec'
attribute on /dev doesn't really mean much, since there are multiple other
similar directories which don't require root privileges to write to.

C.f. 33c10ef43b.
2020-12-12 10:56:48 +00:00
Karel Zak 25b514cd00 udev-builtin-blkid: add VOLUME_ID, LOGICAL_VOLUME_ID, VOLUME_SET_ID and DATA_PREPARER_ID
The new libblkid release will provide these variables. Let's keep is
accessible also from udev-db for the rest of the system.
2020-12-12 13:21:55 +09:00
Luca Boccassi 213b8ebe43
Merge pull request #17921 from yuwata/network-drop-assertion-17920
network: drop assertions to check link state in netlink callback handlers
2020-12-11 22:53:33 +00:00
Zbigniew Jędrzejewski-Szmek 5916c54a8d
Merge pull request #17935 from yuwata/network-fix-another-race-in-link-reconfigure-17929
network: do not reconfigure interface when the link gains carrier but udev not initialized it yet
2020-12-11 11:39:44 +01:00
Zbigniew Jędrzejewski-Szmek f8dd40779a
network: adjust comments
Co-authored-by: Carlo Teubner <435950+c4rlo@users.noreply.github.com>
2020-12-11 11:39:16 +01:00
Zbigniew Jędrzejewski-Szmek b3a7915805 basic/log: add debug-level log_oom() variant
This is useful for contexts where only debug-level messages are allowed.
2020-12-11 08:22:41 +01:00
Yu Watanabe bd4733da64 network: do not configure static configs more than once simultaneously 2020-12-11 14:39:46 +09:00
Yu Watanabe b788a429d1 network: do not assume address ready callback is always set to static addresses 2020-12-11 14:22:35 +09:00
Yu Watanabe b2219cc4b6 network: drop assertions to check link state in netlink callback handlers
As, the link may be dropped while configuring addresses or routes.

Fixes #17920.
2020-12-11 13:47:24 +09:00
Yu Watanabe 8bceafa777 network: do not reconfigure interface when the link gains carrier but udev not initialized it yet
When an interface gains carrier but udev have not initialized the
interface or link_initialized_handler() has not been called yet,
then link_configure will be called twice. Thus LLDP client will be
configured twice, and triggers assertion.

Fixes #17929.
2020-12-11 12:27:27 +09:00
Zbigniew Jędrzejewski-Szmek e5d5edc3ff nss-mymachines: initialize logging
No logging is done directly by nss-mymachines.c code, but we call into sd-bus,
which will log.
2020-12-10 20:52:03 +01:00
Zbigniew Jędrzejewski-Szmek 3339381f22 nss-systemd: initialize logging 2020-12-10 20:51:59 +01:00
Zbigniew Jędrzejewski-Szmek 55679e291c nss-resolve: initialize logging, log json errors
When the .so module is loaded, it gets a separate copy of stuff in src/basic,
including the log level variables. So any logging settings are unaffected by
the loading program calling log_parse_environment() or such. Let's also parse
the environment here so that we can have nice logging.

Initialization is done from each exported function, and pthread_once_t is used
to avoid duplicate initialization. I didn't merge PROTECT_ERRNO into
NSS_ENTRYPOINT_BEGIN because UNPROTECT_ERRNO is called in a bunch of places
and it would feel strange to have PROTECT_ERRNO hidden, but not UNPROTECT_ERRNO.

The most interesting stuff in this module is the varlink messages, and any
potential errors in json. So let's enable json logging when debug messages are
enabled.

With those changes, figuring out the issue in
https://github.com/systemd/systemd/pull/17823 is trivial:

$ LD_LIBRARY_PATH=build/ SYSTEMD_LOG_COLOR=1 SYSTEMD_LOG_LOCATION=1 SYSTEMD_LOG_LEVEL=debug getent hosts mirrors.fedoraproject.org
src/shared/varlink.c:237: n/a: varlink: setting state idle-client
src/shared/varlink.c:1240: n/a: Sending message: {"method":"io.systemd.Resolve.ResolveHostname","parameters":{"name":"mirrors.fedoraproject.org","family":10}}
src/shared/varlink.c:240: n/a: varlink: changing state idle-client → calling
src/shared/varlink.c:588: n/a: New incoming message: {"parameters":{"addresses":[{"ifindex":0,"family":10,"address":[42,5,208,20,0,16,120,3,247,116,77,124,226,119,164,87]},{"ifindex":0,"family":10,"address":[42,5,208,28,12,106,204,3,38,58,132,9,185,97,126,2]},{"ifindex":0,"family":10,"address":[38,32,0,82,0,3,0,1,222,173,190,239,202,254,254,215]},{"ifindex":0,"family":10,"address":[38,5,188,128,48,16,6,0,222,173,190,239,202,254,254,217]},{"ifindex":0,"family":10,"address":[38,4,21,128,254,0,0,0,222,173,190,239,202,254,254,209]},{"ifindex":0,"family":10,"address":[38,32,0,82,0,3,0,1,222,173,190,239,202,254,254,214]},{"ifindex":0,"family":10,"address":[38,16,0,40,48,144,48,1,222,173,190,239,202,254,254,211]},{"ifindex":0,"family":10,"address":[32,1,65,120,0,2,18,105,0,0,0,0,0,0,254,210]}],"name":"wildcard.fedoraproject.org","flags":1}}
src/shared/varlink.c:240: n/a: varlink: changing state calling → called
src/shared/varlink.c:240: n/a: varlink: changing state called → idle-client
src/nss-resolve/nss-resolve.c:84: (string):1:40: JSON field 'ifindex' is out of bounds for an interface index.
2020-12-10 20:50:01 +01:00
Jinyuan Si 239952e890 cryptsetup: Fix crypto device missing issue after bootup
Normally, the udev rules operate on "change" events. But when
coldplugging, there's an "add" event present. The udev rules have to
recognize this and do some actions in this particular situation, too.
Also, we don't want the nodes to be created prematurely on "add"
events while not coldplugging. The udev rules will check
DM_UDEV_PRIMARY_SOURCE_FLAG to see if the device was activated
correctly before and if not, it ignore the "add" event totally.
This way the udev rules can support udev triggers generating "add"
events (e.g. "udevadm trigger --action=add" or
"echo add > /sys/block/<dm_device>/uevent").

In this case, the udevd service is started after
systemd-cryptsetup@config.service, is started, which will cause udevd
service to miss the "change" uevent with DM_UDEV_PRIMARY_SOURCE_FLAG
flag generated by systemd-cryptsetup@config.service. To solve this
issue, we let the cryptsetup service be started after the udevd
service.
2020-12-10 20:46:00 +01:00