1
0
mirror of https://github.com/systemd/systemd.git synced 2025-01-11 09:18:07 +03:00
Commit Graph

56132 Commits

Author SHA1 Message Date
Lennart Poettering
73a4ac8a75 conf-parser: minor refactorings/modernizations 2022-02-09 10:17:17 +01:00
Lennart Poettering
deec0b6dd5 conf-parser: use _cleanup_free_ where appropriate 2022-02-09 10:17:13 +01:00
Lennart Poettering
2d17d699bb conf-parse: add generic config_parse_safe_string() helper
This helper is just like config_parse_string() but does some superficial
checks for control characters and quotes.

In most cases we currently use config_parse_string() we probably want to
use config_parse_safe_string() for safety reasons.
2022-02-09 10:16:42 +01:00
Santa Wiryaman
97f27f8a16 Add support for isolated parameter
Add the "Isolated" parameter in the *.network file, e.g.,

[Bridge]
Isolated=true|false

When the Isolated parameter is true, traffic coming out of this port
will only be forward to other ports whose Isolated parameter is false.

When Isolated is not specified, the port uses the kernel default
setting (false).

The "Isolated" parameter was introduced in Linux 4.19.
See man bridge(8) for more details.
But even though the kernel and bridge/iproute2 recognize the "Isolated"
parameter, systemd-networkd did not have a way to set it.
2022-02-09 17:37:37 +09:00
Evgeny Vereshchagin
10139b4e3c ci: validate actions and fix actionlint warnings
some actions like Coverity and CFLite aren't run on every PR so to make
sure they are more or less fine when they are changed it makes sense to
at least check them with superlinter/actionlint: https://github.com/rhysd/actionlint

The following warnings were fixed along the way:
```
.github/workflows/mkosi.yml:55:7: shellcheck reported issue in this script: SC2086:info:6:14: Double quote to prevent globbing and word splitting [shellcheck]
   |
55 |       run: |
   |       ^~~~
.github/workflows/mkosi.yml:55:7: shellcheck reported issue in this script: SC2046⚠️6:40: Quote this to prevent word splitting [shellcheck]
   |
55 |       run: |
   |       ^~~~
.github/workflows/mkosi.yml:55:7: shellcheck reported issue in this script: SC2006:style:6:40: Use $(...) notation instead of legacy backticked `...` [shellcheck]
   |
55 |       run: |
   |       ^~~~
```
```
.github/workflows/coverity.yml:31:9: shellcheck reported issue in this script: SC2086:info:1:93: Double quote to prevent globbing and word splitting [shellcheck]
   |
31 |         run: echo "COVERITY_SCAN_NOTIFICATION_EMAIL=$(git log -1 ${{ github.sha }} --pretty=\"%aE\")" >> $GITHUB_ENV
   |         ^~~~
```
2022-02-09 17:32:41 +09:00
Eduard Tolosa
7060c656ed Update footer.html 2022-02-08 21:59:10 +01:00
Lennart Poettering
4d6ce52e7b
Merge pull request #22446 from poettering/sd-boot-cpuid-vm-tscd
sd-boot: don't read TSC in VM environments, and other TSC fixes
2022-02-08 21:57:38 +01:00
Yu Watanabe
5573ed2230
Merge pull request #22448 from poettering/coredump-raise-sizes
coredump: raise limits
2022-02-09 01:23:07 +09:00
Yu Watanabe
217a610be4 Revert "ci: switch to fedora-35 on i386 on Packit"
This reverts commit 478c632e00.
2022-02-08 19:00:28 +03:00
Yu Watanabe
319af1314a Revert "packit: switch the remaining jobs to F35"
This reverts commit e7642152ae.
2022-02-08 19:00:28 +03:00
Yu Watanabe
18f84f8aba udev/net: support to set MDI-X mode
Closes #22386.
2022-02-08 15:47:46 +00:00
Lennart Poettering
74694002e6
Merge pull request #22423 from poettering/repart-sector-size
repart: fix sector size handling
2022-02-08 14:47:00 +01:00
Curtis Klein
d6463a399d watchdog: saturate to kernel's max watchdog timeout
Since version 4.5, the max possible timeout is UINT_MAX / 1000 since it
does calculations in milliseconds. A small helper function is added to
make this conversion and saturation and will be used more in the next
commit.

