1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2025-01-21 18:03:41 +03:00

60978 Commits

Author SHA1 Message Date
Lennart Poettering
50a085143f tpm2: add some extra validation of device string before using it
Let's add some extra validation before constructing and using the .so
name to load. This isn't really security sensitive, given that we
used secure_getenv() to get the device string (and it thus should have
been come from a trusted source) but let's better be safe than sorry.
2022-11-15 23:14:54 +01:00
Lennart Poettering
34906680af tpm2-util: force default TCTI to be "device" with parameter "/dev/tpmrm0"
Apparently some distros default to tss-abmrd. Let's bypass that and
always go to the kernel resource manager.

abmrd cannot really work for us, since we want to access the TPM already
in earliest boot i.e. in environments the abmrd service is not available
in.

Fixes: #25352
2022-11-15 23:14:13 +01:00
Pasha Vorobyev
d7fe0a6723 MemoryZSwapMax directive to configure new memory.zswap.max cgroup file 2022-11-15 21:15:37 +01:00
Daan De Meyer
2b0cff0469
Merge pull request #25001 from DaanDeMeyer/repart-filter
repart: Add --include/--exclude-partitions
2022-11-15 20:07:24 +01:00
Daan De Meyer
56bb434e9b repart: Add integration test for --include/--exclude-partitions 2022-11-15 13:45:28 +01:00
Daan De Meyer
81d1098bc1 repart: Add --include/--exclude-partitions
Let's allow filtering the partitions to operate on by partition
type UUID. This is necessary when building bootable images with a
verity protected root/usr partition as we can only build the UKI
image when we have the verity roothash which means we cannot populate
the EFI partition yet when we run repart initially to determine the
verity roothash.
2022-11-15 13:45:25 +01:00
Daan De Meyer
00428745e3 repart: Use first unused partition number for new partitions
If we skip some partition types in a first run of systemd-repart,
we don't want their partition numbers to be different than usual,
so let's change the allocation of partition numbers to account for
that.
2022-11-15 13:27:59 +01:00
Daan De Meyer
22e932f4d1 gpt: Expose GptPartitionType and get rid of SECONDARY/OTHER
Instead of exposing just the partition type UUID, let's expose the
GptPartitionType struct, which has a lot more information available
in a much more accessible way.

