Commit Graph
57095 Commits
Author SHA1 Message Date
Zbigniew Jędrzejewski-Szmek 2a3cca04c4 network: de-duplicate logging in bridge_vlan_append_info() and the caller
The remaining message is changed, because the user would most likely not
understand that "append VLANs" is just talking about the netlink message.
2022-01-05 11:43:36 +01:00
Zbigniew Jędrzejewski-Szmek eff692502b network: move logging from ipoib_set_netlink_message() to the caller 2022-01-05 11:43:28 +01:00
Yu Watanabe 838440315c coredump: drop unnecessary initialization 2022-01-05 19:41:42 +09:00
Zbigniew Jędrzejewski-Szmek 2f64865b0e network: split out netdev_fill_fou_tunnel_message(), simplify logging 2022-01-05 11:41:29 +01:00
Zbigniew Jędrzejewski-Szmek 0c50cb50bd network: split out netdev_create_message(), simplify logging 2022-01-05 11:41:29 +01:00
Zbigniew Jędrzejewski-Szmek 81f01be0b8 network: replace more detailed netlink append messages
Some refactoring was needed here to avoid duplicate messages.
Some select-and-paste errors were fixed on the way.

systemd-networkd is thinner by 8k.
2022-01-05 11:41:29 +01:00
Zbigniew Jędrzejewski-Szmek d15cba9647 network: use SYNTHETIC_ERRNO in one more place 2022-01-05 11:41:29 +01:00
Zbigniew Jędrzejewski-Szmek 5b80ecea55 network: replace detailed netlink append messages with a single generic message
This commit is the first in the series, and they generally follow the same
idea: we had very detailed logging for message append operations which would
only fail either with some type error or intrinsic limit (and then they would
fail everywhere, so this would be noticed during development or in CI), or they
would fail with ENOMEM, in which case the exact location is not very interesting
since this is not repeatable.

I am in general in favour of detailed logging messages, because it helps with
diagnosis of errors, but I think case is an exception. Despite not being very
useful, those messages required a lot of effort, because they were customized
for each and every append operation. In fact some of the messages contained copy
errors. The text of the messages (since they are generally unique) also added up
to a considerable size.

This removes the log messages after each sd_netlink_message_append_*() in
fill_message_create() with a single line in netdev_create(). As described
above, we are just appending fields to a message, so those calls would almost
never fail.

A forgotten 'return' was added in one place.

$ size build/systemd-networkd{.0,}
   text	   data	    bss	    dec	    hex	filename
1878634	 394016	     36	2272686	 22adae	build/systemd-networkd.0
1842450	 394080	     36	2236566	 222096	build/systemd-networkd

… so we save 30k too.
2022-01-05 11:36:04 +01:00
Yu Watanabe 329a5b91d9 test-repart: append /sbin and /usr/sbin to $PATH= to make sfdisk can be found
Fixes #21972.
2022-01-05 09:31:28 +09:00
Yu Watanabe 31cf58864d test-repart: disable pager 2022-01-05 09:29:50 +09:00
Jason A. Donenfeld da2862ef06 random-seed: hash together old seed and new seed before writing out file
If we're consuming an on-disk seed, we usually write out a new one after
consuming it. In that case, we might be at early boot and the randomness
could be rather poor, and the kernel doesn't guarantee that it'll use
the new randomness right away for us. In order to prevent the new
entropy from getting any worse, hash together the old seed and the new
seed, and replace the final bytes of the new seed with the hash output.
This way, entropy strictly increases and never regresses.

