1
0
mirror of https://github.com/systemd/systemd.git synced 2025-02-03 17:47:28 +03:00

56504 Commits

Author SHA1 Message Date
Lennart Poettering
994b303123 repart: fix sector size handling
This queries the sector size from libfdisk instead of assuming 512, and
uses that when converting from bytes to the offset/size values libfdisk
expects.

This is an alternative to Tom Yan's #21823, but prefers using libfdisk's
own ideas of the sector size instead of going directly to the backing
device via ioctls. (libfdisk can after all also operate on regular
files, where the sector size concept doesn't necessarily apply the same
way.)

This also makes the "grain" variable, i.e. how we'll align the
partitions. Previously this was hardcoded to 4K, and that still will be
the minimum grain we use, but should the sector size be larger than that
we'll use the next multiple of the sector size instead.
2022-02-08 10:47:48 +01:00
Yu Watanabe
ecdfb9a1ae resolve: reuse timer event source for DnsQuery
If the query get CNAME or DNAME, then the query will be restarted.
Even in that case, previously, the event source was freed and allocated
again. Let's slightly optimize it.
2022-02-08 17:39:03 +09:00
Yu Watanabe
c704288c47 resolve: use _cleanup_ attribute for freeing DnsQuery 2022-02-08 17:38:42 +09:00
Yu Watanabe
fe8c5ce615 resolve: fix possible memleak
Fortunately, unlike the issue fixed in the previous commit, the memleak
should be superficial and not become apparent, as the queries handled
here are managed by the stub stream, and will be freed when the stream
is closed.

Just for safety, and slightly reducing the runtime memory usage by the
stub stream.
2022-02-08 17:38:42 +09:00
Yu Watanabe
73bfd7be04 resolve: fix potential memleak and use-after-free
When stub stream is closed early, then queries associated to the stream
are freed. Previously, the timer event source for queries may not be
disabled, hence may be triggered with already freed query.
See also dns_stub_stream_complete().

