]> git.ipfire.org Git - thirdparty/systemd.git/log
thirdparty/systemd.git
3 years agoMerge pull request #18181 from poettering/sysext
Lennart Poettering [Tue, 19 Jan 2021 15:02:58 +0000 (16:02 +0100)] 
Merge pull request #18181 from poettering/sysext

systemd-sysext as a method of merging simple OS extensions into /usr and /opt

3 years agoMerge pull request #18129 from keszybz/envvars
Lennart Poettering [Tue, 19 Jan 2021 15:02:27 +0000 (16:02 +0100)] 
Merge pull request #18129 from keszybz/envvars

Allow control characters in environment variable values

3 years agohomed: fix build without p11kit
Florian Westphal [Tue, 19 Jan 2021 08:25:15 +0000 (09:25 +0100)] 
homed: fix build without p11kit

homectl-pkcs11.c: In function 'identity_add_pkcs11_key_data':
homectl-pkcs11.c:155:13: error: implicit declaration of function 'pkcs11_acquire_certificate' [-Werror=implicit-function-declaration]

Restores the P11KIT compile-time test that was removed in 2289a78473282902db1108168df6414ae7d91b2f
("homed: move pkcs11 LUKS glue into shared code").

3 years agosystemctl: warn when importing environment variables with control characters 18129/head
Zbigniew Jędrzejewski-Szmek [Tue, 19 Jan 2021 13:20:16 +0000 (14:20 +0100)] 
systemctl: warn when importing environment variables with control characters

I don't think it is useful to warn about about environemnt variables where the user
explicitly configured some value. If they went through the effort of escaping the cc
to include it in the setting (e.g. Environment="VAR=\efoo"), and we pass this through,
there isn't anything to warn about. This also applies to 'systemctl set-environment',
where the variable name and value are passed as arguments.

The only case where the warning *might* be useful is where the user might be
surprised by the value. This occurs when importing variables from the inherited
environment, i.e. in 'systemctl import-environment'. In not convinced that this is
useful, since the user better control their shell environment anyway.

$ systemctl import-environment
Calling import-environment without a list of variable names is deprecated.
Environment variable $LESS_TERMCAP_mb contains control characters, importing anyway.
Environment variable $LESS_TERMCAP_md contains control characters, importing anyway.
Environment variable $LESS_TERMCAP_me contains control characters, importing anyway.
Environment variable $LESS_TERMCAP_se contains control characters, importing anyway.
Environment variable $LESS_TERMCAP_so contains control characters, importing anyway.
Environment variable $LESS_TERMCAP_ue contains control characters, importing anyway.
Environment variable $LESS_TERMCAP_us contains control characters, importing anyway.
Environment variable $ZZZ contains control characters, importing anyway.

3 years agoAllow control characters in environment variable values
Zbigniew Jędrzejewski-Szmek [Sun, 3 Jan 2021 21:26:52 +0000 (22:26 +0100)] 
Allow control characters in environment variable values

So far, we would allow certain control characters (NL since
b4346b9a77bc6129dd3e, TAB since 6294aa76d818e831de45), but not others. Having
other control characters in environment variable *value* is expected and widely
used, for various prompts like $LESS, $LESS_TERMCAP_*, and other similar
variables. The typical environment exported by bash already contains a dozen or
so such variables, so programs need to handle them.

We handle then correctly too, for example in 'systemctl show-environment',
since 804ee07c1370d49aa9a. But we would still disallow setting such variables
by the user, in unit file Environment= and in set-environment/import-environment
operations. This is unexpected and confusing and doesn't help with anything
because such variables are present in the environment through other means.

