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

56017 Commits

Author SHA1 Message Date
Daan De Meyer
5b2d0f9efd shared: Handle filesystems that don't support hole punching in COPY_HOLES 2022-01-31 04:43:23 +09:00
Yu Watanabe
34905ff7a9
Merge pull request #22294 from evverx/fuzz-dhcp-client
tests: fuzz client_handle_offer
2022-01-31 04:41:07 +09:00
Frantisek Sumsal
15391a2245
Merge pull request #22302 from evverx/merge-oss-fuzz-corpora
ci: merge seed corpora with public OSS-Fuzz corpora on CFLite
2022-01-30 18:35:28 +00:00
Yu Watanabe
cf3095ac2b core: check if argc > 0 and argv[0] is set
Follow-up for 1637e757070a61b12b26a2a4ef547330562dc77f.
2022-01-30 13:07:51 +00:00
Evgeny Vereshchagin
d38363b96b ci: no longer upload the latest builds on commits
The idea behind this action is to make it possible to compare the
latest fuzz targets with PRs to figure out whether bugs are really
reproducible in PRs only. Since forks (including systemd-stable) are
usually based on the upstream repository where almost all the bugs
are fixed before releases are cut it should be safe to assume that
if CFLite finds bugs in PRs they are most likely introduced in those
PRs.

It should probably be brought back once https://github.com/google/clusterfuzzlite/issues/84
is fixed.
2022-01-30 10:17:25 +00:00
Evgeny Vereshchagin
69aa4982bc ci: merge seed corpora with public OSS-Fuzz corpora on CFLite
to let it cover as much code as possible. It should help to catch
most regressions in a few minutes.
2022-01-30 10:17:25 +00:00
Frantisek Sumsal
1637e75707 shared: be extra paranoid and check if argc > 0
and also if argv[0] is non-empty as a precaution for issues similar to
CVE-2021-4034.
2022-01-30 17:53:10 +09:00
Yu Watanabe
b97f338e56
Merge pull request #22301 from mrc0mmand/cocci-tweaks
fstab-generator: use str(n)dupa_safe() instead of plain str(n)dupa()
2022-01-30 09:34:44 +09:00
Frantisek Sumsal
a79da8b3c7 test: make use of strv_isempty() 2022-01-29 22:36:29 +01:00
Frantisek Sumsal
ea1c9d3f69 fstab-generator: use str(n)dupa_safe() instead of plain str(n)dupa() 2022-01-29 22:34:02 +01:00
Yu Watanabe
80c8c786a3 login: use bus_error_message() at one more place 2022-01-30 05:43:56 +09:00
Yu Watanabe
3332218555 core/unit: use bus_error_message() at one more place 2022-01-30 05:43:56 +09:00
Yu Watanabe
853b94863c bus-util: retrieve bus error from message
The error in argument is not input, but used for output.
2022-01-30 05:43:56 +09:00
Evgeny Vereshchagin
e46c743a57 ci: update GHActions once a month
Apparently some actions like CodeQL are released a few times a week so let's
just update them once a month in one fell swoop.
2022-01-29 19:26:14 +00:00
Evgeny Vereshchagin
81f84a2c0b ci: use CFLite to test forks (including systemd-stable)
It's like CIFuzz but unlike CIFuzz it's compatible with forks and
it should make it possible to run the fuzzers to make sure that
patches backported to them are backported correctly without introducing
new bugs and regressions.
2022-01-29 18:37:17 +00:00
Evgeny Vereshchagin
9591c0a8b3 sd-dhcp-lease: fix a memory leak in dhcp_lease_parse_search_domains
=================================================================
==81071==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 16 byte(s) in 1 object(s) allocated from:
    #0 0x51245c in __interceptor_reallocarray (/home/vagrant/systemd/build/fuzz-dhcp-client+0x51245c)
    #1 0x7f01440c67e6 in strv_push /home/vagrant/systemd/build/../src/basic/strv.c:435:13
    #2 0x7f01440ca9e1 in strv_consume /home/vagrant/systemd/build/../src/basic/strv.c:506:13
    #3 0x7f01440ca9e1 in strv_extend /home/vagrant/systemd/build/../src/basic/strv.c:558:16
    #4 0x5806e3 in dhcp_lease_parse_search_domains /home/vagrant/systemd/build/../src/libsystemd-network/sd-dhcp-lease.c:900:21
    #5 0x57c1be in dhcp_lease_parse_options /home/vagrant/systemd/build/../src/libsystemd-network/sd-dhcp-lease.c:727:21
    #6 0x572450 in parse_options /home/vagrant/systemd/build/../src/libsystemd-network/dhcp-option.c:348:33
    #7 0x571c6a in dhcp_option_parse /home/vagrant/systemd/build/../src/libsystemd-network/dhcp-option.c:376:13
    #8 0x559a01 in client_handle_offer /home/vagrant/systemd/build/../src/libsystemd-network/sd-dhcp-client.c:1543:13
    #9 0x5592bd in LLVMFuzzerTestOneInput /home/vagrant/systemd/build/../src/libsystemd-network/fuzz-dhcp-client.c:74:16
    #10 0x44a379 in fuzzer::Fuzzer::ExecuteCallback(unsigned char const*, unsigned long) (/home/vagrant/systemd/build/fuzz-dhcp-client+0x44a379)
    #11 0x42ae1f in fuzzer::RunOneTest(fuzzer::Fuzzer*, char const*, unsigned long) (/home/vagrant/systemd/build/fuzz-dhcp-client+0x42ae1f)
    #12 0x432ade in fuzzer::FuzzerDriver(int*, char***, int (*)(unsigned char const*, unsigned long)) (/home/vagrant/systemd/build/fuzz-dhcp-client+0x432ade)
    #13 0x421f86 in main (/home/vagrant/systemd/build/fuzz-dhcp-client+0x421f86)
    #14 0x7f0142fff55f in __libc_start_call_main (/lib64/libc.so.6+0x2d55f)
