]> git.ipfire.org Git - thirdparty/systemd.git/log
thirdparty/systemd.git
3 years agonetwork: Allow to configure interface promiscuous mode
Susant Sahani [Tue, 15 Dec 2020 04:00:17 +0000 (05:00 +0100)] 
network: Allow to configure interface promiscuous mode

3 years agotest: use modern qemu numa arguments
Christian Ehrhardt [Tue, 15 Dec 2020 11:05:14 +0000 (12:05 +0100)] 
test: use modern qemu numa arguments

Upgrading to qemu 5.2 breaks TEST-36-NUMAPOLICY like:
  qemu-system-x86_64: total memory for NUMA nodes (0x0) should
  equal RAM size (0x20000000)

Use the new (as in >=2014) form of memdev in test 36:
 -object memory-backend-ram,id=mem0,size=512M -numa node,memdev=mem0,nodeid=0

Since some target systems are as old as qemu 1.5.3 (CentOS7) but the new
kind to specify was added in qemu 2.1 this needs to add version parsing and
add the argument only when qemu is >=5.2.

Fixes #17986.

Signed-off-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
3 years agoMerge pull request #17967 from poettering/connect-user-bus
Lennart Poettering [Tue, 15 Dec 2020 20:14:01 +0000 (21:14 +0100)] 
Merge pull request #17967 from poettering/connect-user-bus

add support for "systemctl --user --machine=foobar@.host" for connecting to user bus of user "foobar"

3 years agobusctl: add a timestamp to the output of the busctl monitor command
d032747 [Tue, 15 Dec 2020 09:40:06 +0000 (10:40 +0100)] 
busctl: add a timestamp to the output of the busctl monitor command

3 years agoMerge pull request #17908 from ddstreet/dhcpv4_rfc2131_intervals
Yu Watanabe [Tue, 15 Dec 2020 20:05:06 +0000 (05:05 +0900)] 
Merge pull request #17908 from ddstreet/dhcpv4_rfc2131_intervals

Fix dhcpv4 renew/rebind intervals to match rfc2131

3 years agojournalctl: don't skip the entries that have the same seqnum
shenyangyang4 [Thu, 10 Dec 2020 11:44:31 +0000 (06:44 -0500)] 
journalctl: don't skip the entries that have the same seqnum

These two judgement can't judge that two entries are repeating fully.
So i think seqnum is needed to make full judgement.

3 years agobus-util: improve logging when we can't connect to the bus 17967/head
Lennart Poettering [Mon, 14 Dec 2020 15:36:00 +0000 (16:36 +0100)] 
bus-util: improve logging when we can't connect to the bus

Previously, we'd already have explicit logging for the case where
$XDG_RUNTIME_DIR is not set. Let's also add some explicit logging for
the EPERM/ACCESS case. Let's also in both cases suggest the
--machine=<user>@.host syntax.

And while we are at it, let's remove side-effects from the macro.

By checking for both the EPERM/EACCES case and the $XDG_RUNTIME_DIR case
we will now catch both the cases where people use "su" to issue a
"systemctl --user" operation, and those where they (more correctly, but
still not good enough) call "su -".

Fixes: #17901
3 years agostdio-bridge: add support for --system and --user
Lennart Poettering [Mon, 14 Dec 2020 12:23:31 +0000 (13:23 +0100)] 
stdio-bridge: add support for --system and --user

So far, the bridge always acted as if "--system" was used, i.e. would
unconditionally connect to the system bus. Let's add "--user" too, to
connect to the users session bus.

This is mostly for completeness' sake.

I wanted to use this when making sd-bus's ability to connect to other
user's D-Bus busses work, but it didn't exist so far. In the interest of
keeping things compatible the implementation in sd-bus will not use the
new "--user" switch, and instead manually construct the right bus path
via "--path=", but we still should add the proper switches, as
preparation for a brighter future, one day.

3 years agoman: document new ability to connect to user of container
Lennart Poettering [Mon, 14 Dec 2020 12:23:00 +0000 (13:23 +0100)] 
man: document new ability to connect to user of container

3 years agosd-bus: add API for connecting to a specific user's user bus of a specific container
Lennart Poettering [Mon, 14 Dec 2020 12:21:58 +0000 (13:21 +0100)] 
sd-bus: add API for connecting to a specific user's user bus of a specific container