When printing such variables, 'show-environment' escapes all special
characters, so variables with control characters are plainly visible.
In other uses, e.g. 'cat -v' can be used in similar fashion. This would already
need to be done to suppress color codes starting with \[.

Note that we still forbid invalid utf-8 with this patch. (Control characters
are valid, since they are valid 7-bit ascii.) I'm not sure if we should do
that, but since people haven't been actually asking for invalid utf-8, and only
for control characters, and invalid utf-8 causes other issues, I think it's OK
to leave this unchanged.

Fixes #4446, https://gitlab.gnome.org/GNOME/gnome-session/-/issues/45.

3 years agosystemctl: print a warning when trying to import a nonexistent variable
Zbigniew Jędrzejewski-Szmek [Sun, 3 Jan 2021 20:53:38 +0000 (21:53 +0100)] 
systemctl: print a warning when trying to import a nonexistent variable

I was quite confused what is happening:
$ XXX=xxx
$ systemctl --user import-environment XXX
$ systemctl --user show-environment | grep XXX
(nothing)

Obviously, 'export XXX' was missing. Without any indication why the
export is not happening, this can be hard to figure out.

Another option would be to error out. But so far we didn't, and doing
that could break some script which optimistically tries to export some
variables, if present.

3 years agosysext: install in /usr/lib/systemd/ for now 18181/head
Luca Boccassi [Mon, 18 Jan 2021 16:07:12 +0000 (16:07 +0000)] 
sysext: install in /usr/lib/systemd/ for now

This is a brand new binary, and the CI packaging doesn't pick it up,
causing the upstream testrun to fail (sysext is pulled in by the unit).

3 years agomeson: bindir is the default install_dir, no need to mention it
Lennart Poettering [Mon, 18 Jan 2021 20:17:04 +0000 (21:17 +0100)] 
meson: bindir is the default install_dir, no need to mention it

3 years agotest: improve a log message while building test images
Lennart Poettering [Mon, 18 Jan 2021 20:16:14 +0000 (21:16 +0100)] 
test: improve a log message while building test images

3 years agoupdate TODO
Lennart Poettering [Tue, 12 Jan 2021 15:54:27 +0000 (16:54 +0100)] 
update TODO

3 years agoman: mention SYSEXT_LEVEL in os-release(5)
Luca Boccassi [Tue, 12 Jan 2021 19:30:49 +0000 (19:30 +0000)] 
man: mention SYSEXT_LEVEL in os-release(5)

3 years agosysext: use parse_extension_release and reject extension if not found
Luca Boccassi [Mon, 11 Jan 2021 23:00:58 +0000 (23:00 +0000)] 
sysext: use parse_extension_release and reject extension if not found

3 years agoos-release: add support for /usr/lib/extension-release.d/
Luca Boccassi [Sun, 10 Jan 2021 22:54:15 +0000 (22:54 +0000)] 
os-release: add support for /usr/lib/extension-release.d/

Add helpers to look for extension-release.$NAME files in
/usr/lib/extension-release.d/ following the same pattern as os-release.

3 years agosysext: add verity boilerplate
Luca Boccassi [Sun, 10 Jan 2021 13:34:56 +0000 (13:34 +0000)] 
sysext: add verity boilerplate

3 years agomachine-image: properly support searching for images below some --root= path
Lennart Poettering [Tue, 12 Jan 2021 16:18:53 +0000 (17:18 +0100)] 
machine-image: properly support searching for images below some --root= path

systemd-sysext supports --root= for everything but the image discovery.
Fix that.

3 years agoman: add man page for systemd-sysext
Lennart Poettering [Tue, 12 Jan 2021 13:55:11 +0000 (14:55 +0100)] 
man: add man page for systemd-sysext

3 years agounits: add systemd-sysext.service unit for auto-activating extensions at boot
Lennart Poettering [Sat, 9 Jan 2021 21:24:55 +0000 (22:24 +0100)] 
units: add systemd-sysext.service unit for auto-activating extensions at boot

We'll leave this as opt-in (i.e. a unit that must be enabled
explicitly), since this is supposed to be a debug/developer feature
primarily, and thus no be around in regular production systems.

3 years agosysext: new tool for managing "system extensions" for /usr/ + /opt/
Lennart Poettering [Fri, 8 Jan 2021 15:57:27 +0000 (16:57 +0100)] 
sysext: new tool for managing "system extensions" for /usr/ + /opt/

3 years agoMerge pull request #18294 from ssahani/net-2
Yu Watanabe [Tue, 19 Jan 2021 07:46:41 +0000 (16:46 +0900)] 
Merge pull request #18294 from ssahani/net-2

tree wide use ensure_put

3 years agoMerge pull request #18300 from yuwata/analyze-verify-18252
Zbigniew Jędrzejewski-Szmek [Tue, 19 Jan 2021 07:41:15 +0000 (08:41 +0100)] 
Merge pull request #18300 from yuwata/analyze-verify-18252

analyze: resolve executable path if it is relative

3 years agoudev: Use TAKE_PTR 18294/head
Susant Sahani [Mon, 18 Jan 2021 20:28:16 +0000 (21:28 +0100)] 
udev: Use TAKE_PTR

3 years agoudev-rules: Use ordered_hashmap_ensure_put
Susant Sahani [Mon, 18 Jan 2021 20:27:25 +0000 (21:27 +0100)] 
udev-rules: Use ordered_hashmap_ensure_put

3 years agosysusers: use ordered_hashmap_ensure_put
Susant Sahani [Tue, 19 Jan 2021 04:56:25 +0000 (05:56 +0100)] 
sysusers: use ordered_hashmap_ensure_put