2022-01-29 03:19:53 +00:00
Evgeny Vereshchagin
998ec39b1d tests: add a file triggering a memory leak in dhcp_lease_parse_search_domains 2022-01-29 03:19:53 +00:00
Evgeny Vereshchagin
86b06c666b sd-dhcp-lease: fix an infinite loop found by the fuzzer 2022-01-29 02:17:39 +00:00
Evgeny Vereshchagin
4158af3651 tests: fuzz client_handle_offer
Turns out that part of systemd isn't covered by any fuzz targets and
that's not ideal considering that it parses data sent remotely. The
fuzzer triggers an infinite loop in lease_parse_routes as soon as it
starts so it seems to be working :-)
```
INFO: Running with entropic power schedule (0xFF, 100).
INFO: Seed: 23620602
INFO: Loaded 2 modules   (182073 inline 8-bit counters): 176548 [0x7fdf511fc8d0, 0x7fdf51227a74), 5525 [0x5f6ef0, 0x5f8485),
INFO: Loaded 2 PC tables (182073 PCs): 176548 [0x7fdf51227a78,0x7fdf514d94b8), 5525 [0x5f8488,0x60ddd8),
./build/fuzz-dhcp-client: Running 1 inputs 1 time(s) each.
Running: test/fuzz/fuzz-dhcp-client/timeout-ed34161922c7075c4773f2ada3dee8685d220980
ALARM: working on the last Unit for 31 seconds
       and the timeout value is 30 (use -timeout=N to change)
==80731== ERROR: libFuzzer: timeout after 31 seconds
    #0 0x51b32e in __sanitizer_print_stack_trace (/home/vagrant/systemd/build/fuzz-dhcp-client+0x51b32e)
    #1 0x4689e9 in fuzzer::PrintStackTrace() (/home/vagrant/systemd/build/fuzz-dhcp-client+0x4689e9)
    #2 0x44a0f4 in fuzzer::Fuzzer::StaticAlarmCallback() (/home/vagrant/systemd/build/fuzz-dhcp-client+0x44a0f4)
    #3 0x7fdf4f8b474f  (/lib64/libc.so.6+0x4274f)
    #4 0x465fee in __sanitizer_cov_trace_const_cmp4 (/home/vagrant/systemd/build/fuzz-dhcp-client+0x465fee)
    #5 0x57eee5 in lease_parse_routes /home/vagrant/systemd/build/../src/libsystemd-network/sd-dhcp-lease.c:495:23
    #6 0x57baf3 in dhcp_lease_parse_options /home/vagrant/systemd/build/../src/libsystemd-network/sd-dhcp-lease.c:701:21
    #7 0x572450 in parse_options /home/vagrant/systemd/build/../src/libsystemd-network/dhcp-option.c:348:33
    #8 0x571cea in dhcp_option_parse /home/vagrant/systemd/build/../src/libsystemd-network/dhcp-option.c:381:21
    #9 0x559a01 in client_handle_offer /home/vagrant/systemd/build/../src/libsystemd-network/sd-dhcp-client.c:1543:13
    #10 0x5592bd in LLVMFuzzerTestOneInput /home/vagrant/systemd/build/../src/libsystemd-network/fuzz-dhcp-client.c:78:9
    #11 0x44a379 in fuzzer::Fuzzer::ExecuteCallback(unsigned char const*, unsigned long) (/home/vagrant/systemd/build/fuzz-dhcp-client+0x44a379)
    #12 0x42ae1f in fuzzer::RunOneTest(fuzzer::Fuzzer*, char const*, unsigned long) (/home/vagrant/systemd/build/fuzz-dhcp-client+0x42ae1f)
    #13 0x432ade in fuzzer::FuzzerDriver(int*, char***, int (*)(unsigned char const*, unsigned long)) (/home/vagrant/systemd/build/fuzz-dhcp-client+0x432ade)
    #14 0x421f86 in main (/home/vagrant/systemd/build/fuzz-dhcp-client+0x421f86)
    #15 0x7fdf4f89f55f in __libc_start_call_main (/lib64/libc.so.6+0x2d55f)
    #16 0x7fdf4f89f60b in __libc_start_main@GLIBC_2.2.5 (/lib64/libc.so.6+0x2d60b)
    #17 0x421fd4 in _start (/home/vagrant/systemd/build/fuzz-dhcp-client+0x421fd4)

SUMMARY: libFuzzer: timeout
```
2022-01-29 00:59:56 +00:00
Anita Zhang
aca6badb80
Merge pull request #22289 from yuwata/network-hashmap-remove-value
network: use hashmap_remove_value() at two more places
2022-01-28 11:57:59 -08:00
Yu Watanabe
e74f1d07b3 network: use hashmap_remove_value() at two more places 2022-01-29 00:30:22 +09:00
Zbigniew Jędrzejewski-Szmek
29f604131b kernel-install: add missing log line 2022-01-28 16:17:47 +01:00
Zbigniew Jędrzejewski-Szmek
367165a406 kernel-install: add "$KERNEL_INSTALL_STAGING_AREA" directory
The general approach of kernel-install was that each plugin would drop in some
files into the entry directory. But this doesn't scale well, because if we have
multiple initrd generators, or multiple initrds, each generator would need to
recreate the logic to put the generated files in the right place.

