Commit Graph
41847 Commits
Author SHA1 Message Date
Yu Watanabe 56b7f112ed locale-setup: avoid TOCTOU in reading locale.conf 2022-12-14 20:18:58 +09:00
Yu Watanabe 00afa6a38f locale-setup: make failure in stat() critical
The file was created by this function. Hence, the failure is something
critical.
2022-12-14 20:18:58 +09:00
Yu Watanabe 50359113e9 locale-setup: clear partially loaded context on failure 2022-12-14 20:18:58 +09:00
Yu Watanabe 018befcff6 locale-setup: split locale_context_load() into small pieces
No functional change, just refactoring and preparation for later
commits.
2022-12-14 20:18:58 +09:00
Yu Watanabe 7294912f18 localed: avoid TOCTOU in loading config 2022-12-14 20:18:58 +09:00
Yu Watanabe 649512b934 env-file: introduce parse_env_file_fd() 2022-12-14 20:18:58 +09:00
Yu Watanabe dd57a22e6a env-file: several cleanups
- add missing assertions,
- rename function arguments for storing results,
- add typedef for callback.
2022-12-14 20:18:58 +09:00
Yu Watanabe 0ec8777e18 Merge pull request #25726 from dtardon/cleanups
Several small cleanups
2022-12-14 20:17:56 +09:00
Yu Watanabe 863b620a4a resolve: fix NULL-pointer dereference
Fixes a bug introduced by 16a6bc5a7a.
Fixes CID#1501514.
2022-12-14 19:10:19 +09:00
David Tardon 246caacbb4 btrfs-util: shorten a bit 2022-12-14 09:57:35 +01:00
David Tardon 359e8d76e8 machine: propagate error from machine_new 2022-12-14 09:57:35 +01:00
David Tardon 38f514409a machine: use _cleanup_ in machine_new 2022-12-14 09:57:35 +01:00
David Tardon d2b6485385 localed-util: use _cleanup_ harder 2022-12-14 09:57:35 +01:00
David Tardon 6323bd1094 busctl-introspect: use _cleanup_ 2022-12-14 09:56:33 +01:00
Zbigniew Jędrzejewski-Szmek 357f5ccbf6 Merge pull request #25689 from YHNdnzj/systemctl-exit-code
systemctl: make is-* return EXIT_PROGRAM_OR_SERVICES_STATUS_UNKNOWN(4) when no unit file is found
2022-12-14 08:37:16 +01:00
Daan De Meyer 8275334bec repart: Rename --skip-partitions to --defer-partitions
Defer is better because it indicates that we still intend to
populate these partitions later.
2022-12-14 13:20:32 +09:00
Luca Boccassi 71f7cc6a9e Merge pull request #25725 from keszybz/oom-policy-fixup
Add missing integration of OOMPolicy in scope units
2022-12-14 01:38:11 +01:00
Luca Boccassi 856bfaeb05 manager: add option to rate limit daemon-reload
Reloading is a heavy-weight operation, and currently it is not
possible to stop an orchestrator from spamming reload requests.
Add configuration options to allow rate-limiting.
2022-12-13 18:13:10 +00:00
Luca Boccassi 9524c2fd43 manager: log unit/pid of sender when Reload() is called
Reloading is a heavy-weight operation, and currently it is not
possible to figure out who/what requested it, even at debug level
logging.
Check the sender of the D-Bus message and print it out at info level.
2022-12-13 18:13:10 +00:00
Mike Yuan 43e48a4738 systemctl: is-*: return correct code when no unit is found
According to systemctl(1), we should use LSB return code 4
(EXIT_PROGRAM_OR_SERVICES_STATUS_UNKNOWN) when the state
is "no such unit" for is-{active,failed,enabled} verbs.

Fixes #25680
2022-12-14 01:43:25 +08:00
Yu Watanabe ab84b9efb8 Merge pull request #25658 from yuwata/fuzz-etc-hosts
resolve: dedup entries in /etc/hosts
2022-12-14 01:44:12 +09:00
Zbigniew Jędrzejewski-Szmek c5966ab5bf coredump: cescape invalid json data before logging
In both cases, the json string is short, so we can print it, which is useful
for diagnosing invalid data in packages. But we need escape non-printable
characters.

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

I went over the rest of the codebase, and it seems that other calls to
json_parse() don't have this problem.
2022-12-14 01:37:19 +09:00
David Tardon 1dca43db12 ratelimit: drop use of goto 2022-12-13 16:03:37 +01:00
Christian Brauner fefb7a6def nspawn: remove cgroup socket
Signed-off-by: Christian Brauner (Microsoft) <brauner@kernel.org>
2022-12-13 16:03:30 +01:00
Christian Brauner bb1aa18569 nspawn: remove pty socket
Signed-off-by: Christian Brauner (Microsoft) <brauner@kernel.org>
2022-12-13 16:03:30 +01:00
Christian Brauner b07ee9035e nspawn: remove rtnl socket
Signed-off-by: Christian Brauner (Microsoft) <brauner@kernel.org>
2022-12-13 16:03:30 +01:00
David Tardon 229b008635 mountpoint-util: reduce variable scope 2022-12-13 15:47:52 +01:00
Zbigniew Jędrzejewski-Szmek d5a1657d5a core,man: add missing integration of OOMPolicy= in scopes
Fixup for 5fa098357e.
2022-12-13 15:34:46 +01:00
Christian Brauner 5d9d3fcb18 nspawn: s/kmsg_socket_pair/fd_inner_socket_pair/g
Also stop stashing the kmsg fifo fd in the socket. Just retrieve it in
the parent and have the parent hold on to it.