3 years agoMerge pull request #18303 from yuwata/verity-cleanup
Yu Watanabe [Tue, 19 Jan 2021 03:22:55 +0000 (12:22 +0900)] 
Merge pull request #18303 from yuwata/verity-cleanup

veritysetup-generator: drop unused struct and variable

3 years agoMerge pull request #18038 from yuwata/meson-split
Yu Watanabe [Tue, 19 Jan 2021 03:22:34 +0000 (12:22 +0900)] 
Merge pull request #18038 from yuwata/meson-split

meson: various cleanups

3 years agoMerge pull request #18267 from lucaswerkmeister/truncate
Yu Watanabe [Mon, 18 Jan 2021 23:47:39 +0000 (08:47 +0900)] 
Merge pull request #18267 from lucaswerkmeister/truncate

Two StandardOutput=truncate:file improvements

3 years agoMerge pull request #18299 from ssahani/ensure-put
Yu Watanabe [Mon, 18 Jan 2021 23:42:26 +0000 (08:42 +0900)] 
Merge pull request #18299 from ssahani/ensure-put

More use of hashmap_ensure_put and ordered_hashmap_ensure_put

3 years agoTODO: fix typo 18303/head
Yu Watanabe [Mon, 18 Jan 2021 22:22:48 +0000 (07:22 +0900)] 
TODO: fix typo

3 years agoveritysetup-generator: drop unused struct and variable
Yu Watanabe [Mon, 18 Jan 2021 22:18:45 +0000 (07:18 +0900)] 
veritysetup-generator: drop unused struct and variable

Follow-ups for 08b04ec7e72b7327b4803809732b1b8fce8dd069.

This also drops unnecessary inclusion.

Fixes CID#1443889.

3 years agomeson: move several definitions related libsystemd to src/libsystemd/meson.build 18038/head
Yu Watanabe [Tue, 5 Jan 2021 06:03:39 +0000 (15:03 +0900)] 
meson: move several definitions related libsystemd to src/libsystemd/meson.build

3 years agomeson: use static_libsystemd_pic
Yu Watanabe [Tue, 5 Jan 2021 05:51:17 +0000 (14:51 +0900)] 
meson: use static_libsystemd_pic

3 years agomeson: add missing license header
Yu Watanabe [Tue, 5 Jan 2021 03:55:10 +0000 (12:55 +0900)] 
meson: add missing license header

3 years agomeson: move test or fuzzer definitions to relevant meson.build in subdirectories
Yu Watanabe [Mon, 4 Jan 2021 15:08:42 +0000 (00:08 +0900)] 
meson: move test or fuzzer definitions to relevant meson.build in subdirectories

3 years agomeson: drop unused variable
Yu Watanabe [Mon, 4 Jan 2021 14:57:52 +0000 (23:57 +0900)] 
meson: drop unused variable

3 years agomeson: drop unnecessary files from test definitions
Yu Watanabe [Mon, 4 Jan 2021 14:54:46 +0000 (23:54 +0900)] 
meson: drop unnecessary files from test definitions

3 years agomeson: drop unnecessary libraries from journal related tests
Yu Watanabe [Mon, 4 Jan 2021 14:48:10 +0000 (23:48 +0900)] 
meson: drop unnecessary libraries from journal related tests

3 years agomeson: slightly disentangle code dependencies
Yu Watanabe [Mon, 4 Jan 2021 14:36:00 +0000 (23:36 +0900)] 
meson: slightly disentangle code dependencies

But, still sd-id128 is used in src/basic.

3 years agomeson: sort inclusion of meson.build files in subdirectories
Yu Watanabe [Mon, 4 Jan 2021 12:27:00 +0000 (21:27 +0900)] 
meson: sort inclusion of meson.build files in subdirectories

3 years agomeson: move libjournal_core definition to src/journal/meson.build
Yu Watanabe [Mon, 4 Jan 2021 12:16:15 +0000 (21:16 +0900)] 
meson: move libjournal_core definition to src/journal/meson.build

3 years agomeson: move libudev related definitions to src/libudev/meson.build
Yu Watanabe [Mon, 4 Jan 2021 12:13:30 +0000 (21:13 +0900)] 
meson: move libudev related definitions to src/libudev/meson.build

Also, this makes libudev.so built in build directory.

3 years agomeson: move and gather find_program()
Yu Watanabe [Mon, 4 Jan 2021 11:47:00 +0000 (20:47 +0900)] 
meson: move and gather find_program()

3 years agomeson: drop redundant source files in executable()
Yu Watanabe [Mon, 4 Jan 2021 11:43:44 +0000 (20:43 +0900)] 
meson: drop redundant source files in executable()