Also, effective cleanup is impossible if anything goes wrong on the way, so we
could end up with unused files in $BOOT.

So let's invert the process: plugins drop files into $KERNEL_INSTALL_STAGING_AREA,
and at the end 90-loaderentry.install DTRT with those files.

This allow new plugins like 50-mkosi-initrd.install to be significantly simpler.
2022-01-28 16:17:47 +01:00
Zbigniew Jędrzejewski-Szmek
680cec6b4d kernel-install: prefix errors with "Error:", exit immediately
kernel-install would continue after errors… We don't want this, as it
makes the results totally unpredicatable. If we didn't install the kernel
or didn't do some important part of the setup, let's just return an error
and let the user deal with it.

When looking at output, the error was often hard to distinguish, esp.
with -v. Add "Error:" everywhere to make the output easier to parse.
2022-01-28 16:17:47 +01:00
Zbigniew Jędrzejewski-Szmek
a520d5dddb kernel-install: k-i already creates $ENTRY_DIR_ABS, no need to do it again 2022-01-28 16:17:45 +01:00
Yu Watanabe
372c6c7028 test: add missing oom check
Fixes CID#1469129.
2022-01-28 12:56:29 +00:00
Daan De Meyer
639fda6f1a
Merge pull request #22283 from yuwata/sd-device-suppress-log
sd-device: suppress log
2022-01-28 12:55:16 +00:00
Yu Watanabe
674df18a32 unit: introduce wait-online@.service for specific interface
This should be useful when a host has multiple interfaces.

Inspired by #22246.
2022-01-28 12:52:52 +00:00
Frantisek Sumsal
6c66575f0b
Merge pull request #22282 from yuwata/test-revert-workaronds
test: revert workaronds
2022-01-28 12:37:12 +00:00
Yu Watanabe
71df50a973 sd-dhcp-server: refuse too large packet to send
Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=44134.
2022-01-28 10:22:53 +00:00
Ryan Hendrickson
a663f5eef5 hwdb: add two Elecom trackballs 2022-01-28 17:41:28 +09:00
Yu Watanabe
1a054a208c network: fix log messages 2022-01-28 08:34:57 +00:00
Yu Watanabe
e912326e05 test: frequency in mouse DPI is optional
Prompted by #22278.
2022-01-28 13:18:28 +09:00
Yu Watanabe
a1a42fd8a8
Merge pull request #22277 from yuwata/test-network-activation-policy
test-network: fixes for test_activation_policy
2022-01-28 12:45:49 +09:00
Julia Kartseva
e0c694c73d bpf: load firewall with name only if supported
BPF firewall is supported starting from v4.9 kernel where
BPF_PROG_TYPE_SOCKET_FILTER support was added [0].

