]> git.ipfire.org Git - thirdparty/systemd.git/log
thirdparty/systemd.git
3 years agowait-online: make manager_link_is_online() return 0 when in unmanaged state 22249/head
Yu Watanabe [Wed, 26 Jan 2022 07:48:08 +0000 (16:48 +0900)] 
wait-online: make manager_link_is_online() return 0 when in unmanaged state

Previously, even if a link is in unmanaged state, the function may
returns positive value. So, even if all managed links are in the configured
sate but do not satisfy the online criteria, e.g., IPv4 address state,
then wait-online finishes with positive value.

This makes the function always return 0 for unmanaged state. So, at
least one managed link must satisfies the online criteria.

This also adds more comments and debugging logs.

Fixes #22246.

3 years agowait-online: rename Manager elements
Yu Watanabe [Wed, 26 Jan 2022 11:54:39 +0000 (20:54 +0900)] 
wait-online: rename Manager elements

3 years agoportable: add GetImageStateWithExtensions method
Luca Boccassi [Mon, 24 Jan 2022 17:42:32 +0000 (17:42 +0000)] 
portable: add GetImageStateWithExtensions method

Allow to correctly query a layered portable service for
attached/detached state.

3 years agohostname: expose hardware serial through dbus
Yu Watanabe [Sat, 22 Jan 2022 18:12:35 +0000 (03:12 +0900)] 
hostname: expose hardware serial through dbus

Closes #22119.

3 years agoNEWS: update
Yu Watanabe [Mon, 24 Jan 2022 18:03:09 +0000 (03:03 +0900)] 
NEWS: update

3 years agoNEWS: mention about the regression in WireGuard
Yu Watanabe [Mon, 24 Jan 2022 17:40:37 +0000 (02:40 +0900)] 
NEWS: mention about the regression in WireGuard

3 years agoMerge pull request #22236 from yuwata/fuzz-dhcp-server
Yu Watanabe [Mon, 24 Jan 2022 17:19:22 +0000 (02:19 +0900)] 
Merge pull request #22236 from yuwata/fuzz-dhcp-server

fuzz-dhcp-server: three fixes or improvements

3 years agofuzz-dhcp-server: attach sd_event to make dhcp_server_cleanup_expired_leases() works... 22236/head
Yu Watanabe [Mon, 24 Jan 2022 15:04:59 +0000 (00:04 +0900)] 
fuzz-dhcp-server: attach sd_event to make dhcp_server_cleanup_expired_leases() works in the fuzzer

Otherwise, most code paths in dhcp_server_handle_message() are not
evaluated by the fuzzer.

3 years agoUpdate systemd.netdev.xml
march1993 [Mon, 17 Jan 2022 14:11:28 +0000 (22:11 +0800)] 
Update systemd.netdev.xml

Mind users to avoid use name gre0, gretap0 and erspan0 for GRE tunnels.

3 years agouser-runtime-dir: error out immediately if mkdir fails
Zbigniew Jędrzejewski-Szmek [Mon, 24 Jan 2022 09:53:00 +0000 (10:53 +0100)] 
user-runtime-dir: error out immediately if mkdir fails

We try to create two directories: /run/user and /run/user/<UID>. For the
first we check the return value and error out if creation fails. But for
the second one we continued based on the assumption that the subsequent
mount will immediately fail anyway. But this has the disadvantage that we
get a somewhat confusing error message:

janv. 23 22:04:31 nsfw systemd-user-runtime-dir[1660]: Failed to mount per-user tmpfs directory /run/user/1000: No such file or directory

Let's instead fail immediately with a precise error message.

For https://bugzilla.redhat.com/show_bug.cgi?id=2044100.

3 years agoMerge pull request #22203 from brauner/2022-01-21.procsubset.pid
Luca Boccassi [Mon, 24 Jan 2022 13:04:23 +0000 (13:04 +0000)] 
Merge pull request #22203 from brauner/2022-01-21.procsubset.pid

