1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2025-03-14 16:58:22 +03:00

41769 Commits

Author SHA1 Message Date
Jan Janssen
ec96dad2f4 boot: Ensure raise() is not dropped by LTO 2023-02-12 22:23:22 +01:00
ml
7b03b44ed9 nspawn: fix directory in logged error 2023-02-12 00:22:52 +01:00
Lennart Poettering
c12a0d6dcf dissect-image: unknown/unsupported diskseq is indicated by 0, not by UINT64_MAX
At almost all places if diskseq is not supported we encode this as
diskseq zero. But in two places we got the check for that wrong,
assuming it was UINT64_MAX.

Fix that.
2023-02-10 18:03:21 +01:00
Lennart Poettering
32d6707dd1 core: when isolating to a unit, also keep units running that are triggered by units we keep running
Inspired by: #26364

(this might even "fix" #26364, but without debug logs it's hard to make
such claims)

Fixes: #23055
2023-02-10 16:09:35 +00:00
Samuel Cabrero
edd5ec2373 userdb: Use json_dispatch_user_group_name() to parse GetMembership fields
It allows to relax the checks and allow characters like '\', used by
windows to split the domain name and user name.

For reference, discussion in the systemd-devel mailing list:
https://lists.freedesktop.org/archives/systemd-devel/2023-February/048804.html

Signed-off-by: Samuel Cabrero <scabrero@suse.de>
2023-02-10 15:09:45 +00:00
Yu Watanabe
645063d1bb cryptenroll: drop deadcode
Follow-up for b0fc23fae51d244d2c33d70c10003aa5d5840223.

After the commit, 'signature_path' is now always non-NULL, hence the
condition can be dropped.

Fixes CID#1504492.
2023-02-10 10:45:19 +00:00
Jan Janssen
5983306474 boot: Fix undefined reference to raise() on arm
This is just a workaround. Once we drop gnu-efi, the arm build system
for EFI binaries should be changed to use the arm-none-eabi toolchain,
which should not exhibit this behavior.
2023-02-09 21:55:40 +00:00
Zbigniew Jędrzejewski-Szmek
0c90efc9db various: boldify version output
Follow-up for 4453ebe4db0511d25bed1040930ea6430c1bed91.
With the feature list all dandified, the most important part of the
output, i.e. the project name and version, are less visible.
2023-02-09 15:32:33 +00:00
Daan De Meyer
77db9ef2ab boot: Make sure we take --root into account everywhere. 2023-02-09 14:46:17 +00:00
Daan De Meyer
3b42ffe590 bootctl: Add missing %m 2023-02-09 11:31:57 +00:00
Yu Watanabe
1c3762937e nss-myhostname: do not return empty result with NSS_STATUS_SUCCESS
Fixes a bug introduced by db50d326a46beca3cc24b6354b6e1b3591902d45.

Fixes RHBZ#2167468 (https://bugzilla.redhat.com/show_bug.cgi?id=2167468).
2023-02-09 06:07:16 +09:00
Yu Watanabe
a3b993ca3f nss-myhostname: fix inverted condition in
Fixes a bug introduced by db50d326a46beca3cc24b6354b6e1b3591902d45.
2023-02-09 05:55:51 +09:00
Lennart Poettering
ece6fc51e6 process-util: add missing error check 2023-02-08 20:15:57 +00:00
Luca Boccassi
777440f110
Merge pull request #26225 from qdeslandes/fix_delegate_cgroup_logs_filtering
Fix delegate cgroup logs filtering
2023-02-08 19:36:21 +00:00
Zbigniew Jędrzejewski-Szmek
667578bb11 ukify: add explanatory message when import fails 2023-02-08 19:35:42 +00:00
Lennart Poettering
834f759c49 journal: modernize sd_journal_get_realtime_usec() a bit
This does what 404803e6caad2de2d8e74caab0b79ec3f030f801 did for the
monotonic timestamp getter, but for the realtime timestamp.