Fixes: https://github.com/systemd/systemd/issues/21983
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2022-01-04 22:47:56 +00:00
Jan Janssen 948d085e89 boot: Add gdb support and documentation
This will finally allow debugging issues in systemd without resorting to
Print() calls all over the place.
2022-01-04 17:23:01 +01:00
Luca Boccassi ff97eb4aac Merge pull request #21977 from systemd/wip/hadess/minipro-uaccess
hwdb: Allow end-users root-less access to TL866 EPROM readers
2022-01-04 15:51:28 +00:00
Frantisek Sumsal 7847b54814 test: build fuzzers with --werror if set
to catch issues like systemd/systemd#21996.
2022-01-04 18:49:56 +03:00
наб af319a4b14 kernel-install: don't pull out KERNEL_IMAGE
It's part of the pack directly passed to scripts on add and ignored on
remove
2022-01-04 15:39:10 +01:00
наб 742561efbe kernel-install: 90-loaderentry: error out on nonexistent initrds instead of swallowing them quietly 2022-01-04 15:39:09 +01:00
наб 76b1274a5c kernel-install: port to /bin/sh 2022-01-04 15:39:09 +01:00
наб 0bb1cb1fce kernel-install: fix shellcheck 2022-01-04 15:39:08 +01:00
наб 662f45e3ea kernel-install: 90-loaderentry: port to /bin/sh
Also, forward the rm -f exit code on removal instead of swallowing it
2022-01-04 15:39:08 +01:00
наб b3ceb3d9ff kernel-install: 50-depmod: port to /bin/sh 2022-01-04 15:39:08 +01:00
Zbigniew Jędrzejewski-Szmek 5377ad4ea4 fuzz-bcd: silence warning about always-true comparison
Occurs with gcc-11.2.1-7.fc35.x86_64.
2022-01-04 11:49:45 +00:00
Bastien Nocera f097f4ab89 hwdb: Allow end-users root-less access to TL866 EPROM readers
As is currently done in the upstream minipro tool:
https://gitlab.com/DavidGriffith/minipro/-/tree/master/udev
2022-01-04 11:06:12 +01:00
Zbigniew Jędrzejewski-Szmek ba5b19ef4d Revert "udev: Import hwdb matches for USB devices"
This reverts commit 94cb45d57f.

This rule set up a duplicate import:

$ udevadm test /devices/pci0000:00/0000:00:14.0/usb2/2-4/2-4.1/2-4.1.3
...
2-4.1.3: /usr/lib/udev/rules.d/40-libgphoto2.rules:9 Importing properties from results of builtin command 'usb_id'
2-4.1.3: /usr/lib/udev/rules.d/50-udev-default.rules:13 Skipping builtin 'usb_id' in IMPORT key
2-4.1.3: /usr/lib/udev/rules.d/50-udev-default.rules:13 Importing properties from results of builtin command 'hwdb --subsystem=usb'
2-4.1.3: hwdb modalias key: "usb:v17EFp3054:OneLink+ Giga"
2-4.1.3: /usr/lib/udev/rules.d/50-udev-default.rules:15 Importing properties from results of builtin command 'hwdb 'usb:v17efp3054''
2-4.1.3: No entry found from hwdb.
2-4.1.3: /usr/lib/udev/rules.d/50-udev-default.rules:15 Failed to run builtin 'hwdb 'usb:v17efp3054'': No data available
2-4.1.3: /usr/lib/udev/rules.d/50-udev-default.rules:52 MODE 0664

except that the existing one was done with uppercase digits and the full match pattern,
and the second one was done with lowercase digits.