core/namespace: allow using ProtectSubset=pid and ProtectHostname=tru…

3 years agoMerge pull request #22231 from yuwata/resolve-synthesize
Luca Boccassi [Mon, 24 Jan 2022 12:11:29 +0000 (12:11 +0000)] 
Merge pull request #22231 from yuwata/resolve-synthesize

resolve: synthesize several filtered name

3 years agofuzz-dhcp-server: duplicate input data
Yu Watanabe [Mon, 24 Jan 2022 10:35:14 +0000 (19:35 +0900)] 
fuzz-dhcp-server: duplicate input data

As `dhcp_server_handle_message()` -> `ensure_sane_request()` may modify
the input data, and that causes error in some fuzzing engine.

3 years agofuzz-dhcp-server: also set new lease elements correctly
Yu Watanabe [Mon, 24 Jan 2022 10:26:25 +0000 (19:26 +0900)] 
fuzz-dhcp-server: also set new lease elements correctly

The fuzzer does not send anything to the address, so it should be not
necessary, but just for safety.

3 years agocore/namespace: s/normalize_mounts()/drop_unused_mounts() 22203/head
Christian Brauner [Mon, 24 Jan 2022 09:12:57 +0000 (10:12 +0100)] 
core/namespace: s/normalize_mounts()/drop_unused_mounts()

Rename the normalize_mounts() helper to drop_unused_mounts. All the
helpers called in there get rid of mounts that are unused for a variety
of reasons. And whereas the helpers are aptly prefixed with "drop" the
overall helper isn't and instead uses "normalize".

Make it more obvious what the helper actually does by renaming it from
normalize_mounts() to drop_unused_mounts(). Readers of code calling this
helper will immediately see that it will get rid of unused mounts.

Link: https://github.com/systemd/systemd/issues/22206
3 years agocore/namespace: allow using ProtectSubset=pid and ProtectHostname=true together
Christian Brauner [Fri, 21 Jan 2022 12:08:19 +0000 (13:08 +0100)] 
core/namespace: allow using ProtectSubset=pid and ProtectHostname=true together

If a service requests both ProtectSubset=pid and ProtectHostname=true
then it will currently fail to start. The ProcSubset=pid option
instructs systemd to mount procfs for the service with subset=pid which
hides all entries other than /proc/<pid>. Consequently trying to
interact with the two files /proc/sys/kernel/{hostname,domainname}
covered by ProtectHostname=true will fail.

Fix this by only performing this check when ProtectSubset=pid is not
requested. Essentially ProtectSubset=pid implies/provides
ProtectHostname=true.

3 years agobuild(deps): bump github/codeql-action from 1.0.27 to 1.0.29
dependabot[bot] [Mon, 24 Jan 2022 07:37:07 +0000 (07:37 +0000)] 
build(deps): bump github/codeql-action from 1.0.27 to 1.0.29

Bumps [github/codeql-action](https://github.com/github/codeql-action) from 1.0.27 to 1.0.29.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/github/codeql-action/compare/cd783c8a29bdcf5a5c79c5137889e24651fa626c...384cfc42b2131df01c009d3d2eed7b78d8e8556e)

---
updated-dependencies:
- dependency-name: github/codeql-action
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
3 years agoMerge pull request #22226 from yuwata/hostname-allow-to-override-hardware-vendor...
Yu Watanabe [Sun, 23 Jan 2022 21:55:29 +0000 (06:55 +0900)] 
Merge pull request #22226 from yuwata/hostname-allow-to-override-hardware-vendor-and-model

hostname: allow to override hardware vendor and model

3 years agoMerge pull request #22227 from yuwata/dhcp-server-fix-heap-buffer-overflow
Yu Watanabe [Sun, 23 Jan 2022 21:55:02 +0000 (06:55 +0900)] 
Merge pull request #22227 from yuwata/dhcp-server-fix-heap-buffer-overflow

sd-dhcp-server: fix heap buffer overflow

3 years agogithub: point to "tags" instead of "releases" in systemd-stable
Frantisek Sumsal [Sun, 23 Jan 2022 21:49:57 +0000 (22:49 +0100)] 
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.

3 years agoresolve: synthesize null address, IPv4 broadcast address, or invalid domain 22231/head
Yu Watanabe [Sun, 23 Jan 2022 21:36:53 +0000 (06:36 +0900)] 
resolve: synthesize null address, IPv4 broadcast address, or invalid domain

These are filtered in `dns_scope_good_domain()`, but not synthesized.

Fixes #22229.

3 years agoresolve: synthesize empty name
Yu Watanabe [Sun, 23 Jan 2022 21:07:33 +0000 (06:07 +0900)] 
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).