It also also makes the return value optional, exactly as for the
monotonic timestamp logic.
2023-02-08 17:33:23 +00:00
Luca Boccassi
bccad0584e
Merge pull request #26350 from keszybz/reload-messages
Improve messages emitted when Reload or Reexec is requested
2023-02-08 17:05:16 +00:00
Quentin Deslandes
41b7fcc5e8 journald: fix ignored filtering patterns for delegated cgroups
If a service defines Delegate=yes, its subcgroup won't inherit the
LogFilterPatterns= option, because the option is stored on the unit's
cgroup attributes, not on the subcgroup.

Fixed by using the unit's cgroup attributes instead.
2023-02-08 16:52:51 +01:00
Quentin Deslandes
ee164216d3 core: add cg_path_get_unit_path()
From a given cgroup path, cg_path_get_unit() allows to retrieve the
unit's name. Although, this removes the path to the unit's cgroup,
preventing the result to be used to fetch xattrs.

Introduce cg_path_get_unit_path() which provides the path to the unit's
cgroup. This function behave similarly to cg_path_get_unit() (checking
the validity and escaping the unit's name).
2023-02-08 16:48:58 +01:00
Zbigniew Jędrzejewski-Szmek
f031e8b8dd sd-bus: adjust line breaks 2023-02-08 15:48:43 +01:00
Zbigniew Jędrzejewski-Szmek
1980a25dc0 manager: improve message about Reload/Reexec requests
If we fail to get the necessary information, let's just not print that
part of the message. 'n/a' looks pretty ugly.

I used a bunch of ternary operators instead of seperate log lines because
with two components that might or might not be there, we need four different
combinations.

Also, the unit name doesn't need to be quoted, it's always printable.
2023-02-08 15:48:43 +01:00
Zbigniew Jędrzejewski-Szmek
a99bd455b5 manager: "downgrade" message about command vanishing from the unit file
We would print "Current command vanished from the unit file, execution of
the command list won't be resumed." as a warning, but most of the time there
is nothing to resume, because a unit has just one command. So let's detect
the case where the command that was active is the last command in the sequence
and skip the warning.

I was considering how to store the information that the command is last. An
important consideration is not to use a format that would confuse older versions
of systemd. (It wouldn't be a big problem if older systemd just refused the
new serialization, since we require systemd to be newer, but we should avoid
the case where the deserialization is "successful", but actually incorrect.)
Similarly, the deserialization from the old systemd must not confuse new systemd.
For this command, we have a list of arguments at the end, so just adding a
new field either in the middle or at the end is problematic because it's hard
to ensure that we don't mix up the positional and variable arguments.

We actually need to store just one bit of information, so '+' is prefixed on
the index of the last command and used by new systemd to skip the warning.
When deserializing from older systemd, '+' is not present, so we detect all
commands as "not last", and still emit the warning, so we err on the side of
caution. If the user were to deserialize from newer to older systemd, nothing
untoward would happen, because the '+' is ignored. (Users shouldn't do this,
but we know that this occasionally happens with initrds or exitrds and package
downgrades.)
2023-02-08 15:48:43 +01:00
Zbigniew Jędrzejewski-Szmek
8eb491f499 test-parse-util: add tests with explicit plus character
I expected this to work, but our tests did not cover this
explicitly.
2023-02-08 12:01:16 +01:00
Zbigniew Jędrzejewski-Szmek
502096b565 core/service: constify ExecCommand* in two functions 2023-02-08 12:01:16 +01:00
Luca Boccassi
398dc7d39b core: imply DeviceAllow=/dev/tpmrm0 with LoadCredentialEncrypted
If the device access policy is restricted, add implicitly access to the TPM
if at least one encrypted credential needs to be loaded.

Fixes https://github.com/systemd/systemd/issues/26042
2023-02-08 10:59:55 +00:00
Luca Boccassi
b0fc23fae5 cryptenroll: do not implicitly verify with default tpm policy signature
If it was not requested to use a tpm2 signature file when enrolling, do
not fallback to the default /run/systemd/tpm2-pcr-signature.json as it
likely will be unrelated if it exists.

Fixes https://github.com/systemd/systemd/issues/25435
2023-02-08 10:58:57 +00:00
msizanoen1
500cd2e83b unit: always return 1 in log_kill
This ensures that cg_kill_items returns the correct value to let the
manager know that a process was killed.
2023-02-08 11:33:54 +01:00
Zbigniew Jędrzejewski-Szmek
ef9962212a
Merge pull request #26328 from yuwata/udev-worker-set-process-name
udev: set worker process name
2023-02-08 08:57:05 +01:00
Lennart Poettering
9eba03c7b1 journal: minor modernizations 2023-02-07 19:36:47 +00:00
Luca Boccassi
b4cdd8792e
Merge pull request #26337 from poettering/journal-display-ts
logs-show: rename "ts" paramater/variable to "display_ts"
2023-02-07 19:36:27 +00:00
Luca Boccassi
19995b8121
Merge pull request #26336 from poettering/journal-etoomanyrefs
journal: print nicer log message when limit of open journal files during display is hit
2023-02-07 19:35:56 +00:00
Lennart Poettering
4e30b87d94 logs-show: rename "ts" paramater/variable to "display_ts"
When displaying log data we deal with two kind of timestamps: the one we
use for display (typically the source timestamp if available), and the
one we use internally (typically the reception timestamp of journald).

The user-facing output modes generally use the display timestamp, the
ones intended for further processing (i.e. json + export outputs) do
not, and directly query the timestamps of the entry, ignoring the
source. This gets a bit confusing, since it's not always clear why we
use which timestamp where. Let's address that by renaming the generic
"ts" parameter/variable to "display_ts" to emphasize that the stored
timestamp are "corrected" timestamps for display only.

No real code change, just some renaming.
2023-02-07 15:52:22 +01:00
Lennart Poettering
763c46defa journal: print a useful error message if we hit the journal file open limit
See: #20921
2023-02-07 15:12:07 +01:00
Zbigniew Jędrzejewski-Szmek
bbb86efa7c resolve: adjust message for NXDOMAIN lookup result
Previously, we reported:
  nx.example.org: resolve call failed: 'nx.example.org' not found
But the call did succeed, and in fact all communication with the upstream
servers was successful, and we got an authoritative negative answer.
So instead of saying that the call fail, just say that the host doesn't exist:
  nx.example.org: Name 'nx.example.org' not found

I wanted to keep the prefix of "<name>: ", to keep the output uniform. But
it'd look a bit strange to say "<name>: <name> not found", so I added "Name "
to make the output more readable. (Another option would be to not display
the error string received from resolved, but that seems risky: even if right
now resolved uses just one message format, it could start doing something else
in the future, so it's better to display the error as received.)

Fixes #26233.
2023-02-07 14:49:58 +01:00
Zbigniew Jędrzejewski-Szmek
03e80572a7 resolve: define normal macros for BUS_ERROR_DNS error codes
This result is identical after cpp is done, so we don't save anything
by not having the usual macros. And with the usual macros it's easier to
grep and code-crossreferencing works better.
2023-02-07 14:49:58 +01:00
Yu Watanabe
f3f2d02e97 tree-wide: set FORK_RLIMIT_NOFILE_SAFE flag
No functional changes, just refactoring.
2023-02-07 14:39:49 +09:00
Yu Watanabe
e955a7f460 udevd: configure a child process name for worker processes
This effectively reverts commit ff86c92e3043f71fc801cf687600a480ee8f6778,
and re-apply 49f3ee7e74c714f55aab395c080b1099fc17f7fd.

The change was dropped due to the process name was not correctly logged,
but the issue was fixed by dd15e4cb57129b915e01495e113696bfe0b70214.
Let's set the child process name again.
2023-02-07 14:38:55 +09:00
Yu Watanabe
8586e8ab84
Merge pull request #26324 from yuwata/argv-util-update-short-name
argv-util: also update short invocation name
2023-02-07 12:08:07 +09:00
Yu Watanabe
5746c82968
Merge pull request #26322 from keszybz/log-errno-fix
Log errno fix
2023-02-07 12:07:45 +09:00
Yu Watanabe
e7ced42d24
Merge pull request #26321 from keszybz/flex-arrays
Enable new compiler diagnostics for invalid array accesses
2023-02-07 12:07:21 +09:00
Yu Watanabe
dd15e4cb57 argv-util: also update program_invocation_short_name
Our logging uses program_invocation_short_name. Without this patch,
logs from forked client may become broken; spuriously truncated or
the short invocation name is not completely shown in the log.
2023-02-06 22:51:20 +09:00
Zbigniew Jędrzejewski-Szmek
f41e4b82a4 shared/json: avoid use of fake flex array 2023-02-06 12:09:55 +01:00
Zbigniew Jędrzejewski-Szmek
da8587b24e sd-journal: avoid use of fake flex arrays
I tried to use DECLARE_FLEX_ARRAY like the kernel does, but it does not work
for anonymous structs (they cannot be declared inline), so an open-coded
version is used.
2023-02-06 12:04:16 +01:00
Zbigniew Jędrzejewski-Szmek
03f5e501b6 repart: silence bogus gcc warning
[2/3] Compiling C object systemd-repart.p/src_partition_repart.c.o
../src/partition/repart.c: In function ‘context_open_copy_block_paths’:
../src/partition/repart.c:5194:41: warning: ‘devno’ may be used uninitialized [-Wmaybe-uninitialized]
 5194 |                         source_fd = r = device_open_from_devnum(S_IFBLK, devno, O_RDONLY|O_CLOEXEC|O_NONBLOCK, &opened);
      |                                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../src/partition/repart.c:5188:31: note: ‘devno’ was declared here
 5188 |                         dev_t devno;
      |                               ^~~~~

This is with gcc-13.0.1-0.2.fc38.x86_64, -O2. I'm pretty sure the code
is correct. I also tried adding some asserts where errno is used for the return
value, but that didn't help. I think resolve_copy_blocks_auto() is just too long
for gcc to understand.
2023-02-06 10:24:57 +01:00
Zbigniew Jędrzejewski-Szmek
375ffdba43 repart: fix invalid errno in log 2023-02-06 10:24:56 +01:00
Zbigniew Jędrzejewski-Szmek
c8b960af14 shared/linux: fix fake flexible array in struct autofs_dev_ioctl
The kernel still hasn't fixed this in kernel-headers-6.2.0-0.rc6.git0.1.fc38.x86_64.
2023-02-06 10:19:52 +01:00
Zbigniew Jędrzejewski-Szmek
d42add3c17 sd-network: stop using fake flexible array 2023-02-06 10:19:52 +01:00
Zbigniew Jędrzejewski-Szmek
99d4dfd184 shared/linux: update kernel headers
The kernel was updated to not use fake flex arrays with zero size.
Updating should allow -fstrict-flex-arrays to be used.

Headers pulled from kernel-headers-6.2.0-0.rc6.git0.1.fc38.x86_64.

Note that this is not a straighforward copy: our files have local modifications
(listed in README) that need to be preserved.
2023-02-06 10:19:08 +01:00
Zbigniew Jędrzejewski-Szmek
7a17e41dcf test: drop whitespace after shell redirection operators
(The one case that is left unchanged is '< <(subcommand)'.)

This way, the style with no gap was already dominant. This way, the reader
immediately knows that ' < ' is a comparison operator and ' << ' is a shift.

In a few cases, replace custom EOF replacement by just EOF. There is no point
in using someting like "_EOL" unless "EOF" appears in the text.
2023-02-06 09:19:04 +01:00
Zbigniew Jędrzejewski-Szmek
b7a8a33a03
Merge pull request #26292 from yuwata/locale-fix-enoent-handling
locale: fix ENOENT handling for vconsole.conf or xorg.conf
2023-02-02 11:01:56 +01:00