Commit Graph
46327 Commits
Author SHA1 Message Date
Yu Watanabe 698da597e1 varlinkctl: add short comment 2023-11-28 18:28:17 +09:00
Yu Watanabe e521898d83 capability-util: avoid false-positive use-of-uninitialized-value error
fuzzers randomly fail with the following:
```
==172==WARNING: MemorySanitizer: use-of-uninitialized-value
    #0 0x7f41169cb39b in update_argv /work/build/../../src/systemd/src/basic/argv-util.c:96:13
    #1 0x7f41169cb39b in rename_process /work/build/../../src/systemd/src/basic/argv-util.c:210:16
    #2 0x7f4116b6824e in safe_fork_full /work/build/../../src/systemd/src/basic/process-util.c:1516:21
    #3 0x7f4116bffa36 in safe_fork /work/build/../../src/systemd/src/basic/process-util.h:191:16
    #4 0x7f4116bffa36 in parse_timestamp /work/build/../../src/systemd/src/basic/time-util.c:1047:13
    #5 0x4a61e6 in LLVMFuzzerTestOneInput /work/build/../../src/systemd/src/fuzz/fuzz-time-util.c:16:16
    #6 0x4c4a13 in fuzzer::Fuzzer::ExecuteCallback(unsigned char const*, unsigned long) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:611:15
    #7 0x4c41fa in fuzzer::Fuzzer::RunOne(unsigned char const*, unsigned long, bool, fuzzer::InputInfo*, bool, bool*) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:514:3
    #8 0x4c58c9 in fuzzer::Fuzzer::MutateAndTestOne() /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:757:19
    #9 0x4c6595 in fuzzer::Fuzzer::Loop(std::__Fuzzer::vector<fuzzer::SizedFile, std::__Fuzzer::allocator<fuzzer::SizedFile> >&) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:895:5
    #10 0x4b58ff in fuzzer::FuzzerDriver(int*, char***, int (*)(unsigned char const*, unsigned long)) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerDriver.cpp:912:6
    #11 0x4def52 in main /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerMain.cpp:20:10
    #12 0x7f4115ea3082 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x24082) (BuildId: e678fe54a5d2c2092f8e47eb0b33105e380f7340)
    #13 0x41f5ad in _start (build-out/fuzz-time-util+0x41f5ad)

DEDUP_TOKEN: update_argv--rename_process--safe_fork_full
  Uninitialized value was created by an allocation of 'fv' in the stack frame of function 'have_effective_cap'
    #0 0x7f41169d3540 in have_effective_cap /work/build/../../src/systemd/src/basic/capability-util.c:21
```
2023-11-28 10:22:39 +01:00
Zbigniew Jędrzejewski-Szmek 78b95ccad8 test-time-util: suppress timestamp conversion failures for Africa/Khartoum timezone
Our timestamp conversion roundtrip test was failing. But I think that this
is not our bug:

$ TZ='Africa/Khartoum' date --date='@1509482094'
Tue Oct 31 23:34:54 EAT 2017
$ TZ='Africa/Khartoum' date --date='Tue Oct 31 23:34:54 EAT 2017' +%s
1509485694
$ TZ='Africa/Khartoum' date --date='@1509485694'
Tue Oct 31 23:34:54 CAT 2017
$ echo $[1509485694 - 1509482094]
3600

This is essentially the same as what happens in our test. After a round-trip, we
end up one hour ahead.

> For 1509482094632752, from the change log of tzdata:
>
> Release 2017c - 2017-10-20 14:49:34 -0700
>
>  Changes to future timestamps
>    Sudan will switch from +03 to +02 on 2017-11-01.

Fixes https://github.com/systemd/systemd/issues/28472.
2023-11-27 16:22:09 +00:00
Luca Boccassi 04fc5b6047 Merge pull request #30170 from bluca/exec_bpf_fd
core: pass bpf_outer_map_fd to sd-executor only if RestrictFileSystems was set
2023-11-27 15:44:50 +00:00
Frantisek Sumsal 538291b0d8 systemctl: include unit ID in the property map
Otherwise we get a not very nice message when trying to display a
non-existent man page:

~# systemctl cat test.service
[Unit]
Description=Hello
[Service]
ExecStart=true
~# systemctl help test.service
Documentation for (null) not known.
2023-11-25 21:36:10 +01:00
Frantisek Sumsal a986de6899 import: append % to X_IMPORT_PROGRESS=
Since we parse it on the other side via parse_percent() which requires
that, otherwise we get an error:

[    8.133131] testsuite-13.sh[649]: + machinectl import-raw /tmp/container.raw container-raw
[    8.175035] machinectl[1143]: Enqueued transfer job 1. Press C-c to continue download in background.
[    8.182130] machinectl[1143]: Importing '/tmp/container.raw', saving as 'container-raw'.
[    8.182377] systemd-importd[1144]: Got invalid percent value '0', ignoring.
[    8.182451] machinectl[1143]: Imported 0%.
[    8.282669] systemd-importd[1144]: Got invalid percent value '40', ignoring.
[    8.282746] machinectl[1143]: Imported 40%.
[    8.366448] machinectl[1143]: Wrote 64.0M.
[    8.366519] machinectl[1143]: Operation completed successfully.
[    8.366617] machinectl[1143]: Exiting.
2023-11-25 20:42:13 +01:00
Mike Yuan 0cdffada3d nspawn-patch-uid: clarify that changing mode of symlink is unsupported 2023-11-25 19:12:20 +08:00
Mike Yuan 677e644530 Revert "nspawn-patch-uid: try fchmodat2() to restore mode of symlink"
This reverts commit 30462563b1.

