Commit graph

60151 commits

Author SHA1 Message Date
Lennart Poettering 4d593fb151 resolved: add dns_question_merge() helper
Very similar to dns_answer_merge(), but for DnsQuestion objects instead
of DnsAnswer.
2022-09-30 14:22:53 +02:00
Lennart Poettering 1482c86a50 resolved: add generic formatters for RRs into JSON
For now we can use it to send broken-down records of JSON via the
monitor logic, but one day we can certainly reuse for dumping the
caches, or to implement a ResolveRecord() varlink call one day.
2022-09-30 14:22:15 +02:00
Lennart Poettering ab26cdf730 resolved: split out helper for allocating DnsResourceRecord object from raw data
No change in behaviour, just some refactoring.
2022-09-30 14:21:38 +02:00
Lennart Poettering b497a958d6 resolved: split out main server listening code from manager_varlink_init()
Just some minor refactoring, to make binding the two sockets (main +
minitor) symmetric
2022-09-30 14:21:05 +02:00
Lennart Poettering b25d819aee resolved: don't make monitoring optional
The socket is only accessible to privileged clients anyway, no need to
add another (user unfriendly) restriction via opt-in setting. let's just
allow this for privileged clients, mirroring "busctl monitor", or
"tcpdump" and similar, which all just work if you have privs.

(This does not break API, since we never did a release witht the
"Monitor" dbus property or config setting in place, i.e. with
cb456374e0)
2022-09-30 14:20:28 +02:00
Lennart Poettering 227e127943 resolved: rename 'notification' → 'monitor'
We expose this externally already as "monitor", name it internally the
same way. (Which is nice since it mirrors busctl monitor)
2022-09-30 14:19:50 +02:00
Lennart Poettering baf3fdec27 sd-event: add helper for exiting event loop on SIGTERM/SIGINT
In many (most?) of our event loops we want to exit once SIGTERM/SIGINT
is seen. Add a common helper for that, that does the right things in a
single call.
2022-09-30 14:18:43 +02:00
Lennart Poettering 897448bd37 sd-event: if signal nr has high bit set sd_event_add_signal() auto-block it via sigprocmask()
So far we expected callers to block the signals manually. Which is
usually a good idea, since they should do that before forking off
threads and similar. But let's add a mode where we automatically block
it for the caller, to simplify things.
2022-09-30 14:17:46 +02:00
Lennart Poettering 0b8218b901 json: explicitly support offsets relative to NULL when dispatching
Let's trick out UndefinedBehaviourSanitizer:

https://github.com/systemd/systemd/pull/24853#issuecomment-1263380745
2022-09-30 14:17:15 +02:00
Lennart Poettering 84738d864b json: add helper for json builder for octescape/base32hex
These encodings for binary data are mandated by DNS RFCs, so let's give
make them nice and easy to use with json builder logic.
2022-09-30 14:16:23 +02:00
Lennart Poettering e085625f09 json: add dispatchers for 16bit integers 2022-09-30 14:15:37 +02:00
Lennart Poettering 24fe5e9807 glyph-util: add left arrow special glyph entry 2022-09-30 14:14:48 +02:00
Yu Watanabe a78049fc0e resolve: do not cache mDNS goodbye packet
Fixes #24842.
2022-09-30 18:50:56 +09:00
Yu Watanabe 9449268fae
Merge pull request #24820 from keszybz/tmpfiles-warning
Downgrade warning about unitialized-/etc in tmpfiles
2022-09-30 18:50:31 +09:00
Frantisek Sumsal bb0f817abf test: wait until the unit finishes before checking the log
Otherwise we might read an incomplete log and fail:

```
test_added_after (__main__.ExecutionResumeTest) ... FAIL
test_added_before (__main__.ExecutionResumeTest) ... ok
test_interleaved (__main__.ExecutionResumeTest) ... ok
test_issue_6533 (__main__.ExecutionResumeTest) ... ok
test_no_change (__main__.ExecutionResumeTest) ... ok
test_removal (__main__.ExecutionResumeTest) ... ok
test_swapped (__main__.ExecutionResumeTest) ... ok

======================================================================
FAIL: test_added_after (__main__.ExecutionResumeTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/build/./test/test-exec-deserialization.py", line 152, in test_added_after
    self.check_output(expected_output)
  File "/build/./test/test-exec-deserialization.py", line 107, in check_output
    self.assertEqual(output, expected_output)
AssertionError: 'foo\n' != 'foo\nbar\n'
  foo
+ bar

----------------------------------------------------------------------
Ran 7 tests in 27.470s
```
2022-09-30 18:47:09 +09:00
Frantisek Sumsal 842a9d5f91 test: kill the machine on oops/panic/soft_lockup
Otherwise the machine will hang on the panic until the timeout happens,
which might waste quite a considerable amount of time in certain cases.
2022-09-30 18:46:30 +09:00
Adam Williamson 950aeeb8ff kbd-model-map: correct variants for cz-qwerty to include comma
As explained by @poncovka , the 'xvariant' string should contain
the same number of comma-separated elements as 'xlayout'. When
we have two layouts we need two items in xvariant, in this case
one of them is empty.

