1
0
mirror of https://github.com/systemd/systemd.git synced 2025-01-25 10:04:04 +03:00

65094 Commits

Author SHA1 Message Date
Yu Watanabe
8c12d3586a journalctl: split out update_cursor()
No functional change, just refactoring.
2023-05-28 14:52:32 +09:00
Yu Watanabe
2ce9a07b34 journalctl: split out action_list_fields()
No functional change, just refactoring.
2023-05-28 14:52:32 +09:00
Yu Watanabe
3f2203f64d journalctl: fix --no-tail handling
Fixes a bug introduced by 62f21ec91ad8e7e24079962f4df066b0094fe68d.
2023-05-28 14:52:32 +09:00
Yu Watanabe
20e933ae74 journalctl: use correct variable to check if --since is specified 2023-05-28 14:52:32 +09:00
Yu Watanabe
4f0165fd34 journalctl: always initialize global variables
That's not necessary, as they are initialized with zero, but for safety
and readability.
2023-05-28 14:52:32 +09:00
Piotr Drąg
059b1b31ad po: add a false positive to POTFILES.skip
Scripts used to detect files that should be in POTFILES.in, like
intltool-update -m used on https://l10n.gnome.org/module/systemd/,
falsely detect this file as containing translations. Avoid this
behavior by putting the file in POTFILES.skip.
2023-05-27 17:17:57 +01:00
Daan De Meyer
30868c1c8d tree-wide: Downgrade a few more noisy log messages to trace 2023-05-27 14:47:56 +02:00
Dan Streetman
b2efe28658 boot/measure: replace TPM PolicyPCR session with calculation
Instead of using a trial policy with a TPM to calculate the measurement hash,
this uses a function to calculate the hash with no TPM needed.
2023-05-27 08:50:04 +02:00
Yu Watanabe
9e39cb2855
Merge pull request #27721 from yuwata/journalctl-cleanup
journalctl: split get_boots() into three
2023-05-27 07:59:22 +09:00
Rene Hollander
58fa558ae4 Add DHCPServer information to JSON output.
Adds a new JSON object called DHCPServer for each interface that has a
DHCPServer configured. It has the following attributes:
- PoolSize and PoolOffset from the configuration
- List of offered leases
- List of static leases from the configuration
2023-05-27 07:58:12 +09:00
Frantisek Sumsal
837773add4 Revert "test: add test case for systemd-update-utmp vs daemon-reexec"
Temporarily revert the test case for #27167, as the additional
daemon-reexecs exacerbate #27287, making CIs fail quite often.
As the #27167 is also covered by TEST-01-BASIC itself, since we do
daemon-reexec there anyway, we shouldn't lose any coverage, but it
should make CIs more stable until #27287 is figured out.

Resolves (or more like works around): #27807

This reverts commit d689f70a2c18666bbf6500df7a53962a8f3e91a4.
2023-05-27 07:57:20 +09:00
Daan De Meyer
dcc5547b8b
Merge pull request #27517 from ddstreet/tpm2_calculate_policy
Tpm2 calculate policy
2023-05-26 23:08:15 +02:00
Yu Watanabe
e44f06065b journalctl: split get_boots() into three
Previously, get_boots() used for three ways; finding boot entry by
boot ID, finding boot entry by offset, listing up all boot IDs.

Let's split it into three for each usecase.

No functional change, just refactoring.
2023-05-27 03:57:39 +09:00
Yu Watanabe
c93d3c0512 logs-show: introduce add_match_boot_id() helper function 2023-05-27 03:57:01 +09:00
Mike Yuan
97d822abac
Merge pull request #27787 from keszybz/firstboot-synchronous-restart
firstboot: make restart of vconsole-setup synchronuous
2023-05-27 02:30:45 +08:00
Yu Watanabe
d4fd160f69
Merge pull request #27786 from YHNdnzj/format-timestamp-monotonic
time-util,format-table: add relative_monotonic variant for timestamp
2023-05-27 03:05:34 +09:00
Yu Watanabe
f254238204
Merge pull request #27803 from mrc0mmand/even-more-nalloc-shenanigans
A couple more fixes for potential OOM-related issues
2023-05-27 02:58:32 +09:00
Luca Boccassi
08a2bb7b82 gpt/DPS: alias amd64 to x86-64 and aarch64 to arm64
The DSP and our implementation mixes Debian terminology with CPU
terminology. It uses arm64 which is a Debian thing instead of
aarch64, but x86-64 which is a CPU thing instead of amd64.
Add some convenience and transparent aliasing, so that we don't
need to maintain architecture-specific and tool-specific translation
layers in mkosi among other places, while at the same time the DDIs
still look the same (ie: the partlabel does not change depending on
which alias is used, the canonical label is used on disk).
2023-05-26 18:33:35 +01:00
Lennart Poettering
719771adca test-gpt: verify that alias entries are identical to the primary ones
Given we allow aliases we better check for consistency of alias entries
and the primary one.
2023-05-27 02:21:17 +09:00
Dan Streetman
d9a1f1a724 tpm2: add tpm2_calculate_sealing_policy()
This adds a function to fully calculate the authPolicy needed to seal a secret,
and updates tpm2_seal() to use the new function instead of a trial policy.
2023-05-26 11:12:22 -04:00
Dan Streetman
524cef3ff5 tpm2: use tpm2_policy_authorize()
This updates the function to build the sealing policy to use the dedicated
function to perform PolicyAuthorize.