Also document the usage of signed integers by the kernel userspace API.
2022-02-08 14:43:12 +01:00
Lennart Poettering
9eb0583feb
Merge pull request #22442 from DaanDeMeyer/fix-entry-iteration
journal: Fix entry array iteration in case of corruption
2022-02-08 14:29:24 +01:00
Daan De Meyer
586e485042
Merge pull request #22366 from poettering/journal-file-punch-fix
journald: some journal file hole punching fixes
2022-02-08 13:03:03 +00:00
Lennart Poettering
3bcc999fa5 sd-boot: don't use TSC in virtualized environments
Replaces: f699bd81e8

Fixes: #22060
2022-02-08 13:46:26 +01:00
Lennart Poettering
16cec133c6 sd-boot: return 0 (not 1) from ticks_read() in fallback implementation
The single consumer of ticks_read() (i.e. time_usec()) checks for == 0
to detect the "not supported/invalid" case, hence actually return the
right value for that.
2022-02-08 13:46:23 +01:00
Lennart Poettering
fb63526f72 sd-boot: encapsulate freq cache in ticks_freq()
It's usually nicer to abstract a cache away in the provider of a value,
hence do so.
2022-02-08 13:46:20 +01:00
Lennart Poettering
efbb86797d sd-boot: don't export ticks_read() and ticks_freq()
They only have a single user in time_usec(), hence don't expose them.
2022-02-08 13:46:17 +01:00
Lennart Poettering
476c0e969a sd-boot: add overflow check to TSC reads
On some archs the counter is 32bit, and in case of virtualization it
might actually overflow, who knows.
2022-02-08 13:46:14 +01:00
Lennart Poettering
1e66a23373 sd-boot: split out TSC/time API
These are a whole family of functions, let's give them their own .c/.h
file.

No code changes, just splitting things out.
2022-02-08 13:46:02 +01:00
Lennart Poettering
9b176fbdc0 Revert "boot-timestamps: Discard firmware init time when running in a VM"
This reverts commit f699bd81e8 (#22063)

We should suppress the TSC data when we generate it if we assume its
invalid, not when we consume it, because at that point we don't even
know if the data stems from TSC or something else.
2022-02-08 13:45:49 +01:00
adrian5
fa16642f4a docs: Improve HOME_DIRECTORY.md 2022-02-08 21:06:53 +09:00
Luca Boccassi
0c7649c2aa
Merge pull request #22430 from yuwata/resolve-fix-memleak-and-use-after-free
resolve: fix memleak and use-after-free, and several cleanups
2022-02-08 12:01:14 +00:00
Lennart Poettering
56c29baba4 man: coredump.conf: document defaults limits 2022-02-08 11:55:13 +01:00
Lennart Poettering
e677041e7a coredump: raise the coredump save size on 64bit systems to 32G (and lower it to 1G on 32bit systems)
Apparently 2G is too low for various real-life systems. But raising it
universally above 2^32 sounds wrong to me, since that makes no sense on
32bit systems, that we still support.

Hence, let's raise the limit to 32G on 64bit systems, and *lower* it to
1G on 32bit systems.

32G is 4 orders of magnitude higher then the old settings. Let's hope
that's enough for now. Should this not be enough we can raise it
further.

Fixes: #22076
2022-02-08 11:54:55 +01:00
Lennart Poettering
560ace5da8 README: CONFIG_KCMP is the new kernel compile time option for kcmp()
Fixes: #21947
2022-02-08 19:54:14 +09:00
Lennart Poettering
2cd341afb9 tests: add repart tests for block devices with 1024, 2048, 4096 byte sector sizes
let's make sure repart works with 4K drives and exotic sector sizes.
2022-02-08 10:52:05 +01:00
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 29f4185a9c ("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: f4b1a6b641
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
8d801e35cb 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 26a63b8132 ('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 b7bb58ef70
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