fchmodat2(), while accepting AT_SYMLINK_NOFOLLOW as a valid flag,
always returns EOPNOTSUPP when operating on a symlink. The Linux kernel
simply doesn't support changing the mode of a symlink.

Fixes #30157
2023-11-25 19:12:15 +08:00
Paymon MARANDI b99e4922ea ukify: be more explicit about where to find ukify
when KERNEL_INSTALL_UKIFY is not supplied we set ukify to $PWD/ukify

that will fail (perhaps only for manual installations):
FileNotFoundError: [Errno 2] No such file or directory: '/usr/src/linux-6.7-rc1/ukify'

this will make sure we have a sane default for UKIFY

Signed-off-by: Paymon MARANDI <paymon@utubeipod.xyz>
2023-11-25 12:53:29 +09:00
huyubiao c00b446d93 udevadm: exiting udevadm monitor normally under SIGTERM or SIGINT
Under SIGTERM or SIGINT, exit event and release resources, and exit udevadm monitor normally.
2023-11-25 12:53:10 +09:00
Yu Watanabe 33d11a2b69 analyze: return earlier when there is no path to be prepended
Follow-up for 2f6181ad4d.

Addresses the post-merge comment:
https://github.com/systemd/systemd/pull/30172#discussion_r1404209035
2023-11-25 12:52:59 +09:00
Yu Watanabe fd097a79d5 Merge pull request #30188 from YHNdnzj/memory-accounting-followup
core: a few fixes and improvements for memory accounting
2023-11-25 12:52:48 +09:00
Yu Watanabe 2c29813da3 run: escape command for description
The command arguments may contain spurious characters, e.g. line-break.
When we use command arguments as a description of a unit, we should
escape them.

Fixes #30187.
2023-11-25 12:52:35 +09:00
Mike Yuan f17b07f4d7 core/cgroup: use the cached memory accounting value when cgroup is gone
Follow-up for 9824ab1f00

Fixes https://github.com/systemd/systemd/issues/28542#issuecomment-1825413237
2023-11-25 00:38:49 +08:00
Mike Yuan bfb6b1214a bus-print-properties: prettify more unset properties 2023-11-25 00:38:49 +08:00
Mike Yuan 3f362012ce bus-print-properties: ignore CGROUP_LIMIT_MAX for Memory*{Current,Peak}
MemoryCurrent and MemoryAvailable are shown as "[not set]" when UINT64_MAX
(unset). Let's do the same for the newly-added Memory*{Current,Peak} properties.
2023-11-24 23:22:41 +08:00
Mike Yuan 35c08a56a1 core/dbus-unit: don't log cgroup v1 property name 2023-11-24 23:22:40 +08:00
Luca Boccassi 36f4476361 Merge pull request #30172 from yuwata/analyze-verify-unit-path
analyze: do not prepend CWD to SYSTEMD_UNIT_PATH needlessly
2023-11-24 10:35:28 +00:00
Lennart Poettering c7896cecea pcrextend: fix minor memory leak
Also, simplify the code a bit by using json_dispatch_unbase64_iovec().
2023-11-24 12:21:43 +09:00
Yu Watanabe 2bab4caaf9 login: do not clear wall message before shutting down
This fixes a regression caused by 5ed73478e1
and aa6123e85e.

With these commits, when Reboot dbus method or friends is called,
reset_scheduled_shutdown() is called before shutting down the system,
so the wall message was cleared.

As the wall message itself is unrelated to the scheduling of shutting
down systems, let's keep the message.

Fixes #30167.
2023-11-24 11:11:57 +08:00
Yu Watanabe 2f6181ad4d analyze: do not prepend the current working directory to SYSTEMD_UNIT_PATH needlessly
If the requested unit is not in the current working directory, it is not
necessary to include the current working directory in SYSTEMD_UNIT_PATH.

Follow-up for 45519d13a4.

Fixes #30166.
2023-11-24 05:28:14 +09:00
Yu Watanabe ff7af46edb analyze: set SYSTEMD_UNIT_PATH in verify_generate_path()
Then, rename verify_generate_path() -> verify_set_unit_path().
2023-11-24 05:20:13 +09:00
Yu Watanabe c131e8b706 analyze: shorten code a bit
No functional change, just refactoring.
2023-11-24 05:19:14 +09:00
Yu Watanabe 6636145b3e analyze: drop duplicated :
Before, this returns e.g. "/current_dir::",
After, this returns e.g. "/current_dir:".
2023-11-24 04:44:35 +09:00
Luca Boccassi 2d042c75ff core: remove redundant check when serializing FDs
The helpers already skip if the FD is < 0
2023-11-23 19:14:52 +00:00
Luca Boccassi 60ef4baeed core: pass bpf_outer_map_fd to sd-executor only if RestrictFileSystems was set
It causes SELinux denials to be raised, so restrict it only where needed