This is separate from the previous commit to make each commit easier to read.
2023-05-26 11:12:22 -04:00
Dan Streetman
5c7852f78c tpm2: add tpm2_policy_authorize()
This adds functions to get the digest for a PolicyAuthorize operation. For
building a policy hash, this provides a function to calculate the hash; and for
building a policy hash to satisfy the authPolicy for an existing object, this
provides a function to perform PolicyAuthorize with an existing session.
2023-05-26 11:12:12 -04:00
Dan Streetman
8a716354bb tpm2: add tpm2_policy_auth_value()
This adds functions to get the digest for a PolicyAuthValue operation. For
building a policy hash, this provides a function to calculate the hash; and for
building a policy hash to satisfy the authPolicy for an existing object, this
provides a function to perform PolicyAuthValue with an existing session.
2023-05-26 11:11:50 -04:00
Dan Streetman
dcbc4674e3 tpm2: add tpm2_policy_pcr()
This adds functions to get the digest for a PolicyPCR operation. For building
a policy hash, this provides a function to calculate the hash; and for building
a policy hash to satisfy the authPolicy for an existing object, this provides a
function to perform PolicyPCR with an existing session.
2023-05-26 11:11:25 -04:00
Dan Streetman
c648a4b85e tpm2: rename pcr_values_size vars to n_pcr_values
Using the n_ prefix is more appropriate/conventional than the _size suffix.

No functional change, this is cosmetic only.
2023-05-26 11:06:53 -04:00
Dan Streetman
dbae4b9535 tpm2: add tpm2_get_name()
This adds functions to get the "name" of a key. The key "name", as defined
by the TPM2 spec, includes its entire public area (with attribute fields),
not only its key fingerprint.

A function is added to calculate the name of a provided key public area,
as well as a function to get the name of a key which is present in the TPM.
2023-05-26 11:06:53 -04:00
Dan Streetman
409a65f829 tpm2: add tpm2_set_auth()
This provides a function to perform the SetAuth TPM function, which provides
the authValue for a key.
2023-05-26 11:06:53 -04:00
Dan Streetman
94a4ff2dc1 tpm2: replace hash_pin() with tpm2_digest_*() functions
The hash_pin() function is just a specific use case of the digest functions.
2023-05-26 11:06:53 -04:00
Dan Streetman
da92d39a85 tpm2: add tpm2_digest_*() functions
These functions allow extending (or initializing) a TPM2B_DIGEST with additional
data, using a specified hash operation. This is needed to perform hash
calculations instead of relying on the TPM to perform the calculations in
trial sessions.
2023-05-26 11:06:20 -04:00
Vitaly Kuznetsov
ce8dc0bd6b man: fix UKI filename suffix in 'tries' description
Boot Loader Type #2 entries (UKIs in $BOOT/EFI/Linux/) have '.efi' suffix,
not '.conf'.
2023-05-26 17:04:37 +02:00
Daan De Meyer
61f695f40a mount-util: Downgrade another noisy debug log to trace level 2023-05-26 17:01:58 +02:00
Luca Boccassi
af262e5fa2 nspawn: restore cross-architecture booting
The check added by 4c27749b8c6b24ef7481ba183ae1fca3749afbf7 breaks
booting an arm64 image on x86 using qemu-bin-fmt, so remove it.
Without it, the image built with mkosi --architecture=aarch64
boots fine in nspawn.
2023-05-26 17:00:58 +02:00
Yu Watanabe
998db5871f udev: introduce .PART_SUFFIX internal property
To make unify rules for disk and partition.
2023-05-26 16:38:09 +02:00
Zbigniew Jędrzejewski-Szmek
5287b3a87a
Merge pull request #27746 from yuwata/unit-bidirectional-dep
core/unit: make unit dependency always bidirectional
2023-05-26 16:20:48 +02:00
Frantisek Sumsal
aca607d18d sd-network: avoid leaking DHCPLease
If we fail any allocation prior adding the lease to the server lease
hashmap.

