Commit Graph
34349 Commits
Author SHA1 Message Date
Yu Watanabe d34e3b76e5 syscalls: update tables 2021-06-15 19:07:11 +09:00
Yu Watanabe a3f5f4a5c0 fix typo 2021-06-15 14:19:30 +09:00
Yu Watanabe 7802194ac0 tree-wide: add missing whitespace at the end of comments 2021-06-15 14:09:29 +09:00
Yu Watanabe f7bef77a16 Merge pull request #19924 from yuwata/sd-event-fix-assertion
sd-event: fix assrtion in sleep_between()
2021-06-15 13:34:03 +09:00
Khem Raj 0643eb47a0 test-seccomp: Check for __NR_ppoll before use (#19858)
some newer architectures like riscv32 do not have __NR_ppoll from get go
2021-06-15 13:12:30 +09:00
Yu Watanabe 9868493e17 Merge pull request #19913 from yuwata/network-fix-counter
network: add missing increment of Link::set_flags_messages
2021-06-15 10:51:24 +09:00
Lennart Poettering 05a2166a06 repart: show partitions we don't grow/create as "unchanged"
The previous string was "unknown", but that's wrong, because we *do*
know what we are going to do with those partitions: we leave them
unmodified, hence say "unchanged" in the output, to be clearer.
2021-06-15 05:39:33 +09:00
Lennart Poettering 9c07c9ec0e repart: align all sizes in table to the right 2021-06-15 05:39:33 +09:00
Yu Watanabe 2502e7befe Merge pull request #19905 from yuwata/network-set-mac-try-again
network: try to bring down interface before setting MAC address
2021-06-15 05:35:45 +09:00
Yu Watanabe 710fa1b3fb network: update wlan information when IFF_LOWER_UP flag is gained
Fixes the issue mentioned at
https://github.com/systemd/systemd/issues/19832#issuecomment-860269320.
2021-06-15 05:14:22 +09:00
Yu Watanabe 7f80fa12c2 network: add brief comment about reconfiguring interfaces
This also renames link_reconfigure_internal() -> link_reconfigure_impl().
2021-06-15 05:12:25 +09:00
Yu Watanabe ecb3deccdc network: do not partially update wlan information on failure 2021-06-15 04:32:31 +09:00
Yu Watanabe 7149bde4ba network: add missing increment of Link::set_flags_messages
link_up_or_down() will decrement the counter when the subsequent
RTM_GETLINK netlink method is finished. So, we need to increment
the counter here.

Fixes the issue mentioned at
https://github.com/systemd/systemd/issues/19832#issuecomment-860255692.
2021-06-15 03:58:59 +09:00
Yu Watanabe 0f97b7c338 core/service: fix assertion when Type=dbus but BusName= is not specified
Fixes #19920.
2021-06-15 03:06:09 +09:00
Yu Watanabe 2115b9b662 sd-event: always reshuffle time prioq on changing online/offline state
Before 81107b8419, the compare functions
for the latest or earliest prioq did not handle ratelimited flag.
So, it was ok to not reshuffle the time prioq when changing the flag.

But now, those two compare functions also compare the source is
ratelimited or not. So, it is necessary to reshuffle the time prioq
after changing the ratelimited flag.

Hopefully fixes #19903.
2021-06-15 02:34:26 +09:00
Yu Watanabe 5c08c7ab23 sd-event: make event_source_time_prioq_reshuffle() accept all event source type
But it does nothing for an event source which is neither a timer nor
ratelimited.
2021-06-15 02:34:16 +09:00
Yu Watanabe a595fb5ca9 sd-event: use usec_add() 2021-06-15 01:01:48 +09:00
Yu Watanabe 06e131477d sd-event: use CMP() macro 2021-06-15 00:51:33 +09:00
Yu Watanabe 7e2bf71ca3 sd-event: drop unnecessary "else" 2021-06-15 00:44:04 +09:00
Topi Miettinen 1753d30215 Revert "Mount all fs nosuid when NoNewPrivileges=yes"
This reverts commit d8e3c31bd8.

A poorly documented fact is that SELinux unfortunately uses nosuid mount flag
to specify that also a fundamental feature of SELinux, domain transitions, must
not be allowed either. While this could be mitigated case by case by changing
the SELinux policy to use `nosuid_transition`, such mitigations would probably
have to be added everywhere if systemd used automatic nosuid mount flags when
`NoNewPrivileges=yes` would be implied. This isn't very desirable from SELinux
policy point of view since also untrusted mounts in service's mount namespaces
could start triggering domain transitions.

Alternatively there could be directives to override this behavior globally or
for each service (for example, new directives `SUIDPaths=`/`NoSUIDPaths=` or
more generic mount flag applicators), but since there's little value of the
commit by itself (setting NNP already disables most setuid functionality), it's
simpler to revert the commit. Such new directives could be used to implement
the original goal.
2021-06-15 00:33:22 +09:00
Luca Boccassi 2fbb5df8e9 Merge pull request #19898 from yuwata/network-multipath-route-without-interface-name
network: set link ifindex when multi-path routes specified without interface name
2021-06-14 14:27:50 +01:00
Luca Boccassi feaf43158a Merge pull request #19894 from yuwata/network-fix-configure-without-carrier
network: always check dynamic address assignments before entering con…
2021-06-14 14:23:09 +01:00
Luca Boccassi 1340574cf7 Merge pull request #19866 from yuwata/sd-device-new-from-ifindex
sd-device: introduce sd_device_new_from_ifindex()
2021-06-14 14:21:17 +01:00
Yu Watanabe b5d0fd1e7f network: drop misleading debugging logs about MTU
This fixes the following spurious logs on enumerating links:
```
wlan0: Saved original MTU 1500 (min: 256, max: 2304)
wlan0: MTU is changed: 0 → 1500 (min: 256, max: 2304)
```
2021-06-14 14:19:02 +01:00
Yu Watanabe d05c332c8d network: try to bring down before setting MAC address
Most real network devices refuse to set MAC address when its operstate
is not down. So, setting MAC address once failed, then let's bring down
the interface and retry to set.

Closes #6696.
2021-06-14 20:42:54 +09:00
Yu Watanabe 5388e103ea network: check the size of hardware address before setting MAC address
Also, skip to set MAC address when the current address equals to the
requrested one.
2021-06-14 20:42:50 +09:00
Jayanth Ananthapadmanaban 279082ed49 Add a network timeout option to journal-upload 2021-06-14 11:16:38 +02:00
Yu Watanabe 4bcb862548 network: always check dynamic address assignments before entering configured state
Previously (v248 or earlier), even if no static address is configured,
the link did not enter configured state, as e.g. Link::static_addresses_configured
is false until the link gained its carrier.
But, after the commit 1187fc3375, the
situation was changed. Static addresses, routes, and etc are requested even
if the link does not have its carrier, and thus the link enters configured
state when no static address and etc are specified.

This makes the link does not enter configured state before it gains its
carrier when at least one of dynamic address assignment protocols (e.g.
DHCP) except for NDISC is enabled.

Note that, unfortunately, netplan always enables ConfigureWithoutCarrier=
for all virtual devices, e.g. bridge. See,
https://github.com/canonical/netplan/commit/978e20f902f6b92a46dc6e0050e2172e834e4617
So, we need to support e.g. the following strange config:
```
[Netowkr]
ConfigureWithoutCarrier=yes
DHCP=yes
```

Fixes #19855.
2021-06-12 08:51:16 +09:00
Yu Watanabe 08c2fcdc0d network: route: set link ifindex when multi-path routes specified without interface name
And do not set RTA_OIF attribute when multi-path routes are specified.
See kernel's fib_get_nhs() in net/ipv4/fib_semantics.c.

Fixes #19890.
2021-06-12 05:34:52 +09:00
Yu Watanabe af7b405dff sd-dhcp: refuse to set iaid if we cannot find the interface 2021-06-12 03:19:08 +09:00
Yu Watanabe 8d71f2b3a6 dhcp: do not use ifindex when generating iaid in tests 2021-06-12 03:19:08 +09:00
Yu Watanabe 0299deab53 sd-dhcp: do not use detect_container() to guess udev is running or not 2021-06-12 03:19:08 +09:00
Yu Watanabe 27fce94ae6 nspawn: path_is_read_only_fs() may return negative errno
And we usually assume /sys is not read only on error.
2021-06-12 03:19:08 +09:00
Yu Watanabe 0ac655a63b tree-wide: use sd_device_new_from_ifindex/ifname() 2021-06-12 03:19:08 +09:00
Yu Watanabe bd44a727f7 sd-device: introduce sd_device_new_from_ifname/ifindex() 2021-06-12 03:19:08 +09:00
Yu Watanabe afdf6c3b60 netlink: make rtnl_resolve_link_alternative_name() optionally return the main interface name 2021-06-12 03:19:08 +09:00
Yu Watanabe 57bd6aa701 netlink: check input name is valid before calling netlink method 2021-06-12 03:19:08 +09:00
Yu Watanabe f6e491547d netlink: move resolve_ifname() or friends to netlink-util.[ch] 2021-06-12 03:19:08 +09:00
Yu Watanabe f0ad7aedd9 network: use link_get_by_name() 2021-06-12 03:19:08 +09:00
Zbigniew Jędrzejewski-Szmek e77365b479 Merge pull request #19882 from keszybz/test-stat-util-more
Add a test for path_is_read_only_fs()
2021-06-11 18:44:58 +02:00
Michal Koutný cc815b7fea core: Avoid spurious realization of unit cgroups
Cgroups may be unnecessarily realized when they are not needed. This
happens, e.g. for mount units parsed from /proc/$PID/mountinfo, check

        touch /run/ns_mount
        unshare -n sh -c "mount --bind /proc/self/ns/net /run/ns_mount"
        # no cgroup exists
        file /sys/fs/cgroup/system.slice/run-ns_mount.mount
        systemctl daemon-reload
        # the vain cgroup exists
        file /sys/fs/cgroup/system.slice/run-ns_mount.mount

. (Such cgroups can account to a large number with many similar mounts.)

The code already accounts for "lazy" realization (see various checks for
Unit.cgroup_realized) but the unit_deserialize() in the reload/reexec
path performs unconditional realization.

Invalidate (and queue) the units for realization only if we know that
they were already realized in the past. This is a safe thing to do even
in the case the reload brings some new cgroup setting (controllers, BPF)
because units that aren't realized will use the updated setting when the
time for their realization comes. (It's not even needed to add a code
comment because the current formulation suggests the changed behavior.)
2021-06-11 10:34:22 +01:00
Zbigniew Jędrzejewski-Szmek 51db8fdb92 test-stat-util: don't fail under chroot
I wanted to see what is_path_read_only_fs() and is_path_temporary_fs() return
in a chroot, and various tests would fail. For most of our codebase, we can
assume that /proc and such are mounted, and it doesn't make sense to make the
tests work in a chroot. But let's do it here. (In general, it would be useful
for most stuff in src/basic/, since it's linked into libraries which might be
invoked in incorrectly set up environments and should not fail too badly.)
2021-06-11 07:40:53 +02:00
Luca Boccassi 7ad9bad71b Merge pull request #19811 from anitazha/revert_mount_rl
sd-event: fix failure to exit rate limiting state
2021-06-10 23:41:55 +01:00
Luca Boccassi 390a22f4b1 Merge pull request #19864 from keszybz/serialization-cleanup
Serialization cleanup
2021-06-10 23:40:23 +01:00
nl6720 9dfb429a44 kbd-model-map: add Latvian keyboard layout mapping 2021-06-10 23:29:32 +01:00
Zbigniew Jędrzejewski-Szmek 6080987130 Merge pull request #18851 from yuwata/dissect-try-to-find-partition-on-timeout
dissect: try to find partition more frequently
2021-06-10 19:09:18 +02:00
Zbigniew Jędrzejewski-Szmek c3988f36d3 Merge pull request #19870 from keszybz/install-foo-again
Tweak the install logic again
2021-06-10 18:56:03 +02:00
Zbigniew Jędrzejewski-Szmek ab18976b35 core/serialize: drop bogus deserialization of ipcns sockets
a70581ffb5 added ExecRuntime.ipcns_storage_socket[], and
serialization in exec_runtime_serialize(), and deserialization in exec_runtime_deserialize_one(),
but also deserialization in exec_runtime_deserialize_compat(). exec_runtime_deserialize_compat()
is for deserializating ExecRuntime when it was serialized as part of the unit before
e8a565cb66. There was never any code which would serialize
ExecRuntime.ipcns_storage_socket[] this way, so the deserialization attempts are pointless.
2021-06-10 14:17:58 +02:00
Zbigniew Jędrzejewski-Szmek cbc165d17e core/serialization: shorten code, treat all oom error the same 2021-06-10 14:17:58 +02:00
Zbigniew Jędrzejewski-Szmek 1085c0eb69 core/serialization: drop misleadingly-named unit_can_serialize()
All unit types can be serialized. This function was really checking whether the
unit type has custom serialization/deserialization code. But we don't need a
function for this.

Also, the check that both .serialize() and .deserialize_item() are defined is
better written as an assert. Not we have a function which would skip
serialization/deserializaton for the unit if we forgot to set either of the
fields.
2021-06-10 14:17:58 +02:00