Also, let's get rid of SECONDARY/OTHER in PartitionDesignator. These
were only there to support preferred architectures in dissect-image.c,
but we can easily handle that by comparing architectures when we decide
whether to override a partition. This is done in a new function
compare_arch().
2022-11-15 13:27:15 +01:00
Li kunyu
bef69ae878
repart: Remove the repeated ';' from code (#25386) 2022-11-15 17:02:51 +09:00
Daan De Meyer
32a3f802f6
Merge pull request #24908 from DaanDeMeyer/repart-minimize
repart: Add Minimize setting
2022-11-15 08:19:28 +01:00
Daan De Meyer
14697c4156 repart: Add Minimize= integration test 2022-11-14 13:06:17 +01:00
Frantisek Sumsal
09cd639a59
Merge pull request #25327 from keszybz/mkosi-less-work
Skip mkosi runs on docs-only changes and some small cleanups
2022-11-14 11:44:16 +00:00
Luca Boccassi
b06624e47e
Merge pull request #25361 from bluca/readme
README: note a couple more kconfigs
2022-11-14 12:32:39 +01:00
Vitaly Kuznetsov
019243553d measure: fix section names in 'objcopy' example in systemd-measure man
A copy paste error has crippled in the objcopy example in 'systemd-measure'
manual,  "--change-section-vma" should reference the section being added,
not ".splash". When used as-is, the resulting UKI is unbootable.

Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
2022-11-14 12:31:33 +01:00
Luca Boccassi
a460debc8e README: note Kconfig for verifying DDIs via MoK keys
Also note them in the mkosi.build kernel config list
2022-11-14 11:09:36 +00:00
Zbigniew Jędrzejewski-Szmek
f7ad96506e mkosi: drop spaces after shell redirection operator 2022-11-14 11:59:30 +01:00
Zbigniew Jędrzejewski-Szmek
e642816b65 ci: use mkosi executable directly 2022-11-14 11:59:30 +01:00
Yu Watanabe
0b51a1c8c4 systemctl: do not show unit properties with --all
Fixes a bug introduced by a6e334649d4bdff0c6f664e98666b2223aa21a8b.

Fixes #25343.
2022-11-14 10:00:02 +01:00
Luca Boccassi
244c2a8344 tmpfiles: log at info level when some allowed failures occur
In provision.conf we ship:

d- /root :0700 root :root -
d- /root/.ssh :0700 root :root -

These are allowed to fail, for example on a read-only filesystem. But they still
log at error level, which is annoying and gets flagged. Tune those specific errors
down to info.

There are likely more that could be tuned down, but the important thing is to cover
the tmpfiles.d that we ship right now.

Before:

$ echo -e "d- /root :0700 root :root - \nd- /root/.ssh :0700 root :root -" | SYSTEMD_LOG_LEVEL=err build/systemd-tmpfiles --root=/tmp/img --create -
Failed to create directory or subvolume "/tmp/img/root": Read-only file system
Failed to open path '/tmp/img/root': No such file or directory
$

After:

$ echo -e "d- /root :0700 root :root - \nd- /root/.ssh :0700 root :root -" | SYSTEMD_LOG_LEVEL=err build/systemd-tmpfiles --root=/tmp/img --create -
$
2022-11-14 08:53:07 +01:00
Mike Yuan
dab0156f03 module-util: use the blacklist from module_blacklist= in cmdline
When a module is blacklisted using module_blacklist=
we shouldn't fail with 'Operation not permitted'.
Instead we check for it and skip it if this is the case.
2022-11-14 10:52:01 +09:00
Yu Watanabe
bf0d5cba56
Merge pull request #25368 from yuwata/bootctl-ignore-invalid-boot-entries
bootctl: ignore invalid boot entries
2022-11-14 10:51:33 +09:00
Yu Watanabe
3a7c2bca2b
Merge pull request #25373 from medhefgo/boot-fixes
boot: Small fixes
2022-11-14 08:18:21 +09:00
Yu Watanabe
088377e092 dissect-image: do not try to close invalid fd
Fixes a bug introduced by f7725647bb41c3398a867f139efe526efe8aa1b3.

Hopefully fixes #25348.
2022-11-13 21:02:53 +01:00
Jan Janssen
6ee4aa2214 boot: Fix error message 2022-11-13 16:15:34 +01:00
Jan Janssen
98ac5192d5 boot: Silence driver reconnect errors 2022-11-13 16:15:34 +01:00
Yu Watanabe
d6c817358c
Merge pull request #25338 from DaanDeMeyer/at-fixes
Followups for #24813
2022-11-13 22:59:40 +09:00
Yu Watanabe
b3d98761c8
Merge pull request #25339 from dtardon/vertical-tables
Port more tools to vertical table
2022-11-13 22:39:36 +09:00
David Tardon
c62ca82656 localectl: port to vertical table 2022-11-13 20:22:34 +09:00
David Tardon
fa09e36423 hostnamectl: port to vertical table 2022-11-13 20:22:34 +09:00
David Tardon
9c1b0927d3 analyze-inspect-elf: port to vertical table 2022-11-13 20:22:34 +09:00
David Tardon
9e1344850f analyze-timespan: port to vertical table 2022-11-13 20:21:54 +09:00
David Tardon
1ba1348182 analyze-timestamp: port to vertical table 2022-11-13 20:21:08 +09:00
David Tardon
f607ebcac2 analyze-calendar: port to vertical table 2022-11-13 20:21:03 +09:00
David Tardon
9c7a5ff6cc analyze-calendar: avoid unnecessary abbreviation 2022-11-13 20:19:05 +09:00
Yu Watanabe
87172c3df6
Merge pull request #25360 from poettering/strv-fixes
nulstr fixes
2022-11-13 20:17:10 +09:00
Yu Watanabe
8ce056c171
Merge pull request #25355 from poettering/chase-symlinks-no-symlink
chase_symlinks(): add CHASE_PROHIBIT_SYMLINKS
2022-11-13 20:16:34 +09:00
Yu Watanabe
ee0f19cfbe
Merge pull request #25349 from poettering/table-header-rework-only
format-table: add TABLE_HEADER cell table
2022-11-13 20:16:09 +09:00
Lennart Poettering
b353d5eee9 bootctl,bootspec: make use of CHASE_PROHIBIT_SYMLINKS whenever we access the ESP/XBOOTLDR
Let's make use of the new flag whenever we access the ESP or XBOOTLDR.
The resources we make use of in these partitions can't possibly use
symlinks (because UEFI knows no symlink concept), and they are untrusted
territory, hence under no circumstances we should be tricked into
following symlinks that shouldn't be there in the first place.

Of course, you might argue thta ESP/XBOOTLDR are VFAT and thus don#t
know symlinks. But the thing is, they don#t have to be. Firmware can
support other file systems too, and people can use efifs to gain access
to arbitrary Linux file systems from EFI. Hence, let's better be safe
than sorry.
2022-11-13 17:46:34 +09:00
Lennart Poettering
d43e78b643 chase-symlinks: add new flag for prohibiting any following of symlinks
This is useful when operating in the ESP, which is untrusted territory,
and where under no circumstances we should be tricked by symlinks into
doing anything we don't want to.
2022-11-13 17:46:30 +09:00
Lennart Poettering
a5a318b664 tests: add tests for various corner cases of nulstr 2022-11-13 17:41:04 +09:00
Lennart Poettering
76078ad850 nulstr-util: fix corner cases of strv_make_nulstr()
Let's change the return semantics of strv_make_nulstr() so that we can
properly distuingish the case where we have a no entries in the nulstr
from the case where we have a single empty string in a nulstr.

Previously we couldn't distuingish those, we'd in both cases return a
size of zero, and a buffer with two NUL bytes.

With this change, we'll still return a buffer with two NULL bytes, but
for the case where no entries are defined we'll return a size of zero,
and where we have two a size of one.

This is a good idea, as it makes sure we can properly handle all corner
cases.

Nowadays the function is used by one place only: ask-password-api.c. The
corner case never mattered there, since it was used to serialize
passwords, and it was known that there was exactly one password, not
less. But let's clean this up. This means the subtraction of the final
NUL byte now happens in ask-password-api.c instead.
2022-11-13 17:40:59 +09:00
Lennart Poettering
db645f936f nulstr-util: don't use 'r' for anything but integer return values 2022-11-13 17:39:08 +09:00
Lennart Poettering
1ef9703774 nulstr-util: use memdup_suffix0() where appropriate
if the nulstr is not nul-terminated, we shouldn't use strndup() but
memdup_suffix0(), to not trip up static analyzers which imply we are
duping a string here.
2022-11-13 17:39:08 +09:00
Lennart Poettering
eecac5053b nulstr-util: use _cleanup_strv_free_() where appropriate 2022-11-13 17:39:08 +09:00
Lennart Poettering
8ba17a319b nulstr-util: rebreak comments 2022-11-13 17:39:08 +09:00
Lennart Poettering
7f0f540500 nulstr-util: modernize strv_from_nulstr() a bit 2022-11-13 17:39:08 +09:00
Lennart Poettering
08af3cc5a5 strv: move nulstr utilities to nulstr-util.[ch]
Let's move them out of the generic, already very long strv.[ch] module
into the more specific nulst-util.[ch]

No code changes.
2022-11-13 17:39:08 +09:00
Lennart Poettering
d3a3a0fae3 format-table: teach table_add_cell_stringf_full() to generate TABLE_FIELD/TABLE_HEADER cells, too 2022-11-13 17:36:22 +09:00
Lennart Poettering
8f6469cbf9 format-table: introduce TABLE_HEADER cell type
This rework the logic for handling the "header" cells a bit. Instead of
special casing the first row in regards to uppercasing/coloring let's
just intrduce a proper cell type TABLE_HEADER which is in most ways
identical to TABLE_STRING except that it defaults to uppercase output
and underlined coloring.

This is mostly refactoring, but I think it makes a ton of sense as it
makes the first row less special and you could in fact insert
TABLE_HEADER (and in fact TABLE_FIELD) cells wherever you like and
something sensible would happen (i.e. a string cell is displayed with
a specific formatting).
2022-11-13 17:36:22 +09:00
Yu Watanabe
1c03f7f4ba ac-power: check battery existence and status
If a battery is not present or its status is not discharging, then
the battery should not be used as a power source.
Let's count batteries currently discharging.

Fixes #25316.
2022-11-13 17:35:27 +09:00