Note that we usually not set NULL or zero when freeing simple objects.
But, here DnsQuery is large and complicated object, and the element may
be referenced in subsequent freeing process in the future. Hence, for
safety, let's set NULL to the pointer.
2022-02-08 17:35:53 +09:00
Matt Walton
ec82f867ee hwbd: 60-sensor.hwdb: Add Pipo W2Pro
Add accelerometer matrix for Pipo W2Pro tablet. Y-axis was backwards (normal <--> bottom-up).
2022-02-07 21:34:42 +00:00
Benjamin Berg
100abbc650 oom: Cleanup of information dump code after kill
This is a follow up to 29f4185a9cdc ("oomd: Dump top offenders after a
kill action") to clean up the code a bit for review comments that
happened after the code had been merged already.
2022-02-07 21:33:50 +00:00
Lennart Poettering
8eb0c7917d watchdog: work around Coverity confusion
Coverity (and I, initially) get really confused about "fn"'s validity
here. it doesn't grok that free_and_strdup() is actually a NOP in case
the string isn't changed, and assumes it always invalidates the
specified buffer, which it doesn't do though.

Follow-up for: f4b1a6b6419b771d26342a9b75b1d77ee9d90133
2022-02-07 20:48:36 +00:00
Daan De Meyer
952d1e784a journal: Improve handling of corruption during upwards entry iteration
If we're going upwards in the journal file during entry iteration and we
can't reach the current entry due to corruption, start iterating upwards
from the last reachable entry array. This is equivalent to skipping
all entries in the array that can't be reached anymore.

Fixes #22431
2022-02-07 20:40:30 +00:00
Daan De Meyer
aa00163d79 journal: Fix upwards iteration of entry items in case of corruption
8d801e35cb155faa08235a5af8b4d6ad60715837 didn't take into account
upwards iteration of entry items when we're working on a corrupted
journal file. Instead of moving to the previous entry array, we'd
always move to the next array, regardless of the iteration direction.

To fix this, we introduce bump_entry_array() that moves to the next
or previous entry array depending on the given direction. Since the
entry array chains are singly linked lists, we have to start iterating
from the front to find the previous array. We only reach this logic
if we're working on a corrupted journal file so being slow here shouldn't
matter too much.
2022-02-07 20:40:28 +00:00
Luca Boccassi
3c84905b08
Merge pull request #22383 from yuwata/network-generator-keep-configuration
network: enable KeepConfiguration= when running on network filesystem
2022-02-07 18:06:24 +00:00
Michael Biebl
153c8624aa login: typo fix 2022-02-08 02:36:22 +09:00
Michael Biebl
2f7a0648cd man: fix typo 2022-02-07 23:01:20 +09:00
bearhoney
d0515a289a Update CODING_STYLE.md
Fixed typo.
2022-02-07 10:46:22 +00:00
Evgeny Vereshchagin
be1eae4fad tests: also fuzz packets sent in the DHCP6_STATE_SOLICITATION state
With aborts enabled the fuzzer can catch issues like
26a63b8132
Let's extend it a bit to let it cover issues like
https://github.com/systemd/systemd/pull/22406#discussion_r798932098
2022-02-05 14:50:12 +09:00
Thomas Haller
58da18251f sd-dhcp6-client: fix sending prefix delegation request during rebind
Fixes an assertion failure "pd->type == SD_DHCP6_OPTION_IA_PD" in dhcp6_option_append_pd().

Something similar was done in commit 26a63b81322a ('sd-dhcp6-client: Fix
sending prefix delegation request (#17136)'). The justification is
probably the same.
2022-02-05 14:11:33 +09:00
Yu Watanabe
ea853de57d network: enable KeepConfiguration= when running on network filesystem
Also, set KeepConfiguration=dhcp-on-stop by default when running in
initrd.

Fixes #21967.
2022-02-05 09:42:32 +09:00
Yu Watanabe
166e8e36eb
Merge pull request #22416 from fbuihuu/misc
Misc
2022-02-05 09:26:40 +09:00
Anita Zhang
a714b15d46
Merge pull request #22395 from benzea/benzea/oomd-dump-offenders
oomd: Dump top offenders after a kill action
2022-02-04 14:44:04 -08:00
Benjamin Berg
29f4185a9c oomd: Dump top offenders after a kill action
This hopefully makes it more transparent why a specific cgroup was
killed by systemd-oomd.
2022-02-04 20:00:35 +01:00
Lennart Poettering
a2012854f5 man: systemd-stdio-bridge doesn't connect "two busses"
In D-Bus, clients connect to a bus (the usual case), or use direct
questions to each other (the unusual case). A bus is a program one can
connect to and implemented by dbus-daemon or dbus-broker. HOwever,
busses never connect between each other, that doesn't exist. Hence don't
claim so.

This is probably confusion about the fact that sd-bus calls D-Bus
connection objects just "sd_bus" for simplicity, given they are used in
99% of the cases to connect to a bus — only in exceptional cases they
are used for direct connections between peers without involving a bus.

Follow-up for b7bb58ef70b0c876941a1c31ed4e2f5f1dc5ed0e
2022-02-04 17:43:44 +00:00
Lennart Poettering
d94e8a5064 journal-file: explicitly handle file systems that do not support hole punching
Apparently the error code fallocate() returns if hole punching is not
supported is not too well defined (man page just says "an error is
returned"), hence let's accept the usual set of errors, and the
normalize it to EOPNOTSUPP, and generate a clear error message in this
case.
2022-02-04 16:37:39 +01:00
Lennart Poettering
47497593fa journal-file: fix error handling of pread() in journald_file_punch_holes() 2022-02-04 16:37:20 +01:00
Lennart Poettering
05aca54468
Merge pull request #22378 from bluca/on_fail_follow_ups
Follow-ups for #20833
2022-02-04 16:29:09 +01:00
Lennart Poettering
3474ee526a
Merge pull request #22375 from michaelolbrich/watchdog
fix watchdog handling during reboot
2022-02-04 16:28:41 +01:00
Ruben Kerkhof
331f44c149 systemd.netdev(5): fix acronym for DOVE extensions 2022-02-05 00:10:20 +09:00
Michael Olbrich
119d5126d1 shutdown: don't stop the watchdog
This basically reverts #22079.

Stopping the watchdog is wrong. The reboot watchdog is supposed to cover
the whole time from the point when systemd start systemd-reboot until the
hardware resets.
Otherwise the system may hang in the final shutdown phase.

Add a comment, why keeping the watchdog running is correct here.
2022-02-04 12:26:58 +01:00
Michael Olbrich
f4b1a6b641 watchdog: fix watchdog_set_device() when the default watchdog device is used
If watchdog_set_device() is not called before open_watchdog() then
'watchdog_device' remains 'NULL' while the device is open.

As a result, the "same device" check in watchdog_set_device() does not work
correctly: If no device is specified (e.g. from watchdog_free_device())
then the current fd is not closed.

Fix this by setting 'watchdog_device' to the correct device during
open_watchdog()
2022-02-04 12:26:58 +01:00
Franck Bui
e36b00e938 udev/net_id: show the correct identifier in the debug output of dev_pci_onboard() 2022-02-04 09:45:47 +01:00
Franck Bui
05c05dc0a3 core: make use of VALID_CHARS_WITH_AT in unit_name_is_valid() 2022-02-04 09:36:45 +01:00
Yu Watanabe
4e247216e5 stat-util: introduce path_is_network_fs() 2022-02-04 15:22:20 +09:00
Yu Watanabe
318a53d10a network-generator: rename DHCP_TYPE_DHCP -> DHCP_TYPE_DHCP4
To emphasize this is DHCPv4. No behavior is changed.
2022-02-04 13:59:42 +09:00
Davide Cavalca
2b560c6e54 hwdb: add HP calculators 2022-02-04 11:01:20 +09:00
Lennart Poettering
e6fccf029b hostnamed: trivial optimization 2022-02-03 22:51:51 +00:00
Luca Boccassi
1d2bf1f0ee portable: reopen socket with O_RDONLY
Follow-up for e3f7ed944ae750a40685c52349f3cc850db0876e
2022-02-03 22:50:56 +00:00
Luca Boccassi
75844b44ee
Merge pull request #22408 from mrc0mmand/test-network-cleanup
test-network: code cleanup
2022-02-03 22:50:38 +00:00
Anita Zhang
d83923bdb7
Merge pull request #22355 from yuwata/network-tunnel-external
network: tunnel: support external mode
2022-02-03 14:20:43 -08:00
Jan Janssen
ce5e7872f8 boot: Fix some error messages 2022-02-03 23:05:36 +01:00
Anita Zhang
1f087147ea
Merge pull request #22400 from poettering/resolved-single-invalid-list
resolved: maintain only a single list of "dont-resolve" domain names
2022-02-03 11:54:00 -08:00
Lennart Poettering
ff28d259c0 hostnamed: drop "iteractive" parameter from GetHardwareSerial()
Since a long time the D-Bus spec knows a special bit in its message
header for indicating that "interactive" authentication is OK. The
original hostnamed API is before that was added hence most functions
expose that boolean as explicit argument.

For new added functions let's get rid of it, the message flag is good
enough and replaces it with complete functionality.

No new APIs should carry the "interactive" boolean flag explicitly as
argument anymore.

Follow-up for: 9697662915e47a4797b05003cb1970fe2b01e530
2022-02-03 19:52:18 +00:00
Anita Zhang
79decacff0
Merge pull request #22394 from bluca/requires_restart_doc
man: explicitly mention that Requires propagates restarts
2022-02-03 11:50:06 -08:00
Lennart Poettering
f80c3d5c7a systemctl: use STR_IN_SET() where appropriate
Follow-up for: 8e98568165ee3db049160045d94ce030dc7fbb79
2022-02-03 18:56:53 +00:00
Frantisek Sumsal
87bf983c55 test-network: disable irrelevant or one-time pylint checks 2022-02-03 19:31:15 +01:00
Frantisek Sumsal
54e2f32f50 test-network: use specific exceptions instead of the Exception class 2022-02-03 19:30:11 +01:00
Frantisek Sumsal
a561bceeaa test-network: avoid name clashing/redefinition 2022-02-03 19:20:42 +01:00
Frantisek Sumsal
524cc9d1d8 test-network: disable 'no-member' warning for the Utilities class
The warning is correct, since we don't inherit the necessary
unittest.TestCase class, but that's on purpose, since the Utilities
class is not supposed to be instantiated on its own, but should
complement other classes' definitions which do inherit from the
unittest.TestCase class.
2022-02-03 19:13:06 +01:00
Frantisek Sumsal
283863a116 test-network: use raw strings for regexes with backslashes
It currently works because `\(` and `\)` are not valid escape sequences,
so they're not treated differently. Using raw strings (or double
backslashes) is a more correct solution.
2022-02-03 18:55:12 +01:00
Frantisek Sumsal
535e8107ee test-network: explicitly set check=False for subprocess.run()
since we're checking the returned error code explicitly via the
`returncode` member.
2022-02-03 18:49:35 +01:00
Frantisek Sumsal
f7805a6c79 test-network: convert certain multiline strings to comments
Multiline comments are converted to docstrings only when they're the
first statement in a function/method. Even though they're still a no-op
otherwise, let's use "true" comments to make pylint happy.
2022-02-03 18:42:41 +01:00
Frantisek Sumsal
45dbd0b945 test-network: drop unused variables 2022-02-03 18:18:29 +01:00