3 years agomeson: move source file list for systemd-xdg-autostart-generator and its tests
Yu Watanabe [Mon, 4 Jan 2021 11:41:37 +0000 (20:41 +0900)] 
meson: move source file list for systemd-xdg-autostart-generator and its tests

3 years agomeson: move source file list for busctl
Yu Watanabe [Mon, 4 Jan 2021 11:35:33 +0000 (20:35 +0900)] 
meson: move source file list for busctl

3 years agomeson: move source file list for systemd-cryptenroll
Yu Watanabe [Mon, 4 Jan 2021 11:29:01 +0000 (20:29 +0900)] 
meson: move source file list for systemd-cryptenroll

3 years agomeson: move source file list for systemd-cryptsetup
Yu Watanabe [Mon, 4 Jan 2021 11:26:20 +0000 (20:26 +0900)] 
meson: move source file list for systemd-cryptsetup

3 years agomeson: show standalone-binaries setting in the summary
Yu Watanabe [Mon, 4 Jan 2021 11:21:48 +0000 (20:21 +0900)] 
meson: show standalone-binaries setting in the summary

3 years agomeson: use condition argument in test definition
Yu Watanabe [Mon, 4 Jan 2021 11:20:03 +0000 (20:20 +0900)] 
meson: use condition argument in test definition

3 years agomeson: drop redundant directory specification in additional source files
Yu Watanabe [Mon, 4 Jan 2021 11:17:22 +0000 (20:17 +0900)] 
meson: drop redundant directory specification in additional source files

3 years agomeson: move definition of systemctl source files
Yu Watanabe [Mon, 4 Jan 2021 11:12:28 +0000 (20:12 +0900)] 
meson: move definition of systemctl source files

3 years agomeson: introduce libtimesyncd_core library
Yu Watanabe [Mon, 4 Jan 2021 11:09:06 +0000 (20:09 +0900)] 
meson: introduce libtimesyncd_core library

3 years agomeson: enable several tests even if the relevant features are disabled
Yu Watanabe [Mon, 4 Jan 2021 11:00:10 +0000 (20:00 +0900)] 
meson: enable several tests even if the relevant features are disabled

3 years agomeson: fix indentation
Yu Watanabe [Mon, 4 Jan 2021 08:34:01 +0000 (17:34 +0900)] 
meson: fix indentation

3 years agomeson: drop unnecessary variable declarations
Yu Watanabe [Mon, 4 Jan 2021 08:33:47 +0000 (17:33 +0900)] 
meson: drop unnecessary variable declarations

3 years agomeson: drop unnecessary loop
Yu Watanabe [Mon, 4 Jan 2021 08:30:12 +0000 (17:30 +0900)] 
meson: drop unnecessary loop

3 years agotest: drop bus-util.h from sd-bus
Yu Watanabe [Thu, 31 Dec 2020 23:57:37 +0000 (08:57 +0900)] 
test: drop bus-util.h from sd-bus

To drop src/shared from include directories to build libsystemd.so later.

3 years agoefi: create symbolic link to efi/loader-feature.h
Yu Watanabe [Thu, 31 Dec 2020 23:55:21 +0000 (08:55 +0900)] 
efi: create symbolic link to efi/loader-feature.h

To drop src/boot/efi from include directories for binaries later.

3 years agoutil: move several DNS related definitions to src/basic/dns-def.h
Yu Watanabe [Thu, 31 Dec 2020 23:52:52 +0000 (08:52 +0900)] 
util: move several DNS related definitions to src/basic/dns-def.h

DNS_HOSTNAME_MAX is used by sd-resolve, but it was defined in
src/shared/dns-domain.h. The library libsystemd should be independent
of source files under src/shared.

3 years agoutil: move unit-file.[ch] to src/basic
Yu Watanabe [Thu, 31 Dec 2020 23:48:52 +0000 (08:48 +0900)] 
util: move unit-file.[ch] to src/basic

As basic/path-lookup.[ch] depend on them.

3 years agoutil: move parse_syscall_and_errno() to seccomp-util.c
Yu Watanabe [Thu, 31 Dec 2020 23:46:06 +0000 (08:46 +0900)] 
util: move parse_syscall_and_errno() to seccomp-util.c

This makes parse-util.c independent of seccomp-util.c, which is located
in src/shared.

3 years agofuzzers: move several fuzzers
Yu Watanabe [Thu, 31 Dec 2020 22:28:58 +0000 (07:28 +0900)] 
fuzzers: move several fuzzers

3 years agomeson: fix indentation
Yu Watanabe [Thu, 31 Dec 2020 21:46:05 +0000 (06:46 +0900)] 
meson: fix indentation

