Commit Graph

45982 Commits

Author SHA1 Message Date
Yu Watanabe f91b234077 test-network: drop unnecessary sleep() in NetworkdStateFileTests.test_state_file 2020-07-22 19:55:15 +09:00
Yu Watanabe 1b14222124 network: make bus methods sync link state file 2020-07-22 19:55:15 +09:00
Yu Watanabe c2a6595014 network: introduce link_save_and_clean() 2020-07-22 19:55:14 +09:00
Yu Watanabe f281fc1e95 tree-wide: use siphash24_compress_string() where it is applicable 2020-07-22 19:55:14 +09:00
Yu Watanabe 1c568d65ac util: introduce siphash24_compress_string() 2020-07-22 19:55:14 +09:00
Yu Watanabe 6c04fccb1d util: make siphash24_compress_boolean() inline
This also changes the stored type from int to uint8_t in order to make
hash value endianness independent.
2020-07-22 19:55:14 +09:00
Zbigniew Jędrzejewski-Szmek e3643b00a8 test-path: decrease variable scope 2020-07-22 12:12:54 +02:00
Zbigniew Jędrzejewski-Szmek 8f8c7801e9 test: increase timeout for test-path
The CI occasionally fail in test-path with a timeout. test-path loads
units from the filesystem, and this conceivably might take more than
the default limit of 3 s. Increase the timeout substantially to see if
this helps.
2020-07-22 12:12:36 +02:00
Zbigniew Jędrzejewski-Szmek 2859bb932b
Merge pull request #16530 from yuwata/udev-fix-race-in-renaming-network-interface
udev: fix race in renaming network interface
2020-07-22 11:50:09 +02:00
Lennart Poettering 63fdaa36c5
Merge pull request #16407 from bluca/verity_reuse
verity: re-use already open devices if the hashes match
2020-07-22 11:36:49 +02:00
Zbigniew Jędrzejewski-Szmek 8fa2cd83c6 Revert "man: add note about systemd-vconsole-setup.service and tty as input/output"
This reverts commit 0b57803630.

From https://github.com/systemd/systemd/pull/16503#issuecomment-660212813:
systemd-vconsole-setup (the binary) is supposed to run asynchronously by udev
therefore ordering early interactive services after systemd-vconsole-setup.service
has basically no effect.

Let's remove this paragraph. It's better to say nothing than to give pointless
advice.
2020-07-22 10:43:52 +02:00
Elisei Roca 2aa5a13aa9 test: adapt test-functions for SUSE 2020-07-22 10:42:42 +02:00
Zbigniew Jędrzejewski-Szmek f25e9eda52
Merge pull request #16514 from keszybz/zstd-decompress-fix
Fix coredumpctl operation with zstd-compressed journals
2020-07-22 10:40:19 +02:00
Zbigniew Jędrzejewski-Szmek b876b07812
Merge pull request #16540 from poettering/acl-fix
two ACL handling fixes
2020-07-22 10:34:12 +02:00
Luca Boccassi ac1f3ad05f verity: re-use already open devices if the hashes match
Opening a verity device is an expensive operation. The kernelspace operations
are mostly sequential with a global lock held regardless of which device
is being opened. In userspace jumps in and out of multiple libraries are
required. When signatures are used, there's the additional cryptographic
checks.

We know when two devices are identical: they have the same root hash.
If libcrypsetup returns EEXIST, double check that the hashes are really
the same, and that either both or none have a signature, and if everything
matches simply remount the already open device. The kernel will do
reference counting for us.

In order to quickly and reliably discover if a device is already open,
change the node naming scheme from '/dev/mapper/major:minor-verity' to
'/dev/mapper/$roothash-verity'.

Unfortunately libdevmapper is not 100% reliable, so in some case it
will say that the device already exists and it is active, but in
reality it is not usable. Fallback to an individually-activated
unique device name in those cases for robustness.
2020-07-21 23:42:03 +01:00
Luca Boccassi 536879480a dm-util: use CRYPT_DEACTIVATE_DEFERRED instead of ioctl 2020-07-21 23:26:41 +01:00
Lennart Poettering d81be4e752 coredump: port to use common add_acls_for_user()
It's line-by-line the same logic, hence use the common implementation.
2020-07-21 22:58:40 +02:00
Lennart Poettering 2ea6247e01 acl-util: fix error handling in add_acls_for_user() 2020-07-21 22:58:40 +02:00
Lennart Poettering 002674387c offline-passwd: use chase_symlinks()
In case the passwd/group file is symlinked, follow things correctly.