3 years agodns-domain: re-introduce dns_name_is_empty()
Yu Watanabe [Sun, 23 Jan 2022 21:06:55 +0000 (06:06 +0900)] 
dns-domain: re-introduce dns_name_is_empty()

3 years agoRevert "resolve: refuse to resolve empty hostname"
Yu Watanabe [Sun, 23 Jan 2022 20:51:47 +0000 (05:51 +0900)] 
Revert "resolve: refuse to resolve empty hostname"

This reverts commit 6e8ecb8974db74eba716bfd75231987172e10d83.

3 years agofuzz: add testcases of heap-buffer-overflow for sd-dhcp-server 22227/head
Yu Watanabe [Sun, 23 Jan 2022 19:52:33 +0000 (04:52 +0900)] 
fuzz: add testcases of heap-buffer-overflow for sd-dhcp-server

3 years agosd-dhcp-server: fix heap buffer overflow
Yu Watanabe [Sun, 23 Jan 2022 19:49:30 +0000 (04:49 +0900)] 
sd-dhcp-server: fix heap buffer overflow

This checks client hardware length earlier.

3 years agoMerge pull request #22222 from yuwata/dhcp-server-support-non-ethernet-packet
Yu Watanabe [Sun, 23 Jan 2022 19:19:26 +0000 (04:19 +0900)] 
Merge pull request #22222 from yuwata/dhcp-server-support-non-ethernet-packet

dhcp-server: support packets from non-Ethernet interfaces

3 years agosd-dhcp-server: support packet from non-Ethernet interface 22222/head
Yu Watanabe [Sat, 22 Jan 2022 17:27:32 +0000 (02:27 +0900)] 
sd-dhcp-server: support packet from non-Ethernet interface

Fixes #22217.

3 years agosd-dhcp-client,sd-dhcp-client-server: set chaddr in dhcp_message_init()
Yu Watanabe [Sat, 22 Jan 2022 17:14:31 +0000 (02:14 +0900)] 
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.

3 years agosd-dhcp-client: fix RFC number
Yu Watanabe [Sun, 23 Jan 2022 02:15:43 +0000 (11:15 +0900)] 
sd-dhcp-client: fix RFC number

3 years agosd-dhcp-server: change the type of the client ID data
Yu Watanabe [Sat, 22 Jan 2022 17:47:32 +0000 (02:47 +0900)] 
sd-dhcp-server: change the type of the client ID data

3 years agosd-dhcp-server: use free_and_replace() at one more place
Yu Watanabe [Sat, 22 Jan 2022 17:46:46 +0000 (02:46 +0900)] 
sd-dhcp-server: use free_and_replace() at one more place

3 years agosd-dhcp-server: shorten code a bit
Yu Watanabe [Sun, 23 Jan 2022 02:11:43 +0000 (11:11 +0900)] 
sd-dhcp-server: shorten code a bit

3 years agosd-dhcp-server: drop unnecessary buffer duplication
Yu Watanabe [Sat, 22 Jan 2022 17:27:26 +0000 (02:27 +0900)] 
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.