However, program name support was added to v4.15 [1] and BPF_PROG_LOAD
syscall will fail on older kernels if called with prog_name attribute.
BPF_F_ALLOW_MULTI was also added to v4.15 kernel which allows reusing
BPF_F_ALLOW_MULTI probe to indicate that program name is also supported.

It is no problem for BPF_PROG_TYPE_CGROUP_DEVICE since it was added in
v4.15.

[0] https://elixir.bootlin.com/linux/v4.9/source/include/uapi/linux/bpf.h#L92
[1] https://elixir.bootlin.com/linux/v4.15/source/include/uapi/linux/bpf.h#L191

Follow-up of https://github.com/systemd/systemd/pull/22214
2022-01-28 12:42:18 +09:00
Yu Watanabe
673a181702
Merge pull request #22272 from bluca/state_dir_private_rootfs
core: do not attempt to add 'private' symlinks when RootImage/RootDirectory are used
2022-01-28 12:04:41 +09:00
Yu Watanabe
d45798257b man: extend the DHCPv6-PD example and add a DHCPv4-6RD example 2022-01-28 12:04:02 +09:00
Yu Watanabe
29fafedd39 sd-device: suppress too many debugging log when enumerating devices
Follow-up for d7cb60daf6d3769f1e26753195d62e8fcee025fa.
2022-01-28 10:58:15 +09:00
Yu Watanabe
68a2ed61eb log: introduce log_trace_errno() 2022-01-28 10:50:36 +09:00
Yu Watanabe
5ea91cf8f3 Revert "test: wait for user inactive"
As it does not work, and the test still randomly fails.

This reverts commit de27f4c8b8dd230a936f1b467a1da275f6fe024b.
2022-01-28 10:44:12 +09:00
Yu Watanabe
477ebd2b30 Revert "test: wait for newly created btrfs triggered"
This reverts commit 39f83dd7606730f65eb9831703a8ea3667682a85.

As this does not solve the issue.
2022-01-28 10:42:51 +09:00
Luca Boccassi
dd802109c6
Merge pull request #22276 from mrc0mmand/TEST-64-workaround
test: temporary workaround for #21819
2022-01-28 00:56:04 +00:00
Luca Boccassi
3fa80e5e75 core: do not attempt to add 'private' symlinks when RootImage/RootDirectory are used
A bind mount is added directly from private on the host to the actual
destination directory, no need for the symlinks (which cannot be created
as the bind mount happens first and creates the target as an actual directory)

Fixes https://github.com/systemd/systemd/issues/22264
2022-01-28 00:54:10 +00:00
Seth Falco
7f74f7a916 hwdb: treat logitech craft keyboard as a keyboard 2022-01-28 09:52:40 +09:00
Yu Watanabe
a5e2a488e8 resolve: llmnr: fix never hit condition
Previously, the condition in on_stream_io_impl() never hit, as the
read packet is always taken from the stream in the few lines above.

Instead of the dns_stream_complete() under the condition, the stream
is unref()ed in the on_packet callback for LLMNR stream, unlike the
other on_packet callbacks.

That's quite tricky. Also, potentially, the stream may still have
queued packets to write.

This fix the condition, and drops the unref() in the on_packet callback.

C.f. https://github.com/systemd/systemd/pull/22274#issuecomment-1023708449.

Closes #22266.
2022-01-28 09:37:50 +09:00
Yu Watanabe
4aa6129897 resolve: mention that dns_stream_update() needs to be called after dns_stream_take_read_packet()
Based on the analysis by Joan Bruguera <joanbrugueram@gmail.com>.
See https://github.com/systemd/systemd/pull/22132#discussion_r793951650.
2022-01-28 09:01:07 +09:00
Yu Watanabe
624f907ea9 resolve: call dns_stream_take_read_packet() in on_stream_io()
As dns_stream_take_read_packet() is called only in on_packet callbacks,
and all on_packet callbacks call it.
2022-01-28 09:00:56 +09:00
Yu Watanabe
18230451c0 resolve: make dns_stream_new() take on_packet and complete callbacks
And make on_packet callback mandatory.
2022-01-28 08:45:17 +09:00
Yu Watanabe
073ad7ed1f test-network: wait for a while if manual policy is always-{up,down}
If wait_operstate() is called super quickly after ip command, then the
up/down state may not be changed and propagated to networkd, and
wait_operstate() mistakenly pass with the previous state.

To avoid such situation, wait for a while to make networkd actually
detect the interface brought up/down.
2022-01-28 07:29:37 +09:00
Yu Watanabe
ebb5036ff2 test-network: dummy interface is initially down when activation policy is manual 2022-01-28 07:17:08 +09:00