3 years agomeson: make the second and third elements of tests or fuzzers optional
Yu Watanabe [Thu, 31 Dec 2020 21:29:03 +0000 (06:29 +0900)] 
meson: make the second and third elements of tests or fuzzers optional

Then, we can shorten many test definitions.

3 years agotest: move test-umount.c to src/shutdown
Yu Watanabe [Thu, 31 Dec 2020 20:39:55 +0000 (05:39 +0900)] 
test: move test-umount.c to src/shutdown

Then, we can drop src/shutdown from include directories later.

3 years agocore: move several source files to src/shared
Yu Watanabe [Thu, 31 Dec 2020 20:38:06 +0000 (05:38 +0900)] 
core: move several source files to src/shared

As, the files are used by many executables, fstab-generator, remount-fs,
machine-id-setup, and etc.
With this change, the total size of the relevant executables and
libshared slightly decreases.

Before:
```
$ ll systemd-fstab-generator systemd-remount-fs systemd-machine-id-setup systemd-shutdown systemd-nspawn systemd src/shared/libsystemd-shared-247.so
-rwxrwxr-x 1 watanabe watanabe 7577800 Jan  5 13:35 src/shared/libsystemd-shared-247.so
-rwxrwxr-x 1 watanabe watanabe 4608360 Jan  5 13:35 systemd
-rwxrwxr-x 1 watanabe watanabe  117240 Jan  5 13:35 systemd-fstab-generator
-rwxrwxr-x 1 watanabe watanabe   61576 Jan  5 13:35 systemd-machine-id-setup
-rwxrwxr-x 1 watanabe watanabe  853080 Jan  5 13:35 systemd-nspawn
-rwxrwxr-x 1 watanabe watanabe   70600 Jan  5 13:35 systemd-remount-fs
-rwxrwxr-x 1 watanabe watanabe  172624 Jan  5 13:35 systemd-shutdown
```
Total: 13461280

After:
```
$ ll systemd-fstab-generator systemd-remount-fs systemd-machine-id-setup systemd-shutdown systemd-nspawn systemd src/shared/libsystemd-shared-247.so
-rwxrwxr-x 1 watanabe watanabe 7658336 Jan  5 13:32 src/shared/libsystemd-shared-247.so
-rwxrwxr-x 1 watanabe watanabe 4523560 Jan  5 13:32 systemd
-rwxrwxr-x 1 watanabe watanabe   78288 Jan  5 13:32 systemd-fstab-generator
-rwxrwxr-x 1 watanabe watanabe   30984 Jan  5 13:32 systemd-machine-id-setup
-rwxrwxr-x 1 watanabe watanabe  840384 Jan  5 13:32 systemd-nspawn
-rwxrwxr-x 1 watanabe watanabe   39104 Jan  5 13:32 systemd-remount-fs
-rwxrwxr-x 1 watanabe watanabe  117160 Jan  5 13:32 systemd-shutdown
```
Total: 13287816

3 years agotest: rewrite test-sd-device-thread.c to depend only on libsystemd
Yu Watanabe [Thu, 31 Dec 2020 20:22:23 +0000 (05:22 +0900)] 
test: rewrite test-sd-device-thread.c to depend only on libsystemd

Similarly, this makes test-udev-device-thread.c depend only on libudev.

3 years agotest: move tests for libudev into src/libudev
Yu Watanabe [Thu, 31 Dec 2020 20:17:49 +0000 (05:17 +0900)] 
test: move tests for libudev into src/libudev

3 years agotime-wait-sync: move time-wait-sync.c -> src/timesync/wait-sync.c
Yu Watanabe [Thu, 31 Dec 2020 20:10:09 +0000 (05:10 +0900)] 
time-wait-sync: move time-wait-sync.c -> src/timesync/wait-sync.c

As wait-online is located under src/network.

3 years agoxdg: move tests for xdg-autostart-generator
Yu Watanabe [Thu, 31 Dec 2020 20:02:17 +0000 (05:02 +0900)] 
xdg: move tests for xdg-autostart-generator

Then, we can drop src/xdg-autostart-generator from include directories
later.

3 years agomeson.build: drop unused variable
Yu Watanabe [Thu, 31 Dec 2020 19:56:31 +0000 (04:56 +0900)] 
meson.build: drop unused variable

3 years agotest: move test-systemd-tmpfiles.py from src/test to test
Yu Watanabe [Thu, 31 Dec 2020 19:56:02 +0000 (04:56 +0900)] 
test: move test-systemd-tmpfiles.py from src/test to test

As the other test scripts, e.g. test-sysusers.sh, are located under
test rather than src/test.

