Commit Graph
57095 Commits
Author SHA1 Message Date
Frantisek Sumsal ab9760b846 github: point to "tags" instead of "releases" in systemd-stable
since we don't do releases there.

Mentioned in https://github.com/systemd/systemd/issues/22230#issue-1111991271.
2022-01-24 06:53:43 +09:00
Yu Watanabe 46b53e8035 resolve: synthesize null address, IPv4 broadcast address, or invalid domain
These are filtered in `dns_scope_good_domain()`, but not synthesized.

Fixes #22229.
2022-01-24 06:46:50 +09:00
Yu Watanabe 3b2ac14ac4 resolve: synthesize empty name
Do not return any error for empty name. Just returns empty answer.

Before:
---
$ dig .

; <<>> DiG 9.16.24-RH <<>> .
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: SERVFAIL, id: 13617
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 65494
;; QUESTION SECTION:
;.				IN	A

;; Query time: 0 msec
;; SERVER: 127.0.0.53#53(127.0.0.53)
;; WHEN: Mon Jan 24 05:49:30 JST 2022
;; MSG SIZE  rcvd: 28
---

After:
---
$ dig .

; <<>> DiG 9.16.24-RH <<>> .
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 7957
;; flags: qr aa rd ra ad; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 65494
;; QUESTION SECTION:
;.				IN	A

;; Query time: 1 msec
;; SERVER: 127.0.0.53#53(127.0.0.53)
;; WHEN: Mon Jan 24 06:05:02 JST 2022
;; MSG SIZE  rcvd: 28
---

Replaces #22197.