Signed-off-by: Christian Brauner (Microsoft) <brauner@kernel.org>
2022-12-13 15:25:46 +01:00
Christian Brauner af06cd3024 nspawn: s/fd_socket_pair/fd_outer_socket_pair/g
Signed-off-by: Christian Brauner (Microsoft) <brauner@kernel.org>
2022-12-13 15:25:46 +01:00
Christian Brauner 525f4e59db nspawn: remove uid socket
Signed-off-by: Christian Brauner (Microsoft) <brauner@kernel.org>
2022-12-13 15:25:46 +01:00
Christian Brauner 1823d92d7b nspawn: remove uuid socket
Signed-off-by: Christian Brauner (Microsoft) <brauner@kernel.org>
2022-12-13 15:25:45 +01:00
Christian Brauner b1e1d1fa48 nspawn: remove pid socket
Signed-off-by: Christian Brauner (Microsoft) <brauner@kernel.org>
2022-12-13 15:25:45 +01:00
Christian Brauner cc44af4f59 nspawn: s/notify_socket/fd_socket/g
Signed-off-by: Christian Brauner (Microsoft) <brauner@kernel.org>
2022-12-13 15:25:45 +01:00
Zbigniew Jędrzejewski-Szmek 7c76e1812d core/namespace: indentation 2022-12-13 14:39:40 +01:00
Zbigniew Jędrzejewski-Szmek 2053593fcc treewide: drop "RUN_" from "RUN_WITH_UMASK"
RUN_WITH_UMASK was initially conceived for spawning externals progs with the
umask set. But nowadays we use it various syscalls and stuff that doesn't "run"
anything, so the "RUN_" prefix has outlived its usefulness.
2022-12-13 14:39:30 +01:00
Daan De Meyer 661e4251a5 execute: Pass AT_FDCWD instead of -1
Let's enforce that callers pass AT_FDCWD as read_dfd to load_credential()
to avoid an assert() in read_full_file_full() if read_dfd is -1.
2022-12-13 22:00:34 +09:00
Yu Watanabe 16a6bc5a7a resolve: dedup entries in /etc/hosts
This improves the performance of parsing the file and reduces memory pressure.

Running 'fuzz-etc-hosts timeout-strv' with valgrind,

Before:
total heap usage: 321,020 allocs, 321,020 frees, 15,820,387,193 bytes allocated
real    0m23.531s
user    0m21.458s
sys     0m1.961s

After:
total heap usage: 112,408 allocs, 112,408 frees, 7,297,480 bytes allocated
real    0m8.664s
user    0m8.545s
sys     0m0.065s

Hopefully fixes oss-fuzz#47708 (https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=47708).
2022-12-13 20:37:48 +09:00
Yu Watanabe 59dad407a2 resolve: introduce more hash-ops and use them
No functional changes, just refactoring.
2022-12-13 20:37:48 +09:00
Yu Watanabe 232481a0e6 resolve: use dns_name_hash_ops_free
No functional changes, just refactoring.
2022-12-13 20:37:04 +09:00
Yu Watanabe 3deed83ae2 dns-domain: introduce dns_name_hash_ops_free
Preparation for later commits.
2022-12-13 20:32:44 +09:00
Yu Watanabe 4596c83658 in-addr-util: introduce in_addr_data_hash_ops_free and expose its compare and hash functions
Preparation for later commits.
2022-12-13 20:32:44 +09:00
Yu Watanabe 0f17886390 resolve: split manager_etc_hosts_lookup() into small parts
No functional changes, just refactoring.
2022-12-13 20:32:00 +09:00
Yu Watanabe 10b0c81802 resolve: adjust warning 2022-12-13 20:29:16 +09:00
Yu Watanabe 9f1a1f2047 resolve: merge two boolean variables
No functional changes, just refactoring.
2022-12-13 20:29:16 +09:00
Yu Watanabe e4e340990f resolve: introduce cleanup functions for EtcHostsItemBy{Address,Name}
No functional change, just refactoring and preparation for later
commits.
2022-12-13 20:29:16 +09:00
Yu Watanabe bb5c77305e resolve: make etc_hosts_item_by_{address,name}_free() accept NULL 2022-12-13 20:29:12 +09:00
Yu Watanabe 133eedad2b resolve: rename EtcHostsItem -> EtcHostsItemByAddress 2022-12-13 20:26:55 +09:00
Yu Watanabe 0f7bdf3503 resolve: rename etc_hosts_free() -> etc_hosts_clear() 2022-12-13 20:26:55 +09:00
Zbigniew Jędrzejewski-Szmek d70eaf3067 nspawn: realign columns
Follow-up for b9e7f22c2d.
2022-12-13 11:36:11 +01:00