3 years agologin: move src/login/logind-acl.[ch] -> src/shared/devnode-acl.[ch]
Yu Watanabe [Thu, 31 Dec 2020 19:48:44 +0000 (04:48 +0900)] 
login: move src/login/logind-acl.[ch] -> src/shared/devnode-acl.[ch]

The files are used by logind and udevd. And the functions in the files
are not specific to logind, and quite general enough to move to
libshared.

3 years agotmpfiles: move offline-passwd.[ch] to src/tmpfiles
Yu Watanabe [Thu, 31 Dec 2020 19:37:10 +0000 (04:37 +0900)] 
tmpfiles: move offline-passwd.[ch] to src/tmpfiles

offline-passwd.[ch] are only used by systemd-tmpfiles and the relevant
test. And are not included in libshared. So, it is not suitable to
located under src/shared.

3 years agosd-journal: move source files for sd-journal to src/libsystemd/sd-journal
Yu Watanabe [Thu, 31 Dec 2020 19:30:47 +0000 (04:30 +0900)] 
sd-journal: move source files for sd-journal to src/libsystemd/sd-journal

3 years agoanalyze: resolve executable path if it is relative 18300/head
Yu Watanabe [Mon, 18 Jan 2021 19:40:26 +0000 (04:40 +0900)] 
analyze: resolve executable path if it is relative

Fixes #18252.

3 years agopath-util: also check absolute path is a directory or not in find_executable()
Yu Watanabe [Mon, 18 Jan 2021 21:33:08 +0000 (06:33 +0900)] 
path-util: also check absolute path is a directory or not in find_executable()

3 years agoMerge pull request #17228 from bluca/bind_path_runtime
Luca Boccassi [Mon, 18 Jan 2021 21:22:57 +0000 (21:22 +0000)] 
Merge pull request #17228 from bluca/bind_path_runtime

core: add systemctl and DBUS method to bind mount new paths without service restart

3 years agoman: document effects of concurrent truncation 18267/head
Lucas Werkmeister [Mon, 18 Jan 2021 20:58:28 +0000 (21:58 +0100)] 
man: document effects of concurrent truncation

Co-authored-by: Lennart Poettering <lennart@poettering.net>
3 years agoimport: use - hashmap_ensure_put 18299/head
Susant Sahani [Mon, 18 Jan 2021 18:15:44 +0000 (19:15 +0100)] 
import: use - hashmap_ensure_put

3 years agocore: execute - use hashmap_ensure_put
Susant Sahani [Mon, 18 Jan 2021 18:13:33 +0000 (19:13 +0100)] 
core: execute - use hashmap_ensure_put

3 years agocore: dbus - use set_ensure_put
Susant Sahani [Mon, 18 Jan 2021 18:10:57 +0000 (19:10 +0100)] 
core: dbus - use set_ensure_put

3 years agonetwork: sd-dhcp6-client - use ordered_hashmap_ensure_put
Susant Sahani [Mon, 18 Jan 2021 17:33:40 +0000 (18:33 +0100)] 
network: sd-dhcp6-client - use ordered_hashmap_ensure_put

3 years agoshare: bus-unit-procs - use hashmap_ensure_put
Susant Sahani [Mon, 18 Jan 2021 17:24:56 +0000 (18:24 +0100)] 
share: bus-unit-procs - use hashmap_ensure_put

3 years agoresolve: link - use hashmap_ensure_put
Susant Sahani [Mon, 18 Jan 2021 18:05:05 +0000 (19:05 +0100)] 
resolve: link - use hashmap_ensure_put

3 years agoremount-fs: Use hashmap_ensure_put
Susant Sahani [Mon, 18 Jan 2021 20:38:46 +0000 (21:38 +0100)] 
remount-fs: Use hashmap_ensure_put

3 years agocore: transaction - use hashmap_ensure_put
Susant Sahani [Mon, 18 Jan 2021 20:52:58 +0000 (21:52 +0100)] 
core: transaction - use hashmap_ensure_put

3 years agoresolved: fix use-after-free with queries hitting the cache
Zbigniew Jędrzejewski-Szmek [Sun, 17 Jan 2021 18:51:28 +0000 (19:51 +0100)] 
resolved: fix use-after-free with queries hitting the cache

When dns_transaction_complete() manages to resolve a query, it invalidates the
query candidate object. It shall not be accessed afterwards.

We have the following chain of calls:
dns_query_candidate_go → dns_transaction_go → dns_transaction_prepare → dns_cache_lookup (success: 1)
                                                                      → dns_transaction_complete
After returning back to dns_query_candidate_go(), we'd attempt to continue
iteration over the list of transactions attached to the query candidate,
accessing already freed (and overwritten) memory:

