summaryrefslogtreecommitdiff
path: root/src
Commit message (Collapse)AuthorAgeFilesLines
* proc-cmdline: filter PID1 arguments when we are running in a containerYu Watanabe2023-03-296-74/+214
| | | | | | | | Otherwise, PID1 arguments e.g. "--deserialize 16" may be parsed unexpectedly by generators. Fixes the issue reported at https://github.com/systemd/systemd/issues/24452#issuecomment-1475004433.
* tree-wide: reset optind to 0 when GNU extensions in optstring are usedYu Watanabe2023-03-2912-0/+40
| | | | | | | | | | Otherwise, if getopt() and friends are used before parse_argv(), then the GNU extensions may be ignored. This should not change any behavior at least now, as we usually use getopt_long() only once per invocation. But in the next commit, getopt_long() will be used for other arrays, hence this change will become necessary.
* condition: use proc_cmdline_strv()Yu Watanabe2023-03-291-12/+5
|
* proc-cmdline: introduce proc_cmdline_strv()Yu Watanabe2023-03-293-20/+40
| | | | | | | | | | | When we are running in a container, we parse the command line of PID1 in proc_cmdline_parse() or friends. Previously, first we merge the command line nulstr as a single string, and then split by using extract_first_word(). That's not only redundant, but also unsafe when the command line argument contain a space. This drops the redundant steps, hence we can safely parse arguments with space.
* proc-cmdline: split commandline earlier in proc_cmdline_parse() and friendYu Watanabe2023-03-291-114/+116
| | | | No functional change, just preparation for later commits.
* Merge pull request #27035 from DaanDeMeyer/ukify-alignDaan De Meyer2023-03-281-10/+24
|\ | | | | ukify: Add workarounds for older stubs
| * ukify: Add workarounds for older stubsDaan De Meyer2023-03-281-4/+24
| | | | | | | | | | | | | | | | | | Older stubs are either not stripped, causing their total size to be unaligned because of an unaligned symbol table at the end, or stripped, causing the raw data pointers and sizes to be unaligned because strip does not follow the PE spec correctly when stripping. Let's add workarounds for both issues, so that we can use ukify with older stubs as well.
| * Revert "ukify: Weaken file alignment assertions"Daan De Meyer2023-03-281-7/+1
| | | | | | | | This reverts commit 23428bb19e49cf510c65e2896f1a7e4b12ca1dbc.
* | test: don't go through all time zones if slow tests are disabledFrantisek Sumsal2023-03-281-0/+10
| | | | | | | | | | | | Let's skip going through all locally available time zones if we're built with slow tests disabled, as that's quite slow, but do at least one test with the UTC zone.
* | Merge pull request #27030 from keszybz/bustctl-show-property-values-in-fullLuca Boccassi2023-03-283-15/+21
|\ \ | | | | | | bustctl: show property values in full
| * | busctl: also assume --full if not writing to terminalZbigniew Jędrzejewski-Szmek2023-03-281-3/+6
| | | | | | | | | | | | If people grep the output, it probably shouldn't be ellipsized.
| * | busctl: use size_t for set sizeZbigniew Jędrzejewski-Szmek2023-03-281-9/+9
| | | | | | | | | | | | Also reduce the scope of variables.
| * | busctl: do not truncate property values when --fullZbigniew Jędrzejewski-Szmek2023-03-281-1/+1
| | |
| * | oomd: add inline comments with param namesZbigniew Jędrzejewski-Szmek2023-03-272-3/+6
| | |
* | | Merge pull request #26941 from bluca/portable_versionLuca Boccassi2023-03-288-49/+209
|\ \ \ | | | | | | | | portable: introduce SYSEXT_ fields to identify sysexts, and include more metadata in log messages via LogExtraFields=
| * | | portablectl: display sysext-specific fieldsLuca Boccassi2023-03-281-9/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The wrong fields were being displayed, if at all. ID and VERSION_ID in sysexts are used for matching, they don't identify the sysext itself. Parse the newly defined fields and display them separately from the compatibility fields. Before: Image: /home/bluca/git/systemd/base.raw Portable Service: n/a Operating System: Debian GNU/Linux 10 (buster) Extension: /home/bluca/git/systemd/app0.raw Extension Scope: n/a Extension Compatibility Level: n/a Portable Service: n/a Portable Prefixes: n/a Operating System: n/a (debian 10) Extension: /home/bluca/git/systemd/app1.raw Extension Scope: n/a Extension Compatibility Level: n/a Portable Service: n/a Portable Prefixes: n/a Operating System: n/a (debian 10) Unit files: app0.service app1.service After: Image: /home/bluca/git/systemd/base.raw Portable Service: n/a Operating System: Debian GNU/Linux 10 (buster) Extension: /home/bluca/git/systemd/app0.raw Extension Scope: n/a Extension Compatibility Level: n/a Extension Compatibility OS: debian Extension Compatibility OS Version: 10 Portable Service: n/a Portable Prefixes: n/a Extension Image: ID: app Version: 0 Extension: /home/bluca/git/systemd/app1.raw Extension Scope: n/a Extension Compatibility Level: n/a Extension Compatibility OS: debian Extension Compatibility OS Version: 10 Portable Service: n/a Portable Prefixes: n/a Extension Image: ID: app Version: 1 Unit files: app0.service app1.service
| * | | portable: add PORTABLE_NAME_AND_VERSION= and other metadata to LogsExtraFields=Luca Boccassi2023-03-281-8/+93
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is useful to identify log messages with metadata from the images they run on. Look for ID/VERSION_ID/IMAGE_ID/IMAGE_VERSION/BUILD_ID, with a SYSEXT_ prefix if we are looking at an extension, and append via LogExtraFields= as respectively PORTABLE_NAME_AND_VERSION= in case of a single image. In case of extensions, append as PORTABLE_ROOT_NAME_AND_VERSION= for the base and one PORTABLE_EXTENSION_AND_VERSION= for each extension. Example with a base and two extensions, with the unit coming from the first extension: [Service] RootImage=/home/bluca/git/systemd/base.raw Environment=PORTABLE=app0.raw BindReadOnlyPaths=/etc/os-release:/run/host/os-release LogExtraFields=PORTABLE=app0.raw Environment=PORTABLE_ROOT=base.raw LogExtraFields=PORTABLE_ROOT=base.raw LogExtraFields=PORTABLE_ROOT_NAME_AND_VERSION=debian_10 ExtensionImages=/home/bluca/git/systemd/app0.raw LogExtraFields=PORTABLE_EXTENSION=app0.raw LogExtraFields=PORTABLE_EXTENSION_NAME_AND_VERSION=app_0 ExtensionImages=/home/bluca/git/systemd/app1.raw LogExtraFields=PORTABLE_EXTENSION=app1.raw LogExtraFields=PORTABLE_EXTENSION_NAME_AND_VERSION=app_1
| * | | portable: include base and extension images in log fieldsLuca Boccassi2023-03-281-4/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When a portable service uses extensions, we use the 'main' image name (the one where the unit was found in) as PORTABLE=. It is useful to also list all the images actually used at runtime, as they might contain libraries and so on. Use PORTABLE_ROOT= for the image/directory that is used as RootImage= or RootDirectory=, and PORTABLE_EXTENSION= for the image/directory that is used as ExtensionImages= or ExtensionDirectories=. Note that these new fields are only added if extensions are used, there's no change for single-DDI portables. Example with a base and two extensions, with the unit coming from the first extension: [Service] RootImage=/home/bluca/git/systemd/base.raw Environment=PORTABLE=app0.raw BindReadOnlyPaths=/etc/os-release:/run/host/os-release LogExtraFields=PORTABLE=app0.raw LogExtraFields=PORTABLE_ROOT=base.raw ExtensionImages=/home/bluca/git/systemd/app0.raw LogExtraFields=PORTABLE_EXTENSION=app0.raw ExtensionImages=/home/bluca/git/systemd/app1.raw LogExtraFields=PORTABLE_EXTENSION=app1.raw
| * | | portable: use parse_env_file_fd to keep FD validLuca Boccassi2023-03-281-10/+5
| | | | | | | | | | | | | | | | | | | | | | | | take_fdopen_unlocked invalidates the FD in the PortableMetadata object, so it cannot be used later. Use parse_env_file_fd instead which is non destructive.
| * | | strv: add helper to find value in key/value pairs from list of keysLuca Boccassi2023-03-283-0/+26
| | | |
| * | | env: add load_env_file_pairs_fd()Luca Boccassi2023-03-284-20/+39
| | |/ | |/|
* | | process-util: introduce get_process_cmdline_strv()Yu Watanabe2023-03-283-3/+68
|/ / | | | | | | | | | | | | | | | | | | | | | | The reason why get_process_cmdline() is so complicated is that we need to escape and quote arguments for building a single result string. That's necessary when we want to log or print the command line. However, when we want to parse the command line, it is not necessary that the result is a single string, but can be strv. This will be used when we parse the command line.
* | cryptenroll: fix a memory leakFrantisek Sumsal2023-03-281-5/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | $ dd if=/dev/zero of=luks.img bs=1M count=64 $ echo 1231dfsd234d | cryptsetup luksFormat luks.img $ build-san/systemd-cryptenroll luks.img SLOT TYPE 0 password ================================================================= ==640364==ERROR: LeakSanitizer: detected memory leaks Direct leak of 64 byte(s) in 1 object(s) allocated from: #0 0x7f43ffeb95b5 in __interceptor_realloc.part.0 (/lib64/libasan.so.8+0xb95b5) #1 0x7f43ff0a4f2f in greedy_realloc ../src/basic/alloc-util.c:70 #2 0x404d9f in list_enrolled ../src/cryptenroll/cryptenroll-list.c:30 #3 0x40f149 in run ../src/cryptenroll/cryptenroll.c:673 #4 0x40f149 in main ../src/cryptenroll/cryptenroll.c:692 #5 0x7f43fd64a50f in __libc_start_call_main (/lib64/libc.so.6+0x2750f) SUMMARY: AddressSanitizer: 64 byte(s) leaked in 1 allocation(s). Aborted (core dumped) Reported in https://github.com/systemd/systemd/pull/27007.
* | Merge pull request #27022 from ↵Yu Watanabe2023-03-284-18/+22
|\ \ | | | | | | | | | | | | yuwata/journal-remote-fix-relative-output-journal-file journal-remote: support relative output journal file again
| * | journal-remote: make specified output file absoluteYu Watanabe2023-03-281-2/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | After f12b399dd6362a03379cb769954ebfb9972236ed, the output path is also used to determine the directory to be vacuumed. And if a filename only path is specified, `writer_new()` fails since the commit. This makes the specified path is always made absolute. This should not change any behavior before the offending commit, as `journal_open()` opens the specified journal file with `AT_FDCWD`. Fixes #27012.
| * | journal-remote: add missing log message for failure in ↵Yu Watanabe2023-03-281-1/+1
| | | | | | | | | | | | journal_remote_get_writer()
| * | journal-remote: make writer_new() return negative errno on failureYu Watanabe2023-03-283-15/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | After f12b399dd6362a03379cb769954ebfb9972236ed, writer_new() may fail with non-OOM error. Let's return the error cause, and logs the failure in the caller side. This also drops logs in journal_remote_get_writer(), adds its caller typically logs the failure.
* | | systemctl: show service status string in other colorLennart Poettering2023-03-281-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | Let's add a dash of colour to separate our own status info from the the status info supplied by the service. (I wanted to make this italics, but apparently popular terminal emulators don't support that, such as xterm)
* | | systemctl: show fd store info in status outputLennart Poettering2023-03-281-0/+8
| | | | | | | | | | | | | | | | | | The fdstore might pin a non-trivial amount of resources. Let's hence display for services that enable it how many entries there are and what the size limit is.
* | | systemctl: dont's how memory limits that aren't available via D-Bus propsLennart Poettering2023-03-281-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When using an old systemctl on a new PID 1 the "startup" memory limit props are not initialized and currently be shown in status output as zero, even though there's code to suppress the output in that case. Alas it doesn't work, because the relevant fields are not marked as "unset"... Fix that. Follow-up for: 53fda560dc2c66502da7ad68db7d79b515a3601a
* | | Merge pull request #26993 from mrc0mmand/TEST-46-tweaksYu Watanabe2023-03-281-22/+16
|\ \ \ | | | | | | | | test: explicitly pull in systemd-userdbd.service
| * | | userdb: rename the destructor to follow our coding styleFrantisek Sumsal2023-03-271-3/+3
| | | |
| * | | userdb: fix a memory leakFrantisek Sumsal2023-03-271-19/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | [ 49.275617] testsuite-46.sh[1862]: ================================================================= [ 49.275870] testsuite-46.sh[1862]: ==1862==ERROR: LeakSanitizer: detected memory leaks [ 49.276039] testsuite-46.sh[1862]: Direct leak of 103 byte(s) in 14 object(s) allocated from: [ 49.276515] testsuite-46.sh[1862]: #0 0x7f4dbc07243b in strdup (/lib64/libasan.so.8+0x7243b) [ 49.276707] testsuite-46.sh[1862]: #1 0x7f4dbb3900d5 in free_and_strdup ../src/basic/string-util.c:952 [ 49.276931] testsuite-46.sh[1862]: #2 0x7f4dbb15c67d in json_dispatch_user_group_name ../src/shared/json.c:4699 [ 49.277134] testsuite-46.sh[1862]: #3 0x7f4dbb16da9b in json_dispatch ../src/shared/json.c:4395 [ 49.277352] testsuite-46.sh[1862]: #4 0x7f4dbb25b28e in userdb_on_query_reply ../src/shared/userdb.c:305 [ 49.277603] testsuite-46.sh[1862]: #5 0x7f4dbb2748b9 in varlink_dispatch_reply ../src/shared/varlink.c:760 [ 49.277766] testsuite-46.sh[1862]: #6 0x7f4dbb2748b9 in varlink_process ../src/shared/varlink.c:951 [ 49.277975] testsuite-46.sh[1862]: #7 0x7f4dbb27a001 in defer_callback ../src/shared/varlink.c:1897 [ 49.278197] testsuite-46.sh[1862]: #8 0x7f4dbb5d57dd in source_dispatch ../src/libsystemd/sd-event/sd-event.c:4191 [ 49.278421] testsuite-46.sh[1862]: #9 0x7f4dbb5d685d in sd_event_dispatch ../src/libsystemd/sd-event/sd-event.c:4780 [ 49.278675] testsuite-46.sh[1862]: #10 0x7f4dbb5d70bf in sd_event_run ../src/libsystemd/sd-event/sd-event.c:4841 [ 49.278873] testsuite-46.sh[1862]: #11 0x7f4dbb257e7c in userdb_process ../src/shared/userdb.c:591 [ 49.279048] testsuite-46.sh[1862]: #12 0x7f4dbb25f78f in membershipdb_iterator_get ../src/shared/userdb.c:1411 [ 49.279280] testsuite-46.sh[1862]: #13 0x7f4dbb23a98c in user_record_show ../src/shared/user-record-show.c:187 [ 49.279504] testsuite-46.sh[1862]: #14 0x404ae3 in show_user ../src/userdb/userdbctl.c:93 [ 49.279710] testsuite-46.sh[1862]: #15 0x40b4f5 in display_user ../src/userdb/userdbctl.c:418 [ 49.279961] testsuite-46.sh[1862]: #16 0x7f4dbb2804d2 in dispatch_verb ../src/shared/verbs.c:110 [ 49.280233] testsuite-46.sh[1862]: #17 0x40dcf3 in run ../src/userdb/userdbctl.c:1327 [ 49.280434] testsuite-46.sh[1862]: #18 0x40dcf3 in main ../src/userdb/userdbctl.c:1330 [ 49.280657] testsuite-46.sh[1862]: #19 0x7f4db9e4a50f in __libc_start_call_main (/lib64/libc.so.6+0x2750f) [ 49.280907] testsuite-46.sh[1862]: SUMMARY: AddressSanitizer: 103 byte(s) leaked in 14 allocation(s).
* | | | Merge pull request #26980 from ldv-alt/udevadm-verifyYu Watanabe2023-03-284-134/+200
|\ \ \ \ | | | | | | | | | | udevadm verify: add more checks
| * | | | udev-rules: fix grammar in diagnostics about lines that have no effectDmitry V. Levin2023-03-271-3/+3
| | | | | | | | | | | | | | | | | | | | Fixes: 25de7aa7b90c ("udev: modernize udev-rules.c")
| * | | | udev-rules: extend the check for conflicting expressionsDmitry V. Levin2023-03-271-5/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Log an error when a rule line contains the following kind of conflicting match expressions: KEY=="foo*", KEY=="bar*"
| * | | | udev-rules: check token delimitersDmitry V. Levin2023-03-271-2/+50
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When udev_rules_parse_file() is called by udevadm verify, issue warnings about the following conditions in udev rules: * the first token in the rule is preceded with a comma * the last token in the rule is followed by a comma * there is no comma between tokens * there is no whitespace between tokens * there is more than a single comma between tokens * there is whitespace between a token and a comma * there is no whitespace after comma
| * | | | udev-rules: move udev_check_rule_line() invocationDmitry V. Levin2023-03-274-8/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Move udev_check_rule_line() invocation from udev_rule_file_get_issues() to udev_rules_parse_file(), invoke udev_check_rule_line() only when udev_rules_parse_file() is called by udevadm verify. Subsequent commits are going to perform more checks invoked from udev_rules_parse_file().
| * | | | udev-rules: move udev_rules_parse_file() after udev_check_rule_line()Dmitry V. Levin2023-03-271-118/+118
| | | | | | | | | | | | | | | | | | | | | | | | | Move udev_rules_parse_file() after udev_check_rule_line() as the former us going to use the latter.
* | | | | env-util: introduce strv_env_assign_many()Yu Watanabe2023-03-283-0/+70
| | | | |
* | | | | ukify: Weaken file alignment assertionsDaan De Meyer2023-03-271-1/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Older versions of the stub are not aligned to the PE file alignment size. If we remove the assertions, the UKI still boots without issues, so let's drop the assertions and print a message about it instead.
* | | | | Merge pull request #27005 from poettering/fd-reopen-symlinkDaan De Meyer2023-03-272-9/+40
|\ \ \ \ \ | | | | | | | | | | | | fd_reopen() symlink handling tweaks
| * | | | | test-fd-util: use stat_inode_same() where appropriateLennart Poettering2023-03-271-8/+4
| | | | | |
| * | | | | fd-util: cover some corner cases with fd_reopen() on symlinksLennart Poettering2023-03-272-1/+36
| |/ / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The /proc/self/fd/ interface cannot be used to follow symlinks pinned via O_PATH. Add a comment + test for that. Moreover, using fd_reopen() with O_NOFOLLOW cannot work. Add an explicit check and test for that, to make behaviour uniform.
* | | | | Merge pull request #26902 from YHNdnzj/restart-sec-stepDaan De Meyer2023-03-275-4/+70
|\ \ \ \ \ | |_|_|/ / |/| | | | core: add RestartSteps= and RestartSecMax= to dynamically increase interval between auto restarts
| * | | | core/dbus-service: add RestartUSecCurrent propertyMike Yuan2023-03-271-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | This new property shows how much time we actually waits before restarting.
| * | | | core: add RestartSteps= and RestartSecMax= for exponentially increasingMike Yuan2023-03-275-4/+68
| |/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | interval between restarts RestartSteps= accepts a positive integer as the number of steps to take to increase the interval between auto-restarts from RestartSec= to RestartSecMax=, or 0 to disable it. Closes #6129
* | | | locale: Add missing libxkbcommon dependency to testsDaan De Meyer2023-03-271-0/+1
| | | | | | | | | | | | | | | | Fixes opensuse mkosi CI build
* | | | Merge pull request #26932 from dtardon/journal-vacuumLennart Poettering2023-03-271-29/+35
|\ \ \ \ | |/ / / |/| | | Count size of all journal files when vacuuming
| * | | journal-vacuum: use CLEANUP_ARRAYDavid Tardon2023-03-231-21/+20
| | | |