==2103==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 128 byte(s) in 2 object(s) allocated from:
    #0 0x4a203e in __interceptor_calloc /src/llvm-project/compiler-rt/lib/asan/asan_malloc_linux.cpp:77:3
    #1 0x4f6341 in calloc (/build/fuzz-dhcp-server+0x4f6341)
    #2 0x4ec818 in add_lease /work/build/../../src/systemd/src/libsystemd-network/fuzz-dhcp-server.c:26:9
    #3 0x4ec2bf in LLVMFuzzerTestOneInput /work/build/../../src/systemd/src/libsystemd-network/fuzz-dhcp-server.c:75:9
    #4 0x4f68a8 in NaloFuzzerTestOneInput (/build/fuzz-dhcp-server+0x4f68a8)
    #5 0x5158b3 in fuzzer::Fuzzer::ExecuteCallback(unsigned char const*, unsigned long) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:611:15
    #6 0x51509a 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
    #7 0x516769 in fuzzer::Fuzzer::MutateAndTestOne() /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:757:19
    #8 0x517435 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
    #9 0x50679f in fuzzer::FuzzerDriver(int*, char***, int (*)(unsigned char const*, unsigned long)) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerDriver.cpp:912:6
    #10 0x507068 in LLVMFuzzerRunDriver /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerDriver.cpp:925:10
    #11 0x4f6b25 in main (/build/fuzz-dhcp-server+0x4f6b25)
    #12 0x7f16084e3082 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x24082) (BuildId: 1878e6b475720c7c51969e69ab2d276fae6d1dee)

DEDUP_TOKEN: __interceptor_calloc--calloc--add_lease
SUMMARY: AddressSanitizer: 128 byte(s) leaked in 2 allocation(s).

Found by Nallocufzz.
2023-05-26 16:16:25 +02:00
Frantisek Sumsal
8771463957 sd-journal: log about errors from ordered_hashmap_*()
Follow-up to 08a8fd6e8d.
2023-05-26 16:16:25 +02:00
Frantisek Sumsal
d3d8597782 journal-remote: bump the refcount right after creating the writer object
Otherwise we might hit an assertion during cleanup if the
following mmap_cache_new() call fails:

Assertion 'p->n_ref > 0' failed at src/journal-remote/journal-remote-write.c:80, function writer_unref(). Aborting.

==2069==ERROR: AddressSanitizer: ABRT on unknown address 0x000000000815 (pc 0x7f39dcd0200b bp 0x7ffe2fe24db0 sp 0x7ffe2fe24b60 T0)
SCARINESS: 10 (signal)
    #0 0x7f39dcd0200b in raise (/lib/x86_64-linux-gnu/libc.so.6+0x4300b) (BuildId: 1878e6b475720c7c51969e69ab2d276fae6d1dee)
    #1 0x7f39dcce1858 in abort (/lib/x86_64-linux-gnu/libc.so.6+0x22858) (BuildId: 1878e6b475720c7c51969e69ab2d276fae6d1dee)
    #2 0x7f39dd747e49 in log_assert_failed /work/build/../../src/systemd/src/basic/log.c:940:9
    #3 0x4e4431 in writer_unref /work/build/../../src/systemd/src/journal-remote/journal-remote-write.c:80:1
    #4 0x4e3fd5 in writer_unrefp /work/build/../../src/systemd/src/journal-remote/journal-remote-write.h:27:1
    #5 0x4e3fd5 in writer_new /work/build/../../src/systemd/src/journal-remote/journal-remote-write.c:56:1
    #6 0x4e04bc in journal_remote_get_writer /work/build/../../src/systemd/src/journal-remote/journal-remote.c:125:21
    #7 0x4e0e0b in get_source_for_fd /work/build/../../src/systemd/src/journal-remote/journal-remote.c:181:13
    #8 0x4e0e0b in journal_remote_add_source /work/build/../../src/systemd/src/journal-remote/journal-remote.c:233:13
    #9 0x4df99f in LLVMFuzzerTestOneInput /work/build/../../src/systemd/src/journal-remote/fuzz-journal-remote.c:54:9
    #10 0x4e8f48 in NaloFuzzerTestOneInput (/build/fuzz-journal-remote+0x4e8f48)
    #11 0x507f53 in fuzzer::Fuzzer::ExecuteCallback(unsigned char const*, unsigned long) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:611:15
    #12 0x50773a 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
    #13 0x508e09 in fuzzer::Fuzzer::MutateAndTestOne() /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:757:19
    #14 0x509ad5 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
    #15 0x4f8e3f in fuzzer::FuzzerDriver(int*, char***, int (*)(unsigned char const*, unsigned long)) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerDriver.cpp:912:6
    #16 0x4f9708 in LLVMFuzzerRunDriver /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerDriver.cpp:925:10
    #17 0x4e91c5 in main (/build/fuzz-journal-remote+0x4e91c5)
    #18 0x7f39dcce3082 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x24082) (BuildId: 1878e6b475720c7c51969e69ab2d276fae6d1dee)
    #19 0x420bcd in _start (/build/fuzz-journal-remote+0x420bcd)