3 years agoMerge pull request #21908 from yonran/environmentfile-docs
Yu Watanabe [Sun, 23 Jan 2022 15:22:50 +0000 (00:22 +0900)] 
Merge pull request #21908 from yonran/environmentfile-docs

man: clarify Environmentfile format

3 years agoportable: add support for ExtensionDirectories in --extension
Luca Boccassi [Sat, 22 Jan 2022 01:53:54 +0000 (01:53 +0000)] 
portable: add support for ExtensionDirectories in --extension

Same as for the root os image, support passing a directory, using
the new ExtensionDirectories setting.

3 years agotest-env-file: add tests for quoting in env files 21908/head
Zbigniew Jędrzejewski-Szmek [Wed, 19 Jan 2022 09:15:50 +0000 (10:15 +0100)] 
test-env-file: add tests for quoting in env files

3 years agocore/execute: use _cleanup_ in exec_context_load_environment()
Zbigniew Jędrzejewski-Szmek [Wed, 19 Jan 2022 08:51:19 +0000 (09:51 +0100)] 
core/execute: use _cleanup_ in exec_context_load_environment()

Also rename variables.

3 years agotest-load-fragment: add a basic test for config_parse_unit_env_file()
Zbigniew Jędrzejewski-Szmek [Wed, 19 Jan 2022 08:39:55 +0000 (09:39 +0100)] 
test-load-fragment: add a basic test for config_parse_unit_env_file()

3 years agoman: clarify Environmentfile format
Yonathan Randolph [Mon, 27 Dec 2021 01:12:00 +0000 (17:12 -0800)] 
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.

3 years agoman: note more clearly that $SYSTEMD_PAGER requires $SYSTEMD_PAGERSECURE
ash [Sat, 22 Jan 2022 14:49:54 +0000 (14:49 +0000)] 
man: note more clearly that $SYSTEMD_PAGER requires $SYSTEMD_PAGERSECURE

3 years agosd-event: workaround maybe-uninitalized warning in sd_event_add_inotify()
Thomas Haller [Sat, 22 Jan 2022 14:02:04 +0000 (15:02 +0100)] 
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.

3 years agorule: fallback to use board information if product information is not set 22226/head
Yu Watanabe [Sun, 23 Jan 2022 03:57:43 +0000 (12:57 +0900)] 
rule: fallback to use board information if product information is not set

3 years agorule: make ID_SYSFS_ATTRIBUTE_MODEL also accept product_name
Yu Watanabe [Sat, 22 Jan 2022 06:20:06 +0000 (15:20 +0900)] 
rule: make ID_SYSFS_ATTRIBUTE_MODEL also accept product_name

3 years agohostname: allow to override hardware vendor and model
Yu Watanabe [Sat, 22 Jan 2022 01:44:50 +0000 (10:44 +0900)] 
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.

3 years agohostname: introduce context_get_chassis() and use it everywhere
Yu Watanabe [Sat, 22 Jan 2022 14:53:09 +0000 (23:53 +0900)] 
hostname: introduce context_get_chassis() and use it everywhere

Follow-up for 4b35eb2579b226785f0d94129a7652450f9723fd.

3 years agopackit: switch the remaining jobs to F35
Frantisek Sumsal [Sat, 22 Jan 2022 15:00:22 +0000 (16:00 +0100)] 
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 478c632e00ffbf50012b1946a8a025494c012353.
See:
  * https://github.com/systemd/systemd/issues/22215
  * https://bugzilla.redhat.com/show_bug.cgi?id=2043915

3 years agoMerge pull request #22209 from systemd/wip/hadess/chassis-override
Yu Watanabe [Sat, 22 Jan 2022 07:49:36 +0000 (16:49 +0900)] 
Merge pull request #22209 from systemd/wip/hadess/chassis-override

hostname: Allow overriding the chassis type from hwdb

3 years agobpf: name unnamed bpf programs
Julia Kartseva [Sat, 22 Jan 2022 02:50:26 +0000 (18:50 -0800)] 
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.