Follow-up for beb4ae8755
2023-11-23 19:08:38 +00:00
Mike Yuan b7c1f9eaf4 hibernate-resume: actually set HibernateInfo.offset
Follow-up for a628d933cc
2023-11-23 18:15:37 +00:00
Mike Yuan bed6bffc9a analyze: don't open systemd-executor needlessly
Fixes #30162
2023-11-23 20:58:20 +08:00
Mike Yuan 9136de6934 analyze: use FOREACH_ARRAY more 2023-11-23 20:53:46 +08:00
Mike Yuan 57d3a6aaf8 core/manager: open our parent dir with O_PATH 2023-11-23 20:44:32 +08:00
Mike Yuan 9e743e7ea9 core/manager: correct and simplify errno handling
open_parent() is our own function that returns negative errno.
2023-11-23 20:42:44 +08:00
Mike Yuan 5cacac04fa core/manager: rename result parameter to ret 2023-11-23 20:42:43 +08:00
Mike Yuan 0f9267501b exec-util: don't say sd-executor to avoid ambiguity
We have a systemd-executor binary now.
2023-11-23 11:39:07 +00:00
Yu Watanabe 19f0a71ba0 io-util: actually retry on failure
Follow-up for e22c60a9d5.

Fixes #30152.
2023-11-22 20:38:38 +00:00
Christian Hesse 0f1dcf9d79 systemctl: distinguish reload and reexec
This used to log about reload, for reload and reexecution. Let's
distinguish the two cases.
2023-11-22 17:45:04 +00:00
Mike Yuan 0ca66adfcc conf-parser: only read the first found main config file
Follow-up for 93f1da4556
and 8ea288db01

Before the offending commits, we only read the first found
main config file. If the main config file is symlinked to/as
a drop-in, we should break instead of continuing, for it to
be read later.
2023-11-22 17:44:54 +00:00
Lennart Poettering 40e1100283 recurse-dir: correct comment
The RECURSE_DIR_ENSURE_TYPE flag is actually interpreted by
readdir_all() already, hence rearrange comments to say so.
2023-11-22 17:44:29 +00:00
Luca Boccassi 61c232dc8b Merge pull request #30145 from poettering/reset-terminal-line-editing
make terminal line editing work with systemd-firstboot
2023-11-22 17:43:51 +00:00
Luca Boccassi 7d4b61d287 Merge pull request #30149 from yuwata/setlocale
locale-util: do not call setlocale() when multi-threaded
2023-11-22 17:43:39 +00:00
Luca Boccassi c1fd45d067 Merge pull request #30143 from poettering/machine-credential-fixes
machine credential fixes
2023-11-22 17:43:14 +00:00
Luca Boccassi 31897753fb Merge pull request #30024 from keszybz/one-doc-thingy
Serialize units ratelimits and document StartLimitIntervalSec=infinity
2023-11-22 17:42:51 +00:00
Lennart Poettering 9b85e90780 fs-util: add comment explaining what xopenat() is for 2023-11-23 02:29:37 +09:00
Yu Watanabe d54a45ad5f locale-util: drop unused init_gettext()
The function has not been used since 96d9117ad2.
2023-11-23 00:50:46 +09:00
Yu Watanabe ca13432d60 locale-util: do not call setlocale() when multi-threaded
Fixes #30141.
2023-11-23 00:50:42 +09:00
Lennart Poettering 2105f79ed3 machine-credential: tweak --load-credential= use a bit
Let's try to recognize paths (i.e. those with a "/") as source for
credentials to load, and then read them from the file system. Also, only read
credentials from an inbound credentials directory if the source
qualifies as valid credential name.

Otherwise print a nice error.
2023-11-22 15:17:18 +01:00
Lennart Poettering 1311946233 machine-credential: simplify code a bit 2023-11-22 15:17:18 +01:00
Lennart Poettering 437f3e156d machine-credential: use word 'Credential' rather than 'MachineCredential'
Probably some search/replace mistake.
2023-11-22 15:17:18 +01:00
Lennart Poettering d66c4d101e machine-credential: fix GREEDY_REALLOC error handling
We must check the return value of GREEDY_REALLOC for OOM, and the
pointer are updated already on success, hence it's a bad idea to make a
copy of the pointer beforehand.
2023-11-22 15:17:18 +01:00
Lennart Poettering 6045958bab machine-credential: fix error logging
Remove duplicate logging: let exclusively
machine_credential_load()/machine_credential_set() log, and not the
caller again.
2023-11-22 15:16:32 +01:00
Yu Watanabe 3197d778e0 journal: sync immediately on shutting down journald
Otherwise, sd_event_add_time_relative() or sd_event_source_set_time_relative()
below will trigger assert_return().

Prompted by #30029.
2023-11-22 14:07:19 +00:00