With the previous commit we only have uppercase digits in our match patterns, so we can
drop the duplicate import. (Some other projects might have rules that used the lowercase
match patterns, and people might have some local rules that did that too. But the second
import was only added recently so I think it's better to rip off the bandaid quickly.)
2022-01-04 11:04:53 +01:00
Zbigniew Jędrzejewski-Szmek cc1746bbed hwdb: make usb match patterns uppercase
Those patterns were always supposed to be uppercase.
2022-01-04 11:04:51 +01:00
Zbigniew Jędrzejewski-Szmek 1a37237e2f hwdb: fix check for uppercasedness of match patterns
The check was added in 77547d5313, but
it doesn't work as expected. Because the second part is wrapped in Optional(),
it would silently "succeed" when the lowercase digits were in the second part:

>>> from parse_hwdb import *
>>> g = 'v' + upperhex_word(4) + Optional('p' + upperhex_word(4))
>>> g.parseString('v04D8pE11C*')
(['v', '04D8', 'p', 'E11C'], {})
>>> g.parseString('v04D8pe11c*')
(['v', '04D8'], {})

The following matches are OK:
usb:v0627p0001:*QEMU USB Keyboard*
usb:v0627p0001:*
usb:v0627p0001*
usb:v0627*
2022-01-04 11:04:33 +01:00
Yu Watanabe 1341f25b9b Merge pull request #21778 from evverx/test-cifuzz
tests: run nss-{users|hosts} by default
2022-01-04 18:46:58 +09:00
Evgeny Vereshchagin 5df66d7d68 fuzz: no longer skip empty files
Empty files and empty strings seem to have triggered various
issues in the past so it seems they shouldn't be ignore by the
fuzzers just because fmemopen can't handle them.

Prompted by https://github.com/systemd/systemd/pull/21939#issuecomment-1003113669
2022-01-04 09:26:26 +01:00
Weblate bb18c742c8 po: Update translation files
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Co-authored-by: Weblate <noreply@weblate.org>
Translate-URL: https://translate.fedoraproject.org/projects/systemd/master/
Translation: systemd/main
2022-01-04 14:56:20 +09:00
Zbigniew Jędrzejewski-Szmek e897b07f97 meson: generate better arch defines for clang bpf compilation
The code assume that meson's cpu_family can be mapped directly to
'-D__<cpu_family>__'. This works in a surprising number of cases, but not for a
few architectures. PPC uses "powerpc", and RISC-V omits the trailing underscores.
ARM and RISC-V require a second define too.

Fixes #21900.

(I don't think this matters too much: we need *something* so that gnu/stubs.h
can be successfully included. But we don't actually call syscalls or depend too
much on the host environment, so things should be fine as long as we don't get
a compilation error.)
2022-01-04 00:18:47 +00:00
Luca Boccassi c9b1efdf14 Merge pull request #21990 from keszybz/indentation-and-comments
Indentation and comments
2022-01-04 00:18:10 +00:00
Zbigniew Jędrzejewski-Szmek 5f74fcd41c basic/log: allow errno values higher than 255
When the support for "synthetic errno" was added, we started truncating
the errno value to just the least significant byte. This is generally OK,
because errno values are defined up to ~130.

The docs don't really say what the maximum value is. But at least in principle
higher values could be added in the future. So let's stop truncating
the values needlessly.

The kernel (or libbpf?) have an error where they return 524 as an errno
value (https://bugzilla.redhat.com/show_bug.cgi?id=2036145). We would
confusingly truncate this to 12 (ENOMEM). It seems much nicer to let
strerror() give us "Unknown error 524" rather than to print the bogus
message about ENOMEM.
2022-01-03 22:46:32 +00:00
Zbigniew Jędrzejewski-Szmek c790632cab coredump: do not crash if we failed to acquire exe path
The COREDUMP_EXE attribute is "optional", i.e. we continue to process the
crash even if we didn't acquire it. The coredump generation code assumed
that it is always available:

 #5 endswith at ../src/fundamental/string-util-fundamental.c:41
 [ endswith() is called with NULL here, and an assertion fails. ]
 #6 submit_coredump at ../src/coredump/coredump.c:823
 #7 process_socket at ../src/coredump/coredump.c:1038
 #8 run at ../src/coredump/coredump.c:1413

We use the exe path for loop detection, and also (ultimately) pass it to
dwfl_core_file_report(). The latter seems to be fine will NULL, so let's just
change our code to look at COMM, which should be more reliable anyway.

Fixes https://bugzilla.redhat.com/show_bug.cgi?id=2036517.
2022-01-03 22:44:44 +00:00
Luca Boccassi 73dfeb0c6e Merge pull request #21985 from yuwata/elf-util-cleanups
elf-util: several cleanups
2022-01-03 22:44:20 +00:00
Zbigniew Jędrzejewski-Szmek acee2a2553 po: drop Project-Id-Version from header template
Since they were pretty inconsistent anyway, let's assume that they
don't matter.
2022-01-03 21:19:20 +01:00
Zbigniew Jędrzejewski-Szmek b36c5e9587 various: fix three spelling issues found by fossies 2022-01-03 21:16:06 +01:00
Zbigniew Jędrzejewski-Szmek df1f621bda docs: update branch names
Also use --atomic when pushing multiple items with git;
adjust some external URLs.
2022-01-03 21:15:21 +01:00
Yu Watanabe 633c3e8aa2 coredump: drop unnecessary parentheses 2022-01-04 04:27:11 +09:00
Yu Watanabe 80b241f2ec elf-util: add missing assertion 2022-01-04 04:27:11 +09:00
Yu Watanabe fe8fdc4760 elf-util: reduce variable scope 2022-01-04 04:27:11 +09:00
Yu Watanabe d090049c01 elf-util: executable argument for parse_elf() may be NULL
Fixes assertion triggered by parse_package_metadata() and json_build().
2022-01-04 04:27:09 +09:00
Yu Watanabe 3876cfafd0 elf-util: reduce variable scope and indentation 2022-01-04 04:11:55 +09:00
Yu Watanabe e794bcaf1c elf-util: reduce variable scope and indentation 2022-01-04 04:11:55 +09:00
Zbigniew Jędrzejewski-Szmek e97a300148 Merge pull request #21941 from yuwata/hostname-handle-empty
hostname-setup: support kernel with empty CONFIG_DEFAULT_HOSTNAME
2022-01-03 19:56:57 +01:00
Jan Janssen 8fb16fee96 boot: Do not warn if an initializing driver returns EFI_ABORTED
Fixes: #21965
2022-01-03 19:42:36 +01:00
Zbigniew Jędrzejewski-Szmek 3c7af1af7d basic: adjust wording and wrapping of comments 2022-01-03 19:18:55 +01:00
Zbigniew Jędrzejewski-Szmek 606309d554 test-bpf-lsm: drop some parens 2022-01-03 19:18:55 +01:00
Zbigniew Jędrzejewski-Szmek 333cf6c6ae test-job-type: modernize code a bit 2022-01-03 19:18:55 +01:00
Zbigniew Jędrzejewski-Szmek b7cba81553 core/bpf: tighten handling of return values, improve messages
The code was written unidiomatically, using r as a boolean value, and
confusing errno and r in some places. AFAICS, there wasn't any actual
problem: even in the one place where errno was used instead of r, it would
almost certainly be initialized.

It seems that some libbpf functions set errno, while others return the
error, possibly encoded. Since there are almost no docs, the only way to
know is to read the code of the function. To make matters worse, there is
a global libbpf_mode which can be set to change the convention. With
LIBBPF_STRICT_DIRECT_ERRS in libbpf_mode, some functions set errno while others
return a negative error, and the only way to know is to read the code, except
that the split is now different. We currently don't set
LIBBPF_STRICT_DIRECT_ERRS, but even the possibility makes everything harder
to grok.

This is all very error-prone. Let's at least add some asserts to make sure that
the returned values are as expected.
2022-01-03 19:18:55 +01:00
Zbigniew Jędrzejewski-Szmek 92698b0f9e core/bpf: avoid unnecessary initialization of variables, tighten scope
No funtional change.
2022-01-03 19:18:55 +01:00
Zbigniew Jędrzejewski-Szmek 7185af6234 Merge pull request #21970 from yuwata/seccomp-util-fix-build
seccomp-util: fix build failure
2022-01-03 16:44:10 +01:00