3 years agoFix journald audit logging with fields > N_IOVEC_AUDIT_FIELDS.
YmrDtnJu [Fri, 21 Jan 2022 17:21:27 +0000 (18:21 +0100)] 
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.

3 years agoboot: Only build with debug symbols in developer mode
Jan Janssen [Fri, 21 Jan 2022 17:34:04 +0000 (18:34 +0100)] 
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
3 years agohwdb: Add Microsoft Surface Pro 1 chassis quirk 22209/head
Bastien Nocera [Fri, 21 Jan 2022 17:57:21 +0000 (18:57 +0100)] 
hwdb: Add Microsoft Surface Pro 1 chassis quirk

See https://github.com/systemd/systemd/issues/7390#issuecomment-345546127

3 years agohostname: Allow overriding the chassis type from hwdb
Bastien Nocera [Fri, 21 Jan 2022 17:56:42 +0000 (18:56 +0100)] 
hostname: Allow overriding the chassis type from hwdb

Closes: #7390
3 years agoMerge pull request #22205 from yuwata/udevadm-info-cleanups
Yu Watanabe [Fri, 21 Jan 2022 17:45:36 +0000 (02:45 +0900)] 
Merge pull request #22205 from yuwata/udevadm-info-cleanups

udevadm: keep watch directory and several cleanups

3 years agomeson: Add missing test dependencies
Daan De Meyer [Fri, 21 Jan 2022 14:28:23 +0000 (14:28 +0000)] 
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.

3 years agoudevadm: add more assertions 22205/head
Yu Watanabe [Fri, 21 Jan 2022 15:44:12 +0000 (00:44 +0900)] 
udevadm: add more assertions

3 years agoudevadm: simplify the code of removing udev state files
Yu Watanabe [Fri, 21 Jan 2022 15:35:15 +0000 (00:35 +0900)] 
udevadm: simplify the code of removing udev state files

3 years agoudevadm: split assertions
Yu Watanabe [Fri, 21 Jan 2022 15:16:35 +0000 (00:16 +0900)] 
udevadm: split assertions

Then we can easily find which pointer is NULL.

3 years agoudevadm: do not remove watch directory
Yu Watanabe [Fri, 21 Jan 2022 15:13:28 +0000 (00:13 +0900)] 
udevadm: do not remove watch directory

See the comment in the code.

3 years agoMerge pull request #22202 from mwilck/keep-links-02
Yu Watanabe [Fri, 21 Jan 2022 15:10:09 +0000 (00:10 +0900)] 
Merge pull request #22202 from mwilck/keep-links-02

udevadm info --cleanup-db: don't delete information for kept db entries

3 years agocore: add ExtensionDirectories= setting
Luca Boccassi [Mon, 17 Jan 2022 01:14:14 +0000 (01:14 +0000)] 
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.

3 years agoudevadm: cleanup-db: don't delete information for kept db entries 22202/head
Martin Wilck [Thu, 20 Jan 2022 13:31:45 +0000 (14:31 +0100)] 
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>
3 years agoudevadm: cleanup_dir: use dot_or_dot_dot()
Martin Wilck [Fri, 21 Jan 2022 09:44:26 +0000 (10:44 +0100)] 
udevadm: cleanup_dir: use dot_or_dot_dot()

which is safer than just checking dent[0].
Also, fix two style issues.

3 years agoMerge pull request #22195 from keszybz/more-specifiers
Luca Boccassi [Fri, 21 Jan 2022 11:22:22 +0000 (11:22 +0000)] 
Merge pull request #22195 from keszybz/more-specifiers

Add unit specifiers for fragment path and directory

3 years agocore: add %y/%Y specifiers for the fragment path of the unit 22195/head
Zbigniew Jędrzejewski-Szmek [Thu, 20 Jan 2022 15:45:19 +0000 (16:45 +0100)] 
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.