Fixes RHBZ#2039854 (https://bugzilla.redhat.com/show_bug.cgi?id=2039854).
2022-01-24 06:45:37 +09:00
Yu Watanabe 7bdf419830 dns-domain: re-introduce dns_name_is_empty() 2022-01-24 06:06:59 +09:00
Yu Watanabe 7c0601102a Revert "resolve: refuse to resolve empty hostname"
This reverts commit 6e8ecb8974.
2022-01-24 05:51:47 +09:00
Yu Watanabe a596631808 fuzz: add testcases of heap-buffer-overflow for sd-dhcp-server 2022-01-24 04:52:33 +09:00
Yu Watanabe ab4f9eeb7b sd-dhcp-server: fix heap buffer overflow
This checks client hardware length earlier.
2022-01-24 04:49:33 +09:00
Yu Watanabe b87209f933 Merge pull request #22222 from yuwata/dhcp-server-support-non-ethernet-packet
dhcp-server: support packets from non-Ethernet interfaces
2022-01-24 04:19:26 +09:00
Yu Watanabe 54d95d02e3 sd-dhcp-server: support packet from non-Ethernet interface
Fixes #22217.
2022-01-24 04:18:20 +09:00
Yu Watanabe 97fa338dce sd-dhcp-client,sd-dhcp-client-server: set chaddr in dhcp_message_init()
And also set chaddr and hlen for packets on non-Ethernet interfaces,
except for InfiniBand.
2022-01-24 04:18:20 +09:00
Yu Watanabe a6508f37c9 sd-dhcp-client: fix RFC number 2022-01-24 04:18:20 +09:00
Yu Watanabe 2cb66bbdfb sd-dhcp-server: change the type of the client ID data 2022-01-24 04:18:20 +09:00
Yu Watanabe 255d493324 sd-dhcp-server: use free_and_replace() at one more place 2022-01-24 04:18:20 +09:00
Yu Watanabe 4f9dcf3dc5 sd-dhcp-server: shorten code a bit 2022-01-24 04:18:20 +09:00
Yu Watanabe f4759ae051 sd-dhcp-server: drop unnecessary buffer duplication
The block try to find and remove the existing static lease which matches
the provided client ID, and the provided client ID will not be stored
anywhere. Hence, it is not necessary to duplicate it.
2022-01-24 04:16:41 +09:00
Yu Watanabe bb995f747a Merge pull request #21908 from yonran/environmentfile-docs
man: clarify Environmentfile format
2022-01-24 00:22:50 +09:00
Luca Boccassi 2ef2024462 portable: add support for ExtensionDirectories in --extension
Same as for the root os image, support passing a directory, using
the new ExtensionDirectories setting.
2022-01-24 00:21:15 +09:00
Zbigniew Jędrzejewski-Szmek e9e982a29d test-env-file: add tests for quoting in env files 2022-01-23 14:40:28 +09:00
Zbigniew Jędrzejewski-Szmek 398a500916 core/execute: use _cleanup_ in exec_context_load_environment()
Also rename variables.
2022-01-23 14:39:46 +09:00
Zbigniew Jędrzejewski-Szmek 3ef86964ed test-load-fragment: add a basic test for config_parse_unit_env_file() 2022-01-23 14:37:07 +09:00
Yonathan Randolph 4bbcde8498 man: clarify Environmentfile format
Remove incorrect claim that C escapes (such as \t and \n) are recognized and that control characters are disallowed. Specify the allowed characters and escapes with single quotes, with double quotes, and without quotes.
2022-01-23 14:37:07 +09:00
ash de4fe289cf man: note more clearly that $SYSTEMD_PAGER requires $SYSTEMD_PAGERSECURE 2022-01-23 13:29:28 +09:00
Thomas Haller 2091c77931 sd-event: workaround maybe-uninitalized warning in sd_event_add_inotify()
With LTO, the compiler might think that the variable is uninitialized
(from NetworkManager's fork, with gcc-11.2.1-1.fc35):

    src/libnm-systemd-core/src/libsystemd/sd-event/sd-event.c: In function 'sd_event_add_inotify':
    src/libnm-systemd-core/src/libsystemd/sd-event/sd-event.c:2120: error: 's' may be used uninitialized in this function [-Werror=maybe-uninitialized]
     2120 |                 *ret = s;
          |
    src/libnm-systemd-core/src/libsystemd/sd-event/sd-event.c:2102: note: 's' was declared here
     2102 |         sd_event_source *s;
          |
    lto1: all warnings being treated as errors

In particular, that would happen for codepaths where event_add_inotify_fd_internal()
returns `-errno`, and the compiler cannot be sure that the returned value will
be negative. Technically, the compiler is right, but we rely on libc functions
to set errno correctly, so this only happens in code paths, where something
bad already happend.

While LTO is prone to such false warnings, we are largely able to build systemd
without warnings. So it is feasible and we should make the effort of working
around warnings as they appear.
2022-01-23 13:10:31 +09:00
Yu Watanabe da60d91c99 rule: fallback to use board information if product information is not set 2022-01-23 13:04:37 +09:00
Yu Watanabe a93306a22e rule: make ID_SYSFS_ATTRIBUTE_MODEL also accept product_name 2022-01-23 12:54:37 +09:00
Yu Watanabe 4fc7e4f374 hostname: allow to override hardware vendor and model
Sometimes hardware vendor does not set DMI info correctly.
Already there is a way that the dbus properties can be overriden by
using hwdb. But that is not user friendly.

This adds two new fields in /etc/machine-info.

Closes #22207.
2022-01-23 12:48:00 +09:00
Yu Watanabe 8c8b1800e9 hostname: introduce context_get_chassis() and use it everywhere
Follow-up for 4b35eb2579.
2022-01-23 03:11:29 +09:00
Frantisek Sumsal e7642152ae packit: switch the remaining jobs to F35
gcc-12 seems to be very unstable right now, so to keep our CI builds
useful let's move them to stable F35 for a while.

Follow-up to 478c632e00.
See:
  * https://github.com/systemd/systemd/issues/22215
  * https://bugzilla.redhat.com/show_bug.cgi?id=2043915
2022-01-22 15:27:04 +00:00
Yu Watanabe f939a8984a Merge pull request #22209 from systemd/wip/hadess/chassis-override
hostname: Allow overriding the chassis type from hwdb
2022-01-22 16:49:36 +09:00
Julia Kartseva 8fe9dbb926 bpf: name unnamed bpf programs
bpf-firewall and bpf-devices do not have names. This complicates
debugging with bpftool(8).

Assign names starting with 'sd_' prefix:
* firewall program names are 'sd_fw_ingress' for ingress attach
point and 'sd_fw_egress' for egress.
* 'sd_devices' for devices prog

'sd_' prefix is already used in source-compiled programs, e.g.
sd_restrictif_i, sd_restrictif_e, sd_bind6.

The name must not be longer than 15 characters or BPF_OBJ_NAME_LEN - 1.

Assign names only to programs loaded to kernel by systemd since
programs pinned to bpffs are already loaded.
2022-01-22 16:48:42 +09:00
YmrDtnJu df4ec48f45 Fix journald audit logging with fields > N_IOVEC_AUDIT_FIELDS.
ELEMENTSOF(iovec) is not the correct value for the newly introduced parameter m
to function map_all_fields because it is the maximum number of elements in the
iovec array, including those reserved for N_IOVEC_META_FIELDS. The correct
value is the current number of already used elements in the array plus the
maximum number to use for fields decoded from the kernel audit message.
2022-01-21 23:12:45 +00:00
Jan Janssen 76fb85316e boot: Only build with debug symbols in developer mode
The debug symbols are of very limited use in proper deployments
unlike with regular userspace. Unless someone goes through the pain
of setting up an EFI debugger (assuming their firmware even supports
this in the first place) any provided debug symbols will just be
useless.
Debugging under QEMU is possible, but even then it is non-trivial
to set up, so anyone willing to go that far can just build in
developer mode.

Meanwhile, at least x86 firmware tends to refuse binaries that contain
debug symbols. We do strip the files when converted to PE anyway, but
the elf file needs to stay around on other arches as objcopy does not
support PE as input there.

Also, the generated debug symbols seem to be not reproducible when
building with LTO. Whether this is an issue in tooling or our side
is unclear. This works around this issue.

Fixes: #22157
2022-01-21 23:11:36 +00:00
Bastien Nocera bdf182debe hwdb: Add Microsoft Surface Pro 1 chassis quirk
See https://github.com/systemd/systemd/issues/7390#issuecomment-345546127
2022-01-21 21:59:09 +01:00
Bastien Nocera 4b35eb2579 hostname: Allow overriding the chassis type from hwdb
Closes: #7390
2022-01-21 21:59:09 +01:00
Yu Watanabe 57cbf080b3 Merge pull request #22205 from yuwata/udevadm-info-cleanups
udevadm: keep watch directory and several cleanups
2022-01-22 02:45:36 +09:00
Daan De Meyer e93ada9821 meson: Add missing test dependencies
Currently, running "meson build" followed by "meson test -C build"
will result in many failed tests due to missing dependencies. This
commit adds the missing dependencies to make sure no tests fail.
2022-01-22 01:56:03 +09:00
Yu Watanabe 4881a0d2d4 udevadm: add more assertions 2022-01-22 00:45:14 +09:00
Yu Watanabe 636ab00182 udevadm: simplify the code of removing udev state files 2022-01-22 00:44:51 +09:00
Yu Watanabe 9e0bd1d69b udevadm: split assertions
Then we can easily find which pointer is NULL.
2022-01-22 00:16:38 +09:00
Yu Watanabe bd97980193 udevadm: do not remove watch directory
See the comment in the code.
2022-01-22 00:13:32 +09:00
Yu Watanabe ac16a593cf Merge pull request #22202 from mwilck/keep-links-02
udevadm info --cleanup-db: don't delete information for kept db entries
2022-01-22 00:10:09 +09:00
Luca Boccassi a07b992606 core: add ExtensionDirectories= setting
Add a new setting that follows the same principle and implementation
as ExtensionImages, but using directories as sources.
It will be used to implement support for extending portable images
with directories, since portable services can already use a directory
as root.
2022-01-21 22:53:12 +09:00
Martin Wilck 7ec624147a udevadm: cleanup-db: don't delete information for kept db entries
devices with the db_persist property won't be deleted during database
cleanup. This applies to dm and md devices in particular.
For such devices, we should also keep the files under /run/udev/links,
/run/udev/tags, and /run/udev/watch, to make sure that after restart,
udevd has the same information about the devices as it did before
the cleanup.

If we don't do this, a lower-priority device that is discovered in
the coldplug phase may take over symlinks from a device that persisted.
Not removing the watches also enables udevd to resume watching a device
after restart.

Signed-off-by: Martin Wilck <mwilck@suse.com>
2022-01-21 13:32:20 +01:00
Martin Wilck 28d6e85451 udevadm: cleanup_dir: use dot_or_dot_dot()
which is safer than just checking dent[0].
Also, fix two style issues.
2022-01-21 13:31:42 +01:00
Luca Boccassi 071be9701a Merge pull request #22195 from keszybz/more-specifiers
Add unit specifiers for fragment path and directory
2022-01-21 11:22:22 +00:00
Zbigniew Jędrzejewski-Szmek 607f032858 core: add %y/%Y specifiers for the fragment path of the unit
Fixes #6308: people want to be able to link a unit file via 'systemctl enable'
from a git checkout or such and refer to other files in the same repo.
The new specifiers make that easy.

%y/%Y is used because other more obvious choices like %d/%D or %p/%P are
not available because at least on of the two letters is already used.

The new specifiers are only available in units. Technically it would be
trivial to add then in [Install] too, but I don't see how they could be
useful, so I didn't do that.

I added both %y and %Y because both were requested in the issue, and because I
think both could be useful, depending on the case. %Y to refer to other files
in the same repo, and %y in the case where a single repo has multiple unit files,
and e.g. each unit has some corresponding asset named after the unit file.
2022-01-21 08:00:41 +01:00
Yu Watanabe 0d63af0977 Merge pull request #22199 from yuwata/resolve-reduce-attempts-reading-networkd-link-file
resolve: reduce attempts of reading networkd's link file
2022-01-21 09:45:45 +09:00
Yu Watanabe 6e8ecb8974 resolve: refuse to resolve empty hostname
Previously, varlink or dbus methods return
io.systemd.Resolve.NoNameServers or BUS_ERROR_NO_NAME_SERVERS if an
empty hostname is provided, and thus nss-resolve returns NSS_STATUS_TRYAGAIN.

That causes getaddrinfo() returns 'Temporary failure in name resolution'
instead of 'Name or service not known'.

This makes calling varlink or dbus method with an empty hostname result
-EINVAL, and hence nss-resolve returns NSS_STATUS_NOTFOUND.

Fixes RHBZ#2039854 (https://bugzilla.redhat.com/show_bug.cgi?id=2039854).
2022-01-21 09:45:29 +09:00
Yu Watanabe 9969c901d3 Merge pull request #22183 from anitazha/oomdkillfix
oomd: fix potential race between killing cgroups and cleaning up cgroups
2022-01-21 09:44:12 +09:00
Jan Janssen 1e11b6a76d meson: Add missing boot headers and use @INPUT@ for linking 2022-01-21 08:48:17 +09:00