DEDUP_TOKEN: raise--abort--log_assert_failed
AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: ABRT (/lib/x86_64-linux-gnu/libc.so.6+0x4300b) (BuildId: 1878e6b475720c7c51969e69ab2d276fae6d1dee) in raise

Found by Nallocufzz.
2023-05-26 16:16:25 +02:00
Zbigniew Jędrzejewski-Szmek
c4f521a91b
Merge pull request #27554 from ElvishJerricco/tmpfiles-c-escapes
tmpfiles: Allow C escapes
2023-05-26 15:42:48 +02:00
Zbigniew Jędrzejewski-Szmek
f3f8bd6a38 various: fix error message for bus_wait_for_jobs_new()
As pointed out by Mike Yuan in review of grandparent commit,
bus_wait_for_jobs_new() can also fail for non-oom reasons.
2023-05-26 15:09:03 +02:00
Zbigniew Jędrzejewski-Szmek
b2ce20aa0c units: order systemd-firstboot after systemd-tmpfiles-setup
We may copy files from factory to /etc. The default mkosi config has
factory/etc/vconsole.conf. systemd-firstboot would race with tmpfiles-setup,
and sometimes ask for the keymap, and sometimes not.

I guess that if there are files in factory, we shouldn't ask the user for
the same configuration.
2023-05-26 15:07:01 +02:00
Zbigniew Jędrzejewski-Szmek
8eb668b9ab firstboot: synchronously wait for systemd-vconsole-setup.service/restart job
Requested in https://github.com/systemd/systemd/pull/27755#pullrequestreview-1443489520.

I dropped the info message about the job being requested, because we get
fairly verbose logs from starting the unit, and the additional message isn't
useful.

In the unit, the ordering before systemd-vconsole-setup.service is dropped,
because now it needs to happen in parallel, while systemd-firstboot.service
is running. This means that we may potentially execute vconsole-setup twice,
but it's fairly quick, so this doesn't matter much.
2023-05-26 15:07:01 +02:00
Frantisek Sumsal
3aed259328 fstab-generator: use correct swap name var
Follow-up to 9445623363.
2023-05-26 13:47:51 +01:00
Lennart Poettering
0706718c07
Merge pull request #27563 from yuwata/fstab-generator
fstab-generator: support defining mount units through kernel command line
2023-05-26 02:52:19 -07:00
Jordan Rome
b58feca65c core: change 'basename' to 'path_extract_filename'
This is part of a cleanup effort in the TODO doc.

Tested locally: `meson compile -C build && meson test -C build`
2023-05-26 15:45:58 +09:00
Yu Watanabe
831108245e core/unit: update bidirectional dependency simultaneously
Previously, if unit_add_dependency_hashmap() failed, then a
one-directional unit dependency reference might be created, and
triggeres use-after-free. See issue #27742 for more details.

This makes unit dependency always bidirectional, and cleanly revert
partial update on failure.

Fixes #27742.
2023-05-26 15:24:09 +09:00
Yu Watanabe
83123a4498 core/unit: search shared namespace in transitive relation of JoinsNamespaceOf=
Previously, dependency chain of JoinsNamespaceOf= did not work, e.g.
- a.service has JoinsNamespaceOf=b.service
- b.service has JoinsNamespaceOf=c.service
if, first c.service, next a.service, finally b.service is started,
then a.service is not joined to the namespace of c.service. And, as
mentioned in the document, the namespace used by b.service is not
deterministic.

This makes when searching exsiting namespace to be joined, all units in
the transitive dependency of JoinsNamespaceOf= are checked.
2023-05-26 15:23:57 +09:00
Mike Yuan
e8d58f5c40
loginctl: use FORMAT_TIMESTAMP_RELATIVE_MONOTONIC
Follow-up for #27769

Addresses https://github.com/systemd/systemd/pull/27769#discussion_r1205215743
2023-05-26 13:29:55 +08:00
Mike Yuan
1d47a2682f
loginctl: realign bus_properties_map 2023-05-26 13:29:55 +08:00
Mike Yuan
cc550be872
systemctl: list-units: use TABLE_TIMESTAMP_RELATIVE_MONOTONIC 2023-05-26 13:29:55 +08:00
Mike Yuan
d65c289fbf
time-util,format-table: add relative_monotonic variant for timestamp 2023-05-26 13:29:54 +08:00