3 years agoMerge pull request #22199 from yuwata/resolve-reduce-attempts-reading-networkd-link...
Yu Watanabe [Fri, 21 Jan 2022 00:45:45 +0000 (09:45 +0900)] 
Merge pull request #22199 from yuwata/resolve-reduce-attempts-reading-networkd-link-file

resolve: reduce attempts of reading networkd's link file

3 years agoresolve: refuse to resolve empty hostname
Yu Watanabe [Thu, 20 Jan 2022 18:03:45 +0000 (03:03 +0900)] 
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).

3 years agoMerge pull request #22183 from anitazha/oomdkillfix
Yu Watanabe [Fri, 21 Jan 2022 00:44:12 +0000 (09:44 +0900)] 
Merge pull request #22183 from anitazha/oomdkillfix

oomd: fix potential race between killing cgroups and cleaning up cgroups

3 years agomeson: Add missing boot headers and use @INPUT@ for linking
Jan Janssen [Thu, 20 Jan 2022 20:12:44 +0000 (21:12 +0100)] 
meson: Add missing boot headers and use @INPUT@ for linking

3 years agooomd: handle situations when no cgroups are killed 22183/head
Anita Zhang [Wed, 19 Jan 2022 21:26:01 +0000 (13:26 -0800)] 
oomd: handle situations when no cgroups are killed

Currently if systemd-oomd doesn't kill anything in a selected cgroup, it
selects a new candidate immediately. But if a selected cgroup wasn't killed,
it is likely due to it disappearing or getting cleaned up between the time
it was selected as a candidate and getting sent SIGKILL(s). We should handle
it as though systemd-oomd did perform a kill so that it will check
swap/pressure again before it tries to select a new candidate.

3 years agooomd: fix race with path unavailability when killing cgroups
Anita Zhang [Wed, 19 Jan 2022 18:40:46 +0000 (10:40 -0800)] 
oomd: fix race with path unavailability when killing cgroups

There can be a situation where systemd-oomd would kill all of the processes
in a cgroup, pid1 would clean up that cgroup, and systemd-oomd would get
ENODEV trying to iterate the cgroup a final time to ensure it was empty.
systemd-oomd sees this as an error and immediately picks a new candidate even
though pressure may have recovered. To counter this, check and handle
path unavailability errnos specially.

Fixes: #22030
3 years agoshared/specifier: treat NULL the same as ""
Zbigniew Jędrzejewski-Szmek [Thu, 20 Jan 2022 14:47:22 +0000 (15:47 +0100)] 
shared/specifier: treat NULL the same as ""

We would busily allocate an empty string to concatenate all of it's
zero characters to the output. Let's make things a bit simpler by letting
the specifier functions return NULL to mean "nothing to append".

3 years agoresolve: reduce attempts of reading link file 22199/head
Yu Watanabe [Thu, 20 Jan 2022 20:22:33 +0000 (05:22 +0900)] 
resolve: reduce attempts of reading link file

The function `link_relevant()` is called repeatedly in `link_allocate_scopes()`.
Let's not read networkd's link file in `link_relevant()`.

Closes #22190.

3 years agowait-online: use network_link_get_operational_state()
Yu Watanabe [Thu, 20 Jan 2022 21:15:31 +0000 (06:15 +0900)] 
wait-online: use network_link_get_operational_state()

3 years agonetwork-util: introduce network_link_get_operational_state()
Yu Watanabe [Thu, 20 Jan 2022 20:45:09 +0000 (05:45 +0900)] 
network-util: introduce network_link_get_operational_state()

3 years agoresolve: use FLAGS_SET() macro
Yu Watanabe [Thu, 20 Jan 2022 20:07:28 +0000 (05:07 +0900)] 
resolve: use FLAGS_SET() macro

3 years agoresolve: use netif_has_carrier()
Yu Watanabe [Thu, 20 Jan 2022 20:05:04 +0000 (05:05 +0900)] 
resolve: use netif_has_carrier()