See https://github.com/rhinstaller/anaconda/pull/4355#pullrequestreview-1119913870
for @poncovka's full explanation.

Signed-off-by: Adam Williamson <awilliam@redhat.com>
2022-09-29 23:53:26 +01:00
Frantisek Sumsal 9b2e40a885
Merge pull request #24865 from yuwata/udevadm-tweaks
udevadm: fix misleading error message
2022-09-30 00:01:48 +02:00
JeroenHD 792c779f7d
Add special keyboard combos for Thinkpad P1 Gen 3 (#24862)
* Add special keyboard combos for Thinkpad P1 Gen 3

These are based on the key codes I've found with evtest. See issue
https://github.com/systemd/systemd/issues/24814 for more details.

I'm not entirely sure what some of these keys are supposed to do,
notably Fn+RShift; this doesn't seem to do anything in Windows on
my machine. Binding them to prog# makes them available to desktop
managers' key bindings at least, in case someone wishes to make
use of this extra keybind possibility.
2022-09-29 21:23:42 +01:00
Yu Watanabe ad8c442a0b test-64-udev-storage: use wait command instead of hackish "udevadm lock true"
Otherwise, "udevadm lock true" may lock a block device earlier than
"udevadm lock sfdisk &".
2022-09-30 03:42:05 +09:00
Yu Watanabe 4273a041f1 udevadm: do not try to find device unit when a path like string is provided
Otherwise, we provide misleading error message.
Before:
---
$ udevadm info /sys/class/foo
Bad argument "/sys/class/foo", expected an absolute path in /dev/ or /sys/ or a unit name: Invalid argument
---
After:
---
$ udevadm info /sys/class/foo
Unknown device "/sys/class/foo": No such device
---
2022-09-30 02:05:09 +09:00
Zbigniew Jędrzejewski-Szmek 3efadceb9e docs/CONTRIBUTING: explain various labels and add link to "reviewable" PRs
The linked filter gives an up-to-date list of pull requests that need review.
(Yes, there's too many.) We used to set 'needs-review' label, but that is
not available to non-members, and also every pull requests which is not labeled
'reviewed/needs-rework'/'ci-fails/needs-rework'/'needs-rebase' can and should
be reviewed.

If this is merged, I'll drop the 'needs-review' label.
2022-09-30 01:23:30 +09:00
Frantisek Sumsal fa21a2cf9f test: bump the reattach timeout when running w/ plain QEMU
As it might sometimes take slightly longer without the acceleration:

```
[  176.805681] testsuite-29.sh[534]: + cp /usr/share/app1.raw /tmp/app1_2.raw
[  176.885365] testsuite-29.sh[534]: + timeout 30 portablectl reattach --now --runtime --extension /tmp/app1_2.raw /usr/share/minimal_1.raw app1
[  177.053358] portablectl[993]: (Matching unit files with prefixes 'app1'.)
[  177.138770] kernel: loop0: detected capacity change from 0 to 2965504
[  177.343137] kernel: loop1: detected capacity change from 0 to 4096
...
[  201.932062] systemd[1]: app1.service: Deactivated successfully.
[  202.009310] systemd[1]: Stopped app1.service.
[  202.053776] systemd[1]: app1.service: Consumed 2.183s CPU time.
[  202.125061] systemd[1]: Stopping app1.service...
[  202.611760] systemd[1]: Starting modprobe@dm_mod.service...
[  202.851031] systemd[1]: Starting modprobe@dm_verity.service...
[  202.909352] systemd[1]: Starting modprobe@loop.service...
[  203.198918] systemd[1]: Starting app1.service...
[  207.145494] kernel: audit: type=1130 audit(1663770336.105:428): pid=1 uid=0 auid=4294967295 ses=4294967295 subj=kernel msg='unit=testsuite-29 comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=failed'
[  207.652545] systemd[1]: testsuite-29.service: Main process exited, code=exited, status=124/n/a
[  207.665088] systemd[1]: testsuite-29.service: Failed with result 'exit-code'.
[  207.830522] systemd[1]: Failed to start testsuite-29.service.
...
[  208.889449] script1.sh[1035]: ID="centos"
[  208.889449] script1.sh[1035]: VERSION_ID="8"
[  208.889449] script1.sh[1035]: SYSEXT_SCOPE=portable
[  208.889449] script1.sh[1035]: PORTABLE_PREFIXES=app1
...
[  214.155097] systemd[1]: app1.service: Deactivated successfully.
```

Spotted in Ubuntu CI and CentOS CI.

Follow-up to 706c9a30ac.
2022-09-30 00:16:45 +09:00
Jan Janssen 957dfcc96d stub: Remove unused function parameter 2022-09-29 10:30:37 +02:00
Lennart Poettering 1aefb25f37 resolved: paranoia: restrict socket mode as much as we can 2022-09-29 00:42:14 +01:00
Frantisek Sumsal 5ad1513845 test: wrap ls and stat to make it work w/ sanitizers in specific cases
When `/etc/nsswitch.conf` uses `systemd` together with `[SUCCESS=merge]`,
`ls -l` will pull in `libnss_systemd` causing `SIGABRT`, as `ls` is not
instrumented (by default):

```
-bash-5.1# strace -f -e %file ls -l /dev
execve("/usr/bin/ls", ["ls", "-l", "/dev"], 0x7ffc3bb211c8 /* 24 vars*/) = 0
...
openat(AT_FDCWD, "/etc/passwd", O_RDONLY|O_CLOEXEC) = 3
newfstatat(3, "", {st_mode=S_IFREG|0644, st_size=1896, ...}, AT_EMPTY_PATH) = 0
newfstatat(AT_FDCWD, "/etc/nsswitch.conf", {st_mode=S_IFREG|0644, st_size=359, ...}, 0) = 0
openat(AT_FDCWD, "/etc/group", O_RDONLY|O_CLOEXEC) = 3
newfstatat(3, "", {st_mode=S_IFREG|0644, st_size=965, ...}, AT_EMPTY_PATH) = 0
openat(AT_FDCWD, "/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
newfstatat(3, "", {st_mode=S_IFREG|0644, st_size=10779, ...}, AT_EMPTY_PATH) = 0
openat(AT_FDCWD, "/usr/lib/libnss_systemd.so.2", O_RDONLY|O_CLOEXEC) = 3
newfstatat(3, "", {st_mode=S_IFREG|0755, st_size=16195176, ...}, AT_EMPTY_PATH) = 0
openat(AT_FDCWD, "/usr/lib/libasan.so.8", O_RDONLY|O_CLOEXEC) = 3
...
readlink("/proc/self/exe", "/usr/bin/ls", 4096) = 11
open("/proc/self/cmdline", O_RDONLY)    = 3
open("/proc/self/environ", O_RDONLY)    = 3
==620==ASan runtime does not come first in initial library list; you should either link runtime to your application or manually preload it with LD_PRELOAD.
--- SIGABRT {si_signo=SIGABRT, si_code=SI_TKILL, si_pid=620, si_uid=0} ---
+++ killed by SIGABRT (core dumped) +++
Aborted (core dumped)
```

This also happens with `stat`. Let's add both `ls` and `stat` to the "wrap list"
to work around this.

Spotted on Arch Linux.
2022-09-28 22:39:18 +01:00
Lennart Poettering 5cf4b2e597 resolvectl: add line breaks for readability 2022-09-28 23:03:58 +02:00
Lennart Poettering 411d095d79 resolved: don't access sshfp fields from tlsa printer 2022-09-28 22:52:05 +02:00
Lennart Poettering 43bd70d584 resolved: return regular varlink invalid parameter error if more is not specified on monitor call
No point in returning EINVAL if we can just return a proper varlink
invalid parameter error
2022-09-28 22:51:51 +02:00
Lennart Poettering 63fe457c1b resolved: fix parameter reuse in DNS_ANSWER_FOREACH_ITEM() iterator macro 2022-09-28 22:51:36 +02:00
Frantisek Sumsal 07faa4990f test: fix a copy-paste error 2022-09-28 14:03:03 +02:00
Daan De Meyer 4c35aed7f0
Merge pull request #24837 from yuwata/kernel-install
kernel-install: two fixlets
2022-09-28 10:50:55 +02:00
Yu Watanabe c5654483dc fuzz: tighten acceptable data size
Fixes oss-fuzz#51887 (https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=51887).
Fixes #24833.
2022-09-28 09:12:36 +02:00
Sarah Brofeldt f8151a707c docs/NETWORK_ONLINE: systemd.network hyperlink fix 2022-09-28 15:48:39 +09:00
Yu Watanabe c561c78063 kernel-install: do not fail if a plugin exits with 77 2022-09-28 13:36:38 +09:00
Yu Watanabe 46f347ada3 kernel-install: do not fail if $layout is not "bls"
Fixes #24836.
2022-09-28 13:36:29 +09:00
msizanoen1 b49e029a99 resolve: persist DNSOverTLS configuration in state file
Currently, NetworkManager will set DNSOverTLS according to its
`connection.dnsovertls` configuration only once during connection,
instead of every single restart of systemd-resolved, causing resolved to
lose the configuration on restart.

Fix this by persisting DNSOverTLS in the runtime state file, which will
also make it more consistent with other interface-specific settings.
2022-09-28 08:09:06 +09:00
Edson Juliano Drosdeck f58ab54a2b
hwdb: fix Positivo-vaio FE14 V2 key toggle touchpad #24822 (#24825) 2022-09-28 08:06:34 +09:00
Luca Boccassi 0e26016e3d resolved notifications: follow-up fixes
Further review comments from: https://github.com/systemd/systemd/pull/22845
2022-09-27 22:34:17 +01:00
Yu Watanabe a13231a904
Merge pull request #24832 from mrc0mmand/more-TEST-64-tweaks
A couple of performance tweaks for TEST-64 under QEMU
2022-09-28 02:26:55 +09:00
Zbigniew Jędrzejewski-Szmek 1401882fdd tmpfiles: downgrade message about unitialized-/etc
If we're running with --root, or in a chroot (*), it's expected that machine-id
and other specifiers will be unresolvable, so downgrade the warning to debug.

Fixes #24655.

(*) sd_booted() in principle means more than that, but nowadays systemd
dominates and those others things are infrequently seen.
2022-09-27 16:59:24 +02:00
Zbigniew Jędrzejewski-Szmek 6db980988f tmpfiles: fix detection of unitialized-/etc
In 6ec4c852c9 I changed specifier_machine_id() to
return EUNATCH, but the code catching in tmpfiles wasn't adjusted.

Instead of translating errors at various levels, let the "original" errno value
(whatever was returned by the low-level reading function) propagate all the way
to the logging function, and only check which errnos to suppress there. This
makes it easier to follow the flow of data through all the layers. Also, we
don't need to provide wrapper functions for each place where we want to do the
supression.

The common set of errnos that have similar meaning are are caught using
ERRNO_IS_NOINFO(). It is more managable to use a wider net than to figure out
which errors could be returned in specific cases.
2022-09-27 16:48:46 +02:00
Frantisek Sumsal 998fb5c5e3 test: use fewer partitions/LVs when running with plain QEMU 2022-09-27 15:10:18 +02:00
Frantisek Sumsal 90743af65d test: make the symlink helpers a bit more quiet
and show only errors/warnings.
2022-09-27 15:10:18 +02:00
Frantisek Sumsal d6ef4ebbda test: ignore tty* devices when checking device units
This lower the runtime of `check_device_units()` in a plain QEMU VM from
~45 seconds to ~25 seconds.
2022-09-27 15:10:18 +02:00
Frantisek Sumsal dd2b99ee7f test: lower the # of iterations when running with plain QEMU 2022-09-27 15:10:18 +02:00
Frantisek Sumsal d9e1cb288f test: support open-iscsi >= 2.1.2
Since open-iscsi 2.1.2 [0] the initiator name should be generated via
a one-time service instead of distro package's post-install scripts.
However, some distros still use this approach even after this patch,
so prefer the already existing initiatorname.iscsi file if it exists.

[0] f37d5b653f
2022-09-27 13:24:32 +02:00
Lennart Poettering dd51b0f952
Merge pull request #24805 from yuwata/sd-network
sd-network: several cleanups
2022-09-27 11:28:25 +02:00
Richard Phibel 8aa3894eae systemctl: add support for --image option
All tools that support --root= should also learn --image=
so that they can operate on disk images directly.
2022-09-27 09:47:01 +02:00
Yu Watanabe b577d5569d
Merge pull request #24812 from yuwata/udev-drop-netlink
udev: drop workaround for slow read of phys_port_name sysattr
2022-09-27 14:10:02 +09:00