1
0
mirror of https://github.com/systemd/systemd.git synced 2024-10-30 06:25:37 +03:00
Commit Graph

55920 Commits

Author SHA1 Message Date
Daan De Meyer
17e2e8073f boot: Don't require a machine ID to be available
Regression introduced in https://github.com/systemd/systemd/pull/21807.

Fixes #22224
2022-01-31 13:58:06 +00:00
Luca Boccassi
06d4d83fa7
Merge pull request #22274 from yuwata/resolve-comment
resolve: cleanups for on_stream_io()
2022-01-31 13:56:04 +00:00
Luca Boccassi
9d6d4c305a core: don't fail on EEXIST when creating mount point
systemd[1016]: Failed to mount /tmp/app1 (type n/a) on /run/systemd/unit-extensions/1 (MS_BIND ): No such file or directory
systemd[1016]: Failed to create destination mount point node '/run/systemd/unit-extensions/1': File exists
2022-01-31 13:53:47 +01:00
Frantisek Sumsal
61b9769bda core: check argc/argv uncoditionally
as `assert()` might be dropped with `-DNDEBUG`.

Follow-up to cf3095a and 1637e75.
2022-01-31 20:00:40 +09:00
Yu Watanabe
256ce2e889
Merge pull request #21838 from lnussel/logind-refactor
Logind shutdown refactor
2022-01-31 19:45:33 +09:00
James Hilliard
e3759ac43a meson: use bpftool based strip when available
This should be useable in bpftool v5.13 or newer based on:
d80b2fcbe0
2022-01-31 16:42:07 +09:00
James Hilliard
408832e603 meson: set minimum clang/llvm versions for bpf support
The minimum clang/llvm-strip version needed for building libbpf based
programs is 10.0.0, this is documented here:
https://github.com/libbpf/libbpf/tree/v0.6.1#bpf-co-re-compile-once--run-everywhere

Using an older version such as 9.0.0 will generate objects that
bpftool will not be able to generate skeletons for.
2022-01-31 14:27:11 +09:00
Frantisek Sumsal
bbe5371345 basic: update CIFS magic
Kernel commit dea2903719283c156b53741126228c4a1b40440f exposed (and
renamed) CIFS_MAGIC_NUMBER as CIFS_SUPER_MAGIC along with
SMB2_SUPER_MAGIC.

This fixes the following build fail on current Fedora Rawhide:
```
../src/basic/meson.build:389:8: ERROR: Problem encountered: found unknown filesystem(s) defined in kernel headers:

Filesystem found in kernel header but not in filesystems-gperf.gperf: CIFS_SUPER_MAGIC
Filesystem found in kernel header but not in filesystems-gperf.gperf: SMB2_SUPER_MAGIC
```
2022-01-31 11:50:15 +09:00
Dorian Clay
156d01b9ca
hwdb: add support for Surface Laptop 2 & 3 (#22303) 2022-01-31 04:50:09 +09:00
Davide Cavalca
7d75376e1f hwdb: add new database file for PDA devices
Add a new database for handhelds (PDAs, calculators, etc.) that should be
accessible the seat owner.

The database is initially populated with Texas Instruments calculators
and linking cables, which removes the need to installing dedicated udev
rules for them.
2022-01-31 04:46:38 +09:00
Donald Chan
a718364e9d basic: mac_[selinux,smack]_apply_fd does not work when applying labels
Commit a7fdc6c introduced a regression where file descriptors are opened
using O_PATH option. mac_smack_apply_fd() calls fsetxattr() and would fail
with a -EBADF (Bad file descriptor) error.

Use FORMAT_PROC_FD_PATH(fd) to convert the fd back into a full path and
call setxattr() or setfilecon() instead.

Signed-off-by: Donald Chan <hoiho@amazon.com>
2022-01-31 04:43:56 +09:00
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 1637e75707.
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
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
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 d7cb60daf6.
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 de27f4c8b8.
2022-01-28 10:44:12 +09:00
Yu Watanabe
477ebd2b30 Revert "test: wait for newly created btrfs triggered"
This reverts commit 39f83dd760.

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