3 years agonetif-util: introduce netif_has_carrier()
Yu Watanabe [Thu, 20 Jan 2022 20:02:42 +0000 (05:02 +0900)] 
netif-util: introduce netif_has_carrier()

3 years agoresolve: drop redundant call of link_allocate_scopes() and link_add_rrs()
Yu Watanabe [Thu, 20 Jan 2022 19:46:14 +0000 (04:46 +0900)] 
resolve: drop redundant call of link_allocate_scopes() and link_add_rrs()

In `manager_process_link()`, the function `link_update()` is called just
after `link_process_rtnl()`, and `link_update()` also calls
`link_allocate_scopes()` and `link_add_rrs()`. Hence, the calls in
`link_process_rtnl()` are redundant.

3 years agoresolve: use log_link_warning_errno() or freinds more
Yu Watanabe [Thu, 20 Jan 2022 19:43:37 +0000 (04:43 +0900)] 
resolve: use log_link_warning_errno() or freinds more

3 years agoresolve: add debuging log of interface name change
Yu Watanabe [Thu, 20 Jan 2022 19:32:38 +0000 (04:32 +0900)] 
resolve: add debuging log of interface name change

3 years agotests: make fuzz-journal-remote less flaky
Evgeny Vereshchagin [Thu, 20 Jan 2022 13:41:56 +0000 (13:41 +0000)] 
tests: make fuzz-journal-remote less flaky

by always calling journal_remote_server_destroy, which resets global
variables like journal_remote_server_global. It should prevent crashes like
```
Assertion 'journal_remote_server_global == NULL' failed at src/journal-remote/journal-remote.c:312, function int journal_remote_server_init(RemoteServer *, const char *, JournalWriteSplitMode, _Bool, _Bool)(). Aborting.
AddressSanitizer:DEADLYSIGNAL
=================================================================
==24769==ERROR: AddressSanitizer: ABRT on unknown address 0x0539000060c1 (pc 0x7f23b4d5818b bp 0x7ffcbc4080c0 sp 0x7ffcbc407e70 T0)
SCARINESS: 10 (signal)
    #0 0x7f23b4d5818b in raise /build/glibc-eX1tMB/glibc-2.31/sysdeps/unix/sysv/linux/raise.c:51:1
    #1 0x7f23b4d37858 in abort /build/glibc-eX1tMB/glibc-2.31/stdlib/abort.c:79:7
    #2 0x7f23b5731809 in log_assert_failed systemd/src/basic/log.c:866:9
```

3 years agoUse ASSERT_PTR() in more places
Zbigniew Jędrzejewski-Szmek [Wed, 19 Jan 2022 17:09:22 +0000 (18:09 +0100)] 
Use ASSERT_PTR() in more places

3 years agoci: switch to fedora-35 on i386 on Packit
Evgeny Vereshchagin [Thu, 20 Jan 2022 08:54:54 +0000 (08:54 +0000)] 
ci: switch to fedora-35 on i386 on Packit

systemd seems to be failing to compile there with gcc-12 but considering
that gcc-12 hasn't been released yet it doesn't seem to make sense
to add workarounds to get it to compile there. Until gcc-12 is
stabilized it should be enough to build systemd on fedora-35 to
make sure it's buildable on i386.

3 years agohwdb: Add accel orientation quirk for the GPD Pocket 3
Thomas Batten [Thu, 20 Jan 2022 08:54:00 +0000 (19:24 +1030)] 
hwdb: Add accel orientation quirk for the GPD Pocket 3

3 years agohwdb: CH Pro Pedals not classified correctly due to no buttons
Tyson Whitehead [Thu, 20 Jan 2022 03:38:21 +0000 (22:38 -0500)] 
hwdb: CH Pro Pedals not classified correctly due to no buttons

3 years agotests: fuzz etc_hosts_parse
Evgeny Vereshchagin [Thu, 20 Jan 2022 05:06:49 +0000 (05:06 +0000)] 
tests: fuzz etc_hosts_parse