Follow-up for: #16512
Addresses: https://github.com/systemd/systemd/pull/16512#discussion_r458073677
2020-07-21 22:31:00 +02:00
Lennart Poettering 628db21130 update TODO 2020-07-21 17:46:14 +02:00
Zbigniew Jędrzejewski-Szmek 0da322d9a4 man: update docs with the new functions and other enhancements 2020-07-21 17:42:16 +02:00
Zbigniew Jędrzejewski-Szmek 7cbb7d62c6 homectl: fix warning about unused function
../src/home/homectl-pkcs11.c:19:13: warning: ‘pkcs11_callback_data_release’ defined but not used [-Wunused-function]
   19 | static void pkcs11_callback_data_release(struct pkcs11_callback_data *data) {
      |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
2020-07-21 17:42:16 +02:00
Zbigniew Jędrzejewski-Szmek 06847d0fba TODO: add entry for XZ
The docs for XZ don't seem to answer this at first blush, or maybe
I'm looking in the wrong place... This might make XZ less terribly slow,
but on the other hand, almost nobody uses it, so it doesn't matter that
much.
2020-07-21 17:42:15 +02:00
Zbigniew Jędrzejewski-Szmek e4a321fc08 journal/compress: remove loop in decompress_startswith_zstd()
This should be more efficient with no downsides. Same considerations as in the
previous commit hold.
2020-07-21 17:42:15 +02:00
Zbigniew Jędrzejewski-Szmek a24153279e journal/compress: fix zstd decompression with capped output size
decompress_blob_zstd() would allocate ever bigger buffers in a loop trying to
get a buffer big enough to decompress the input data. This is wasteful, since
we can just query the size of the decompressed data from the compressed header.
Worse, it doesn't work when the output size is capped, i.e. when dst_max != 0.
If the decompressed blob happened to be bigger than dst_max, decompression
would fail with -ENOBUFS. We need to use "stream decompression" instead, and
only get min(uncompressed size, dst_max) bytes of output.

Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1856037 in a second way.
2020-07-21 17:42:15 +02:00
Zbigniew Jędrzejewski-Szmek b4a11ca3f2 journal: use -EPROTONOSUPPORT for unknown compression
We might add more compression types in the future, and we should treat that
as unsupported, and not a format error.
2020-07-21 17:42:15 +02:00
Zbigniew Jędrzejewski-Szmek 76cbafcdd4 sd-journal: when enumerating, continue even after an inaccessible field
SD_JOURNAL_FOREACH_DATA() and SD_JOURNAL_FOREACH_UNIQUE() would immediately
terminate when a field couldn't be accessed. This can happen for example when a
field is compressed with an unavailable compression format. But it's likely
that this is the wrong thing to do: the caller for example might want to
iterate over the fields but isn't interested in all of them. coredumpctl is
like this: it uses SD_JOURNAL_FOREACH_DATA() but only uses a subset of the
fields.

Add two new functions sd_journal_enumerate_good_data() and
sd_journal_enumerate_good_unique() that retry sd_journal_enumerate_data() and
sd_journal_enumerate_unique() if the return value is something that applies to
a single field: ENOBUS, E2BIG, EOPNOTSUPP.

Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1856037.

An alternative would be to make the macros themselves smarter instead of adding
new symbols, and do the looping internally in the macro. I don't like that
approach for two reasons. First, it would embed the logic in the macro, so
recompilation would be required if we decide to update the logic. With the
current version of the patch, recompilation is required to use the new symbols,
but after that, library upgrades are enough. So the current approach is safer
in case further updates are needed. Second, our headers use primitive C, and it
is hard to do the macros without using newer features.
2020-07-21 17:42:11 +02:00
Lennart Poettering 04dffc0add user-util: indentation fix 2020-07-21 17:41:57 +02:00
Lennart Poettering 58afc4f8e4 core: don't acquire dual timestamp needlessly if we don't need it in .timer handling
Follow-up for: 26698337f3
2020-07-21 17:33:47 +02:00
Lennart Poettering d3926f9a46 test: add basic test for clock mapping 2020-07-21 17:33:47 +02:00
Lennart Poettering 7c0eb30e32 time-util: rework clock conversion logic
Let's split this out into its own helper function we can reuse at
various places.

Also, let's avoid signed values where we can so that we can cover more
of the available time range.
2020-07-21 17:30:49 +02:00
Lennart Poettering 4c967576da update NEWS 2020-07-21 16:24:41 +02:00
Lennart Poettering 6456dafa12
Merge pull request #16504 from poettering/read-file-ipc
fileio: teach read_full_file() the ability to read data from AF_UNIX stream socket
2020-07-21 14:16:32 +02:00
Lennart Poettering c400d040ce import: always prefer GNU tar, to avoid cmdline incompatibilities
Fixes: #16506
2020-07-21 14:16:02 +02:00
Lennart Poettering 3177b9270c fileio: add brief explanations for flags 2020-07-21 10:32:01 +02:00
Lennart Poettering 49f16281c9 tree-wide: use READ_FULL_FILE_CONNECT_SOCKET at various places
Let's use the new flag wherever we read key material/passphrases/hashes
off disk, so that people can plug in their own IPC service as backend if
they like, easily.

(My main goal was actually to support this for crypttab key files — i.e.
that you can specify AF_UNIX sockets as third column in crypttab — but
that's harder to implement, since the keys are read via libcryptsetup's
API, not ours.)
2020-07-21 10:32:01 +02:00
Lennart Poettering c668aa8b35 fileio: allow to read base64/hex data as strings
There's really no reason to prohibit this, hence don't.
2020-07-21 10:31:50 +02:00
Lennart Poettering b93d3f6b81 fileio: add support for read_full_file() on AF_UNIX stream sockets
Optionally, teach read_full_file() the ability to connect to an AF_UNIX
socket if the specified path points to one.
2020-07-21 10:23:44 +02:00
Lennart Poettering f294470262 fileio: add explicit flag for generating world executable warning when reading file 2020-07-21 09:56:44 +02:00
Zbigniew Jędrzejewski-Szmek 2e3e2750bb
Merge pull request #16519 from yuwata/networkctl-altnames
networkctl: tiny cleanups about alternative names
2020-07-21 09:10:00 +02:00
Zbigniew Jędrzejewski-Szmek 739b9a4354
Merge pull request #16353 from yuwata/network-dns-sni
resolve, network: more SNI and port number support
2020-07-21 08:06:17 +02:00
Yu Watanabe 28266c446a udev: drop unnecessary checks
Also, drop one unnecessary sd_device_unref(), as dev_db_clone will be
unref()ed in udev_event_free().
2020-07-21 11:55:28 +09:00
Yu Watanabe ae353ec2f6 udev: save ID_RENAMING= property to database before renaming network interface 2020-07-21 11:55:28 +09:00
Yu Watanabe 1cdea1a2f7 network: update one log message 2020-07-21 11:55:28 +09:00
Luca Boccassi 08de6f945d test: run systemd-dissect and systemd-run with log level debug in TEST-50-DISSECT 2020-07-21 10:03:10 +09:00
Hans de Goede 3a978b30cd logind: Fix org.freedesktop.login1.set-reboot-to-boot-loader-menu saving to the wrong file in the non EFI case
According to the docs, and to the
org.freedesktop.login1.get-reboot-to-boot-loader-menu code, the
(oneshot) boot-loader-menu timeout should be stored in
/run/systemd/reboot-to-boot-loader-menu, but the set method was storing it
in /run/systemd/reboot-to-loader-menu.

This commit fixes this. Note that the fixed name also is a better match
for the dbus call names and matches the related
/run/systemd/reboot-to-boot-loader-entry structure, so fixing the set code,
rather then the get code + docs seems like the right thing to do here.
2020-07-21 10:02:34 +09:00
fangxiuning ddbab78f9a bus: use bus_log_connect_error to print error message 2020-07-21 10:02:01 +09:00
Yu Watanabe 711dd5db9e man: update explanation about the format to specify DNS servers 2020-07-21 04:12:16 +09:00
Yu Watanabe a574b7d152 resolvectl: use bus_message_read_in_addr_auto() 2020-07-21 04:12:11 +09:00
Yu Watanabe 7695e2cbbe network, resolve: use bus_message_read_ifindex() or friends 2020-07-21 04:08:22 +09:00