This is unfortunately harder to implement than it sounds. The user's bus
is bound a to the user's lifecycle after all (i.e. only exists as long
as the user has at least one PAM session), and the path dynamically (at
least theoretically, in practice it's going to be the same always)
generated via $XDG_RUNTIME_DIR in /run/.

To fix this properly, we'll thus go through PAM before connecting to a
user bus. Which is hard since we cannot just link against libpam in the
container, since the container might have been compiled entirely
differently. So our way out is to use systemd-run from outside, which
invokes a transient unit that does PAM from outside, doing so via D-Bus.
Inside the transient unit we then invoke systemd-stdio-bridge which
forwards D-Bus from the user bus to us. The systemd-stdio-bridge makes
up the PAM session and thus we can sure tht the bus exists at least as
long as the bus connection is kept.

Or so say this differently: if you use "systemctl -M lennart@foobar"
now, the bus connection works like this:

        1. sd-bus on the host forks off:

                systemd-run -M foobar -PGq --wait -pUser=lennart -pPAMName=login systemd-stdio-bridge

        2. systemd-run gets a connection to the "foobar" container's
           system bus, and invokes the "systemd-stdio-bridge" binary as
           transient service inside a PAM session for the user "lennart"

        3. The systemd-stdio-bridge then proxies our D-Bus traffic to
           the user bus.

sd-bus (on host) → systemd-run (on host) → systemd-stdio-bridge (in container)

Complicated? Well, to some point yes, but otoh it's actually nice in
various other ways, primarily as it makes the -H and -M codepaths more
alike. In the -H case (i.e. connect to remote host via SSH) a very
similar three steps are used. The only difference is that instead of
"systemd-run" the "ssh" binary is used to invoke the stdio bridge in a
PAM session of some other system. Thus we get similar implementation and
isolation for similar operations.

Fixes: #14580
3 years agosd-bus: 'ret' parameter to sd_bus_query_sender_creds() is not optional, check for it
Lennart Poettering [Mon, 14 Dec 2020 12:20:28 +0000 (13:20 +0100)] 
sd-bus: 'ret' parameter to sd_bus_query_sender_creds() is not optional, check for it

3 years agosd-bus: make credential acquisition more graceful
Lennart Poettering [Mon, 14 Dec 2020 12:16:39 +0000 (13:16 +0100)] 
sd-bus: make credential acquisition more graceful

So far when asked for augmented bus credentials and the process was
already gone we'd fail fatally. Let's make this graceful instead, and
never allow augmenting fail due to PID having vanished — unless the
augmenting is the explicit and only purpose of the requested operation.

This should be safe as clients have to explicitly query the acquired
creds anyway and handle if they couldn't be acquired. Moreover we
already handle permission problems gracefully, thus clients must be
ready to deal with missing creds.

This is useful to make selinux authorization work for short-lived client
proceses. PReviously we'd augment creds to have more info to log about
(the selinux decision would not be based on augmented data however,
because that'd be unsafe), and would fail if we couldn't get it. Now,
we'll try to acquire the data, but if we cannot acquire it, we'll still
do the selinux check, except that logging will be more limited.

3 years agofirstboot: clean-up the copied hostname, not argv[] directly, as that's ugly
Lennart Poettering [Fri, 11 Dec 2020 15:44:04 +0000 (16:44 +0100)] 
firstboot: clean-up the copied hostname, not argv[] directly, as that's ugly

3 years agohostname-setup: clarify that failures reading /etc/hostname are ignored
Lennart Poettering [Fri, 11 Dec 2020 15:43:39 +0000 (16:43 +0100)] 
hostname-setup: clarify that failures reading /etc/hostname are ignored

3 years agohostname-util: flagsify hostname_is_valid(), drop machine_name_is_valid()
Lennart Poettering [Fri, 11 Dec 2020 15:40:45 +0000 (16:40 +0100)] 
hostname-util: flagsify hostname_is_valid(), drop machine_name_is_valid()

Let's clean up hostname_is_valid() a bit: let's turn the second boolean
argument into a more explanatory flags field, and add a flag that
accepts the special name ".host" as valid. This is useful for the
container logic, where the special hostname ".host" refers to the "root
container", i.e. the host system itself, and can be specified at various
places.

let's also get rid of machine_name_is_valid(). It was just an alias,
which is confusing and even more so now that we have the flags param.

3 years agohostname-util: explain what 'LDH' is
Lennart Poettering [Fri, 11 Dec 2020 15:26:04 +0000 (16:26 +0100)] 
hostname-util: explain what 'LDH' is

3 years agologs-show: drop redundant validation of machine name
Lennart Poettering [Fri, 11 Dec 2020 15:25:12 +0000 (16:25 +0100)] 
logs-show: drop redundant validation of machine name

The immediately following container_get_leader() call validate the name
anyway, no need to twice exactly the same way twice immediately after
each other.

3 years agomachine: drop really old kdbus left-over
Lennart Poettering [Fri, 11 Dec 2020 11:04:21 +0000 (12:04 +0100)] 
machine: drop really old kdbus left-over

The "x-machine-kernel" dbus address has been removed a long time ago,
hence don't generate it either.

3 years agosd-bus: use SOCK_CLOEXEC on one more socket
Lennart Poettering [Fri, 11 Dec 2020 11:04:11 +0000 (12:04 +0100)] 
sd-bus: use SOCK_CLOEXEC on one more socket

3 years agoFix review comments in added debug log.
Gaurav [Tue, 15 Dec 2020 10:11:46 +0000 (15:41 +0530)] 
Fix review comments in added debug log.

3 years agoFix build warning.
Gaurav [Tue, 15 Dec 2020 08:45:43 +0000 (14:15 +0530)] 
Fix build warning.

3 years agoHandle escape characters in interface name
Gaurav [Tue, 15 Dec 2020 07:28:52 +0000 (12:58 +0530)] 
Handle escape characters in interface name

Updated the patch as per review comments.

3 years agoDetect special character in dbus interface name
Gaurav [Fri, 4 Dec 2020 11:15:15 +0000 (16:45 +0530)] 
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

3 years agoTranslated using Weblate (German)
Fabian Affolter [Sun, 13 Dec 2020 14:36:01 +0000 (15:36 +0100)] 
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

3 years agoresolved: create stub-resolv.conf symlink with correct security label
Ondrej Mosnacek [Mon, 14 Dec 2020 15:36:27 +0000 (16:36 +0100)] 
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>
3 years agoMerge pull request #17977 from yuwata/namespace-mount-procfs-follow-up
Yu Watanabe [Tue, 15 Dec 2020 03:07:30 +0000 (12:07 +0900)] 
Merge pull request #17977 from yuwata/namespace-mount-procfs-follow-up

core/namespace: do not ignore non-EPERM mount error

3 years agoefi: Only use arm flags if supported
Andrew Balmos [Fri, 11 Dec 2020 03:15:24 +0000 (22:15 -0500)] 
efi: Only use arm flags if supported

Support gcc 8 on arm

3 years agoMerge pull request #17936 from keszybz/more-nss-logging
Yu Watanabe [Tue, 15 Dec 2020 03:05:45 +0000 (12:05 +0900)] 
Merge pull request #17936 from keszybz/more-nss-logging

Add debug logging for varlink

3 years agotimesync: Make delaying attempts to contact servers configurable
Susant Sahani [Thu, 10 Dec 2020 18:54:19 +0000 (19:54 +0100)] 
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
```

3 years agotest-network: increase wait_online timeout to handle longer dhcpv4 transient timeout 17908/head
Dan Streetman [Wed, 9 Dec 2020 20:24:09 +0000 (15:24 -0500)] 
test-network: increase wait_online timeout to handle longer dhcpv4 transient timeout

Previous commits changed the dhcpv4 retransmission algorithm to be
slightly slower, changing the amount of time it takes to notify
systemd-networkd that the dhcpv4 configuration has (transiently)
failed from around 14 second up to 28 seconds.

Since the test_dhcp_client_with_ipv4ll_without_dhcp_server test
configures an interface to use dhcpv4 without any operating dhcpv4
server running, it must increase the amount of time it waits for
the test interface to reach degraded state.

3 years agosd-dhcp-client: correct retransmission timeout to match RFC
Dan Streetman [Wed, 9 Dec 2020 19:32:06 +0000 (14:32 -0500)] 
sd-dhcp-client: correct retransmission timeout to match RFC

This changes the retransmission timeout algorithm for requests
other than RENEW and REBIND. Previously, the retransmission timeout
started at 2 seconds, then doubling each retransmission up to a max
of 64 seconds. This is changed to match what RFC2131 section 4.1 describes,
which skips the initial 2 second timeout and starts with a 4 second timeout
instead. Note that -1 to +1 seconds of random 'fuzz' is added to each
timeout, in previous and current behavior.

This change is therefore slightly slower than the previous behavior in
attempting retransmissions when no server response is received, since the
first transmission times out in 4 seconds instead of 2.

Since TRANSIENT_FAILURE_ATTEMPTS is set to 3, the previous length of time
before a transient failure was reported back to systemd-networkd was
2 + 4 + 8 = 14 seconds, plus, on average, 3 seconds of random 'fuzz' for
a transient failure timeout between 11 and 17 seconds. Now, since the
first timeout starts at 4, the transient failure will be reported at
4 + 8 + 16 = 28 seconds, again plus 3 random seconds for a transient
failure timeout between 25 and 31 seconds.

Additionally, if MaxAttempts= is set, it will take slightly longer to
reach than with previous behavior.

3 years agosd-dhcp-client: correct dhcpv4 renew/rebind retransmit timeouts
Dan Streetman [Tue, 8 Dec 2020 20:40:10 +0000 (15:40 -0500)] 
sd-dhcp-client: correct dhcpv4 renew/rebind retransmit timeouts

Use the request timeout algorithm specified in RFC2131 section 4.4.5 for
handling timed out RENEW and REBIND requests.

This changes behavior, as previously only 2 RENEW and 2 REBIND requests
were sent, no matter how long the lease lifetime. Now, requests are
send according to the RFC, which results in starting with a timeout
of 1/2 the t1 or t2 period, and halving the timeout for each retry
down to a minimum of 60 seconds.

Fixes: #17909
3 years agosd-dhcp-client: simplify dhcp4 t1/t2 parsing
Dan Streetman [Tue, 8 Dec 2020 20:36:19 +0000 (15:36 -0500)] 
sd-dhcp-client: simplify dhcp4 t1/t2 parsing

The parsing of the dhcpv4 lease lifetime, as well as the t1/t2
times, is simplified by this commit.

This differs from previous behavior; previously, the lease lifetime and
t1/t2 values were modified by random 'fuzz' by subtracting 3, then adding
a random number between 0 and (slightly over) 2 seconds. The resulting
values were therefore always between 1-3 seconds shorter than the value
provided by the server (or the default, in case of t1/t2). Now, as
described in RFC2131, the random 'fuzz' is between -1 and +1 seconds,
meaning the actual t1 and t2 value will be up to 1 second earlier or
later than the server-provided (or default) t1/t2 value.

This also differs in handling the lease lifetime, as described above it
previously was adjusted by the random 'fuzz', but the RFC does not state
that the lease expiration time should be adjusted, so now the code uses
exactly the lease lifetime as provided by the server with no adjustment.

3 years agosd-dhcp-client: add RFC2131 retransmission details
Dan Streetman [Tue, 8 Dec 2020 20:33:29 +0000 (15:33 -0500)] 
sd-dhcp-client: add RFC2131 retransmission details

RFC2131, providing the details for dhcpv4, has specific retransmission
intervals that it outlines. This adds functions to compute the timeouts
as the RFC describes.

3 years agosd-dhcp-client: track dhcp4 t1, t2, expire times
Dan Streetman [Tue, 8 Dec 2020 19:37:59 +0000 (14:37 -0500)] 
sd-dhcp-client: track dhcp4 t1, t2, expire times

Add fields to dhcp4 client to track t1, t2, and lease expiry times

3 years agosd-dhcp-client: don't log timeouts if already expired
Dan Streetman [Mon, 14 Dec 2020 20:50:11 +0000 (15:50 -0500)] 
sd-dhcp-client: don't log timeouts if already expired

3 years agoMerge pull request #17960 from yuwata/network-log-routing-policy-rule
Luca Boccassi [Mon, 14 Dec 2020 22:22:51 +0000 (22:22 +0000)] 
Merge pull request #17960 from yuwata/network-log-routing-policy-rule

network: introduce log_routing_policy_rule()

3 years agoMerge pull request #17959 from yuwata/network-log-address
Luca Boccassi [Mon, 14 Dec 2020 22:21:50 +0000 (22:21 +0000)] 
Merge pull request #17959 from yuwata/network-log-address

network: introduce log_address_debug()

3 years agoMerge pull request #17958 from yuwata/network-route-log
Luca Boccassi [Mon, 14 Dec 2020 22:17:33 +0000 (22:17 +0000)] 
Merge pull request #17958 from yuwata/network-route-log

network: introduce log_route_debug()

3 years agocore: detect_container() may return negative errno
Yu Watanabe [Mon, 14 Dec 2020 16:13:32 +0000 (01:13 +0900)] 
core: detect_container() may return negative errno

3 years agovarlink: add debug logging 17936/head
Zbigniew Jędrzejewski-Szmek [Thu, 10 Dec 2020 19:41:41 +0000 (20:41 +0100)] 
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.

3 years agoRevert "core/namespace: ignore ENOENT for /proc/sys/kernel/domainname and hostname" 17977/head
Yu Watanabe [Mon, 14 Dec 2020 17:37:11 +0000 (02:37 +0900)] 
Revert "core/namespace: ignore ENOENT for /proc/sys/kernel/domainname and hostname"

This reverts commit 0ebc9f23faf5586f8a9250c3be08773eb3f8d2da.

With the previous commit, these files should always exist.

Closes #17979.

3 years agocore/namespace: do not ignore non-EPERM mount error
Yu Watanabe [Mon, 14 Dec 2020 15:55:57 +0000 (00:55 +0900)] 
core/namespace: do not ignore non-EPERM mount error

Follow-up for 61f8a7bd3e20222617fc59f398071daf2af86f96.

3 years agotime-util: fix typo
Yu Watanabe [Mon, 14 Dec 2020 13:57:06 +0000 (22:57 +0900)] 
time-util: fix typo

3 years agocore/namespace: use existing /proc when not enough priviledge
Yu Watanabe [Sun, 6 Dec 2020 13:29:43 +0000 (22:29 +0900)] 
core/namespace: use existing /proc when not enough priviledge

Fixes #17860.

3 years agonetwork: use netlink_message_read_in_addr_union() where applicable 17960/head
Yu Watanabe [Wed, 28 Oct 2020 08:28:36 +0000 (17:28 +0900)] 
network: use netlink_message_read_in_addr_union() where applicable

3 years agonetwork: introduce log_routing_policy_rule_debug()
Yu Watanabe [Wed, 28 Oct 2020 08:22:58 +0000 (17:22 +0900)] 
network: introduce log_routing_policy_rule_debug()

3 years agonetwork: introduce routing_policy_rule_equal()
Yu Watanabe [Thu, 29 Oct 2020 02:41:01 +0000 (11:41 +0900)] 
network: introduce routing_policy_rule_equal()

3 years agonetwork: make routing_policy_rule_remove() take Manager instead of Link
Yu Watanabe [Wed, 28 Oct 2020 07:16:58 +0000 (16:16 +0900)] 
network: make routing_policy_rule_remove() take Manager instead of Link

As routing policy rules are managed by Manager.

3 years agonetwork: make address_drop() accept NULL 17959/head
Yu Watanabe [Wed, 28 Oct 2020 09:09:51 +0000 (18:09 +0900)] 
network: make address_drop() accept NULL

3 years agonetwork: introduce log_address_debug()
Yu Watanabe [Wed, 28 Oct 2020 09:09:16 +0000 (18:09 +0900)] 
network: introduce log_address_debug()

3 years agonetwork: merge manager_drop_routes() and manager_drop_foreign_routes() 17958/head
Yu Watanabe [Wed, 28 Oct 2020 12:16:22 +0000 (21:16 +0900)] 
network: merge manager_drop_routes() and manager_drop_foreign_routes()

3 years agonetwork: introduce log_route_debug()
Yu Watanabe [Wed, 28 Oct 2020 08:41:06 +0000 (17:41 +0900)] 
network: introduce log_route_debug()

3 years agonetwork: use netlink_message_read_in_addr_union() where applicable
Yu Watanabe [Wed, 28 Oct 2020 08:49:49 +0000 (17:49 +0900)] 
network: use netlink_message_read_in_addr_union() where applicable

3 years agocore/namespace: ignore ENOENT for /proc/sys/kernel/domainname and hostname
Yu Watanabe [Mon, 14 Dec 2020 03:37:23 +0000 (12:37 +0900)] 
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.

3 years agoUpdate TODO
Lennart Poettering [Mon, 14 Dec 2020 12:15:31 +0000 (13:15 +0100)] 
Update TODO

3 years agotree-wide: fix typo
Yu Watanabe [Mon, 14 Dec 2020 00:40:45 +0000 (09:40 +0900)] 
tree-wide: fix typo

3 years agonspawn: remove outdated comment regarding bpffs
Ilya Dmitrichenko [Mon, 14 Dec 2020 09:35:08 +0000 (09:35 +0000)] 
nspawn: remove outdated comment regarding bpffs

bpffs fully respects mount namespaces since kernel version 4.7

References:

- https://github.com/torvalds/linux/commit/e27f4a942a0ee4b84567a3c6cfa84f273e55cbb7
- https://github.com/torvalds/linux/commit/612bacad78ba6d0a91166fc4487af114bac172a8

3 years agosd-device: make TAGS= property prefixed and suffixed with ":"
Yu Watanabe [Thu, 10 Dec 2020 23:34:13 +0000 (08:34 +0900)] 
sd-device: make TAGS= property prefixed and suffixed with ":"

The commit 6f3ac0d51766b0b9101676cefe5c4ba81feba436 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.

3 years agoMerge pull request #17928 from keszybz/nss-logging
Yu Watanabe [Mon, 14 Dec 2020 00:48:23 +0000 (09:48 +0900)] 
Merge pull request #17928 from keszybz/nss-logging

Enable logging in nss modules

3 years agoAdd Pull Request Labeler
Jameer Pathan [Sat, 12 Dec 2020 06:30:26 +0000 (12:00 +0530)] 
Add Pull Request Labeler

3 years agommap-cache: drop ret_size from mmap_cache_get()
Vito Caputo [Sun, 6 Dec 2020 08:21:17 +0000 (00:21 -0800)] 
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.

3 years agoUpdate 60-keyboard.hwdb
dropsignal [Sat, 12 Dec 2020 13:31:36 +0000 (07:31 -0600)] 
Update 60-keyboard.hwdb

added support for samsung series 3 np355v4c laptop keyboard

3 years agomeson: Fix reallocarray check
Khem Raj [Sun, 13 Dec 2020 00:15:57 +0000 (16:15 -0800)] 
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>
3 years agopid1: stop making /dev noexec
Zbigniew Jędrzejewski-Szmek [Fri, 11 Dec 2020 11:28:44 +0000 (12:28 +0100)] 
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. https://salsa.debian.org/kernel-team/initramfs-tools/-/commit/33c10ef43b03dc6d9ee09a46c598f6ee34ad0b81.

3 years agoudev-builtin-blkid: add VOLUME_ID, LOGICAL_VOLUME_ID, VOLUME_SET_ID and DATA_PREPARER_ID
Karel Zak [Thu, 10 Dec 2020 11:27:33 +0000 (12:27 +0100)] 
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.

3 years agoMerge pull request #17921 from yuwata/network-drop-assertion-17920
Luca Boccassi [Fri, 11 Dec 2020 22:53:33 +0000 (22:53 +0000)] 
Merge pull request #17921 from yuwata/network-drop-assertion-17920

network: drop assertions to check link state in netlink callback handlers

3 years agoMerge pull request #17935 from yuwata/network-fix-another-race-in-link-reconfigure...
Zbigniew Jędrzejewski-Szmek [Fri, 11 Dec 2020 10:39:44 +0000 (11:39 +0100)] 
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

3 years agonetwork: adjust comments 17935/head
Zbigniew Jędrzejewski-Szmek [Fri, 11 Dec 2020 10:39:16 +0000 (11:39 +0100)] 
network: adjust comments

Co-authored-by: Carlo Teubner <435950+c4rlo@users.noreply.github.com>
3 years agobasic/log: add debug-level log_oom() variant
Zbigniew Jędrzejewski-Szmek [Fri, 11 Dec 2020 06:41:04 +0000 (07:41 +0100)] 
basic/log: add debug-level log_oom() variant

This is useful for contexts where only debug-level messages are allowed.

3 years agonetwork: do not configure static configs more than once simultaneously 17921/head
Yu Watanabe [Fri, 11 Dec 2020 05:39:46 +0000 (14:39 +0900)] 
network: do not configure static configs more than once simultaneously

3 years agonetwork: do not assume address ready callback is always set to static addresses
Yu Watanabe [Fri, 11 Dec 2020 05:22:35 +0000 (14:22 +0900)] 
network: do not assume address ready callback is always set to static addresses

3 years agonetwork: drop assertions to check link state in netlink callback handlers
Yu Watanabe [Thu, 10 Dec 2020 05:16:22 +0000 (14:16 +0900)] 
network: drop assertions to check link state in netlink callback handlers

As, the link may be dropped while configuring addresses or routes.

Fixes #17920.

3 years agonetwork: do not reconfigure interface when the link gains carrier but udev not initia...
Yu Watanabe [Fri, 11 Dec 2020 03:15:45 +0000 (12:15 +0900)] 
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.

3 years agonss-mymachines: initialize logging 17928/head
Zbigniew Jędrzejewski-Szmek [Thu, 10 Dec 2020 11:46:23 +0000 (12:46 +0100)] 
nss-mymachines: initialize logging

No logging is done directly by nss-mymachines.c code, but we call into sd-bus,
which will log.

3 years agonss-systemd: initialize logging
Zbigniew Jędrzejewski-Szmek [Thu, 10 Dec 2020 11:45:48 +0000 (12:45 +0100)] 
nss-systemd: initialize logging

3 years agonss-resolve: initialize logging, log json errors
Zbigniew Jędrzejewski-Szmek [Thu, 10 Dec 2020 11:32:12 +0000 (12:32 +0100)] 
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.

3 years agocryptsetup: Fix crypto device missing issue after bootup
Jinyuan Si [Fri, 4 Dec 2020 02:38:28 +0000 (10:38 +0800)] 
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.

3 years agoMerge pull request #17903 from yuwata/udev-options-log-level
Lennart Poettering [Thu, 10 Dec 2020 19:45:32 +0000 (20:45 +0100)] 
Merge pull request #17903 from yuwata/udev-options-log-level

udev: introduce OPTIONS="log_level=xxx" rule

3 years agoDrop compat "gateway" name
Zbigniew Jędrzejewski-Szmek [Thu, 10 Dec 2020 10:10:54 +0000 (11:10 +0100)] 
Drop compat "gateway" name

Back in 5248e7e1f11aba6859de0b28f0dd3778b22842f2 (July 2017) we moved over to
"_gateway", with the old name declared to be temporary measure. Since we're
doing a bunch of changes to resolved now, it seems to be a good moment to make
this simplification and not add support for the compat name in new code.

3 years agoveritysetup: also place udev socket dep
Lennart Poettering [Thu, 10 Dec 2020 10:48:37 +0000 (11:48 +0100)] 
veritysetup: also place udev socket dep

In light of #17848, also place udev socket dep in veritysetup, it's the
same issue after all.

3 years agoseccomp: don't install filters for archs that can't use syscalls
Greg Depoire--Ferrer [Wed, 28 Oct 2020 23:51:30 +0000 (00:51 +0100)] 
seccomp: don't install filters for archs that can't use syscalls

When seccomp_restrict_archs is called, architectures that are blocked
are replaced by the SECCOMP_LOCAL_ARCH_BLOCKED marker so that they are
not disabled again and filters are not installed for them.

This can make some service that use SystemCallArchitecture= and
SystemCallFilter= start faster.

3 years agommap-cache: bind prot(ection) to MMapFileDescriptor
Vito Caputo [Thu, 3 Dec 2020 06:11:23 +0000 (22:11 -0800)] 
mmap-cache: bind prot(ection) to MMapFileDescriptor

There are no mmap_cache_get() users that actually deviate prot
from the JournalFile's f->prot.

So there's no point in making this a separate parameter to
mmap_cache_get(), nor is there any need to store it in
JournalFile's f->prot.

Instead just pass it to mmap_cache_add_fd() at MMapFileDescriptor
creation, storing it in there for the mmap() callers, which
already receive MMapFileDescriptor *.

For functions receiving both an MMapFileDescriptor * and prot,
the prot argument has been simply removed and call sites updated.

Formalizing this fd:prot binding at the public API also enables
discarding the prot check in window_matches(), which is a hot
function on long window lists, so a minor CPU efficiency gain
should be had there as seen with the past removal of the fd
check.  Unnoticable for uncached journals, but maybe a little
runtime improvement when cached in specific circumstances.

window_matches_fd() has also been simplified to treat the
MMapFileDescrptor * as equivalent to its fd and prot.

3 years agothree spdx header fixes
Lennart Poettering [Thu, 10 Dec 2020 10:38:43 +0000 (11:38 +0100)] 
three spdx header fixes

3 years agobasic/static-destruct: fix grammar in comment
Zbigniew Jędrzejewski-Szmek [Thu, 10 Dec 2020 11:17:14 +0000 (12:17 +0100)] 
basic/static-destruct: fix grammar in comment

3 years agojson: log location also when there is no file
Zbigniew Jędrzejewski-Szmek [Thu, 10 Dec 2020 10:56:05 +0000 (11:56 +0100)] 
json: log location also when there is no file

E.g. in nss-resolve it is still useful to print the location of the error:
src/test/test-nss.c:231: dlsym(0x0x1dc6fb0, _nss_resolve_gethostbyname2_r) → 0x0x7fdbfc53f626
(string):1:40: JSON field ifindex is out of bounds for an interface index.

I opted to use a partially duplicated if condition to avoid nesting. It's nice
to have the log calls vertically aligned. The compiler will optimize this nicely.

3 years agoMerge pull request #17851 from yuwata/network-address-compare-func
Lennart Poettering [Thu, 10 Dec 2020 09:43:47 +0000 (10:43 +0100)] 
Merge pull request #17851 from yuwata/network-address-compare-func

network: revert previous changes to address_compare_func()

3 years agommap-cache: separate context and window list cache hit accounting
Vito Caputo [Sun, 6 Dec 2020 08:16:17 +0000 (00:16 -0800)] 
mmap-cache: separate context and window list cache hit accounting

Account and log these statistics separately since their overheads
are potentially quite different when the window lists are large.

There should probably be a histogram of window list traversal
counts too.

3 years agonetworkd-test: add final newlines in generated files, use .format()
Zbigniew Jędrzejewski-Szmek [Wed, 9 Dec 2020 09:35:10 +0000 (10:35 +0100)] 
networkd-test: add final newlines in generated files, use .format()

3 years agoudev: Fix sound.target dependency
Takashi Iwai [Wed, 9 Dec 2020 09:56:51 +0000 (10:56 +0100)] 
udev: Fix sound.target dependency

The recent bug report indicated a race at device creation and the
sound.target dependencies, and the cause turned out to be the condition
of the sound.target trigger.  Currently it's set for "card*", but this
is actually the parent object; i.e. the sound.target is triggered before
the sound devices are created.

For assuring the whole sound device creations beforehand, we need to use
"controlC*" instead of "card*"; as already described in
78-sound-card.rules, this is guaranteed to be the last device, and can
be used as a synchronization point.

BugLink: https://bugzilla.suse.com/show_bug.cgi?id=1179363
Signed-off-by: Takashi Iwai <tiwai@suse.de>
3 years agoMerge pull request #17877 from yuwata/missing-syscall-sort
Yu Watanabe [Thu, 10 Dec 2020 03:42:35 +0000 (12:42 +0900)] 
Merge pull request #17877 from yuwata/missing-syscall-sort

missing: sort architectures in missing_syscall.h

3 years agoman: mention new OPTIONS=log_level= udev rule 17903/head
Yu Watanabe [Tue, 8 Dec 2020 14:11:03 +0000 (23:11 +0900)] 
man: mention new OPTIONS=log_level= udev rule

3 years agoudev: introduce new OPTIONS="log_level=" udev rule
Yu Watanabe [Tue, 8 Dec 2020 13:37:12 +0000 (22:37 +0900)] 
udev: introduce new OPTIONS="log_level=" udev rule

3 years agoudev: introduce log_device_uevent() helper function
Yu Watanabe [Tue, 8 Dec 2020 13:36:42 +0000 (22:36 +0900)] 
udev: introduce log_device_uevent() helper function

And this drops duplicated check for seqnum and device action.

3 years agoudev: drop meaningless size optimization
Yu Watanabe [Tue, 8 Dec 2020 12:49:34 +0000 (21:49 +0900)] 
udev: drop meaningless size optimization

These objects are not allocated multiple times simultaneously per
single process.

3 years agoMerge pull request #17869 from DaanDeMeyer/mkosi-gdb
Lennart Poettering [Wed, 9 Dec 2020 20:09:59 +0000 (21:09 +0100)] 
Merge pull request #17869 from DaanDeMeyer/mkosi-gdb

mkosi: Add gdb to final images

3 years agoMerge pull request #17884 from poettering/test-dlopen
Lennart Poettering [Wed, 9 Dec 2020 20:09:33 +0000 (21:09 +0100)] 
Merge pull request #17884 from poettering/test-dlopen

tests: add test that dlopen()s our weak shared library deps once

3 years agoudev: link_update() should fail if the entry in symlink dir couldn't have been created
Franck Bui [Wed, 9 Dec 2020 08:46:08 +0000 (09:46 +0100)] 
udev: link_update() should fail if the entry in symlink dir couldn't have been created

Follow-up for 30f6dce62cb3a738b20253f2192270607c31b55b

3 years agovirt: drop /proc/1/sched hack
Lennart Poettering [Wed, 9 Dec 2020 15:16:21 +0000 (16:16 +0100)] 
virt: drop /proc/1/sched hack

On really old kernels (< 4.14+) a bug in /proc/1/sched handling in the
kernel could be used to determine whether we are running in a PID
namespace. This hasn't worked for a long time, and there's little point
in making things work on old kernels we can't make work on current
kernels, hence let's drop that old cruft.

See: #8153

3 years agomkosi: Add strace to final images 17869/head
Daan De Meyer [Wed, 9 Dec 2020 17:28:51 +0000 (17:28 +0000)] 
mkosi: Add strace to final images

Useful for debugging purposes.