That's just a follow-up to https://github.com/systemd/systemd/pull/22179

3 years agoresolve: fix assertion triggered when r == 0
Yu Watanabe [Wed, 19 Jan 2022 20:24:31 +0000 (05:24 +0900)] 
resolve: fix assertion triggered when r == 0

Fixes #22178.

3 years agobus: Use OrderedSet for introspection
Jan Janssen [Wed, 19 Jan 2022 09:15:36 +0000 (10:15 +0100)] 
bus: Use OrderedSet for introspection

Otherwise, the generated xml files are not reproducible.

3 years agoMerge pull request #21865 from yuwata/network-sr-iov
Luca Boccassi [Wed, 19 Jan 2022 22:38:00 +0000 (22:38 +0000)] 
Merge pull request #21865 from yuwata/network-sr-iov

udev/net: support configuring SR-IOV virtual functions through .link file

3 years agoboot: Use -ffile-prefix-map when present
Jan Janssen [Wed, 19 Jan 2022 15:37:25 +0000 (16:37 +0100)] 
boot: Use -ffile-prefix-map when present

This should make sure the stub elf binary is reproducible.

Fixes: #22157
3 years agoMerge pull request #22172 from yuwata/udev-sd-device-more-debugging-logs
Zbigniew Jędrzejewski-Szmek [Wed, 19 Jan 2022 14:11:48 +0000 (15:11 +0100)] 
Merge pull request #22172 from yuwata/udev-sd-device-more-debugging-logs

udev, sd-device: more debugging logs

3 years agotest: replace multiple echo with cat 22172/head
Yu Watanabe [Wed, 19 Jan 2022 10:03:52 +0000 (19:03 +0900)] 
test: replace multiple echo with cat

Suggested by shell check SC2129.

3 years agoudev-util: add event UUID to debugging logs
Yu Watanabe [Wed, 19 Jan 2022 09:20:49 +0000 (18:20 +0900)] 
udev-util: add event UUID to debugging logs

3 years agosd-device: add more debugging logs in device_set_syspath()
Yu Watanabe [Wed, 19 Jan 2022 07:07:26 +0000 (16:07 +0900)] 
sd-device: add more debugging logs in device_set_syspath()

On failure, the function previously sometimes logs in debug level, but
sometimes does not. Let's always log the error cause.

3 years agomeson: skip to search clang, llvm-string, and bpftool, if libbpf not found
Yu Watanabe [Wed, 19 Jan 2022 09:46:09 +0000 (18:46 +0900)] 
meson: skip to search clang, llvm-string, and bpftool, if libbpf not found

Prompted by https://github.com/systemd/systemd/pull/22093#issuecomment-1016254914.

3 years agotest: wait for newly created btrfs triggered
Yu Watanabe [Wed, 19 Jan 2022 06:48:20 +0000 (15:48 +0900)] 
test: wait for newly created btrfs triggered

Fixes the second issue in #21819.

3 years agoMerge pull request #22163 from bluca/extension_images_validation
Zbigniew Jędrzejewski-Szmek [Wed, 19 Jan 2022 07:57:15 +0000 (08:57 +0100)] 
Merge pull request #22163 from bluca/extension_images_validation

Improve ExtensionImages validation

3 years agosysext: use LO_FLAGS_PARTSCAN when opening image
Luca Boccassi [Wed, 19 Jan 2022 00:27:45 +0000 (00:27 +0000)] 
sysext: use LO_FLAGS_PARTSCAN when opening image

Jan 17 12:34:59 myguest1 (sd-sysext)[486]: Device '/var/lib/extensions/myext.raw' is loopback block device with partition scanning turned off, please turn it on.

Fixes https://github.com/systemd/systemd/issues/22146

3 years agotest-network: add testcases for configuring SR-IOV by .link file 21865/head
Yu Watanabe [Sat, 15 Jan 2022 00:26:32 +0000 (09:26 +0900)] 
test-network: add testcases for configuring SR-IOV by .link file