(gdb) bt
0  0x00007f637297cf47 in hashmap_iterate_entry (i=0x7ffe7e15cc90, h=0x706f746b73656465) at ../src/basic/hashmap.c:703
1  _hashmap_iterate (h=0x706f746b73656465, i=i@entry=0x7ffe7e15cc90, value=value@entry=0x7ffe7e15cc88,
    key=key@entry=0x0) at ../src/basic/hashmap.c:712
2  0x00007f637297d01b in set_iterate (s=<optimized out>, i=i@entry=0x7ffe7e15cc90, value=value@entry=0x7ffe7e15cc88)
    at ../src/basic/hashmap.c:733
hence we crash

3  0x0000557bc99eb80f in dns_query_candidate_go (c=c@entry=0x557bcaf86890) at ../src/resolve/resolved-dns-query.c:139
...but c is not valid here in the second iteration of the loop

4  0x0000557bc99eb720 in dns_query_candidate_notify (c=0x557bcaf86890) at ../src/resolve/resolved-dns-query.c:271
c was valid here at entry...

5  0x0000557bc99efe28 in dns_transaction_complete (t=0x557bcac072f0, state=<optimized out>)
    at ../src/resolve/resolved-dns-transaction.c:350
t is a valid transaction (11481 in the backtrace below)

6  0x0000557bc99f1efb in dns_transaction_process_reply (t=0x557bcac072f0, p=<optimized out>)
    at ../src/resolve/resolved-dns-transaction.c:1171
7  0x0000557bc99f2d41 in on_dns_packet (s=<optimized out>, fd=<optimized out>, revents=<optimized out>,
    userdata=0x557bcac072f0) at ../src/resolve/resolved-dns-transaction.c:1223
8  0x00007f6372a25217 in source_dispatch (s=s@entry=0x557bcb162c50) at ../src/libsystemd/sd-event/sd-event.c:3181
9  0x00007f6372a254fd in sd_event_dispatch (e=0x557bcb15b050) at ../src/libsystemd/sd-event/sd-event.c:3620
10 0x00007f6372a267c8 in sd_event_run (e=e@entry=0x557bcb15b050, timeout=timeout@entry=18446744073709551615)
    at ../src/libsystemd/sd-event/sd-event.c:3678
11 0x00007f6372a269ef in sd_event_loop (e=0x557bcb15b050) at ../src/libsystemd/sd-event/sd-event.c:3700
12 0x0000557bc99ddc14 in run (argc=<optimized out>, argv=<optimized out>) at ../src/resolve/resolved.c:92
13 0x0000557bc99d260a in main (argc=<optimized out>, argv=<optimized out>) at ../src/resolve/resolved.c:99

xxx.name.net systemd-resolved[31705]: Got message type=method_call sender=:1.3644 destination=org.freedesktop.resolve1 path=/org/freedesktop/resolve1 interface=org.freedesktop.resolve1.Manager member=ResolveHostname cookie=2 reply_cookie=0 signature=isit error-name=n/a error-message=n/a
xxx.name.net systemd-resolved[31705]: idn2_lookup_u8: xxx → xxx
xxx.name.net systemd-resolved[31705]: Looking up RR for xxx IN A.
xxx.name.net systemd-resolved[31705]: Sent message type=method_call sender=n/a destination=org.freedesktop.DBus path=/org/freedesktop/DBus interface=org.freedesktop.DBus member=AddMatch cookie=1102 reply_cookie=0 signature=s error-name=n/a error-message=n/a
xxx.name.net systemd-resolved[31705]: Sent message type=method_call sender=n/a destination=org.freedesktop.DBus path=/org/freedesktop/DBus interface=org.freedesktop.DBus member=GetNameOwner cookie=1103 reply_cookie=0 signature=s error-name=n/a error-message=n/a
xxx.name.net systemd-resolved[31705]: Got message type=method_return sender=org.freedesktop.DBus destination=:1.3324 path=n/a interface=n/a member=n/a cookie=4294967295 reply_cookie=1103 signature=s error-name=n/a error-message=n/a
xxx.name.net systemd-resolved[31705]: Cache miss for xxx.name.net IN A
xxx.name.net systemd-resolved[31705]: Transaction 11481 for <xxx.name.net IN A> scope dns on enp42s0/*.
xxx.name.net systemd-resolved[31705]: Using feature level UDP for transaction 11481.
xxx.name.net systemd-resolved[31705]: Using DNS server 192.168.1.1 for transaction 11481.
xxx.name.net systemd-resolved[31705]: Sending query packet with id 11481 of size 35.
xxx.name.net systemd-resolved[31705]: Got message type=method_return sender=org.freedesktop.DBus destination=:1.3324 path=n/a interface=n/a member=n/a cookie=4294967295 reply_cookie=1102 signature= error-name=n/a error-message=n/a
xxx.name.net systemd-resolved[31705]: Match type='signal',sender='org.freedesktop.DBus',path='/org/freedesktop/DBus',interface='org.freedesktop.DBus',member='NameOwnerChanged',arg0=':1.3644' successfully installed.
xxx.name.net systemd-resolved[31705]: Processing incoming packet on transaction 11481 (rcode=NXDOMAIN).
xxx.name.net systemd-resolved[31705]: Not caching negative entry without a SOA record: xxx.name.net IN A
xxx.name.net systemd-resolved[31705]: Transaction 11481 for <xxx.name.net IN A> on scope dns on enp42s0/* now complete with <rcode-failure> from network (unsigned).
xxx.name.net systemd-resolved[31705]: Positive cache hit for xxx.lan IN A
xxx.name.net systemd-resolved[31705]: Transaction 64364 for <xxx.lan IN A> on scope dns on enp42s0/* now complete with <success> from cache (unsigned).
xxx.name.net systemd-resolved[31705]: Sent message type=method_return sender=n/a destination=:1.3644 path=n/a interface=n/a member=n/a cookie=1104 reply_cookie=2 signature=a(iiay)st error-name=n/a error-message=n/a
xxx.name.net systemd-resolved[31705]: Sent message type=method_call sender=n/a destination=org.freedesktop.DBus path=/org/freedesktop/DBus interface=org.freedesktop.DBus member=RemoveMatch cookie=1105 reply_cookie=0 signature=s error-name=n/a error-message=n/a
xxx.name.net systemd-resolved[31705]: Freeing transaction 64364.
xxx.name.net systemd[1]: systemd-resolved.service: Main process exited, code=dumped, status=11/SEGV
xxx.name.net systemd[1]: systemd-resolved.service: Failed with result 'core-dump'.

Fixes #16168, https://bugzilla.redhat.com/show_bug.cgi?id=1895937.

3 years agosysusers: use ordered_hashmap_ensure_put
Susant Sahani [Mon, 18 Jan 2021 20:37:39 +0000 (21:37 +0100)] 
sysusers: use ordered_hashmap_ensure_put

3 years agosd-netlink: use hashmap_ensure_put
Susant Sahani [Mon, 18 Jan 2021 13:05:35 +0000 (14:05 +0100)] 
sd-netlink: use hashmap_ensure_put

3 years agovarlink: use hashmap_ensure_put
Susant Sahani [Mon, 18 Jan 2021 12:17:20 +0000 (13:17 +0100)] 
varlink: use hashmap_ensure_put

3 years agonetwork: wait-online - add a assert
Susant Sahani [Mon, 18 Jan 2021 12:10:18 +0000 (13:10 +0100)] 
network: wait-online - add a assert

3 years agonetwork: wait-online - use hashmap_ensure_put
Susant Sahani [Mon, 18 Jan 2021 12:09:23 +0000 (13:09 +0100)] 
network: wait-online - use hashmap_ensure_put

3 years agonetwork: radv - use hashmap_ensure_put
Susant Sahani [Mon, 18 Jan 2021 20:34:46 +0000 (21:34 +0100)] 
network: radv - use hashmap_ensure_put

3 years agoinstall: use ordered_hashmap_ensure_put
Susant Sahani [Mon, 18 Jan 2021 10:23:38 +0000 (11:23 +0100)] 
install: use ordered_hashmap_ensure_put

3 years agonetwork: Use TAKE_PTR
Susant Sahani [Mon, 18 Jan 2021 20:11:31 +0000 (21:11 +0100)] 
network: Use TAKE_PTR

3 years agonetwork: network -- use ordered_hashmap_ensure_put
Susant Sahani [Mon, 18 Jan 2021 20:11:01 +0000 (21:11 +0100)] 
network: network -- use ordered_hashmap_ensure_put

3 years agonetwork: address - use ordered_hashmap_ensure_put
Susant Sahani [Mon, 18 Jan 2021 20:09:27 +0000 (21:09 +0100)] 
network: address - use ordered_hashmap_ensure_put

3 years agoupdate TODO
Lennart Poettering [Mon, 18 Jan 2021 20:05:32 +0000 (21:05 +0100)] 
update TODO

3 years agonetwork: macsec - use ordered_hashmap_ensure_put
Susant Sahani [Mon, 18 Jan 2021 19:16:50 +0000 (20:16 +0100)] 
network: macsec - use ordered_hashmap_ensure_put

3 years agotest: run strace with -f and copy log out 17228/head
Luca Boccassi [Thu, 14 Jan 2021 22:11:14 +0000 (22:11 +0000)] 
test: run strace with -f and copy log out