1
0
mirror of https://github.com/systemd/systemd.git synced 2025-01-12 13:18:14 +03:00
Commit Graph

62925 Commits

Author SHA1 Message Date
Jan Janssen
5080a60a71 boot: Provide our own EFI API headers
We want to get away from gnu-efi and the only really usable source of
EFI headers would be EDK2, which is somewhat impractical to use and
quite large to require to be around just for some headers.

As a bonus point, the new headers are safe to be included in userspace
code.

This should not have any behavior changes as it is mostly changing
header includes. There are some renames to conform to standard names
and a few minor device path fixups as the struct is defined slightly
different.

Of note is that this removes usage of uchar.h and wchar.h as they are
not guaranteed to be available in a freestanding environment. Instead
efi.h will provide the needed types.
2023-02-21 14:46:02 +01:00
Jan Janssen
a409607489 boot: Query EFI var size before fetching them 2023-02-21 14:44:53 +01:00
Jan Janssen
b3e2557629 boot: Use C escape sequence for control chars
This makes things less magical by emphasizing that these are just
regular ascii/unicode chars.
2023-02-21 14:44:53 +01:00
Jan Janssen
65d40db7de boot: Drop use of efigpt.h 2023-02-21 14:44:48 +01:00
Daan De Meyer
a1cfe39000 mkosi: Use 4 space indentation for scripts
mkosi scripts are shell scripts and for shell scripts we use 4 space
indentation.
2023-02-21 14:22:52 +01:00
Zbigniew Jędrzejewski-Szmek
9c7188547c tmpfiles.d: drop misleading comment
I'm not sure what "suffix" was meant by this comment, but the file has the usual suffix.
The file was added with the current name back in c4708f1323.
Maybe an earlier version of the patch did something different.
2023-02-21 13:46:39 +01:00
Lennart Poettering
464ec1dec7 homectl: add missing break 2023-02-21 13:35:12 +01:00
Daan De Meyer
bfe6bd1789 mkosi: Drop opensuse workaround 2023-02-21 13:11:52 +01:00
Daan De Meyer
51c31ed7d7 mkosi: Drop bootctl workaround in postinst script 2023-02-21 13:11:37 +01:00
Daan De Meyer
046607bb5f mkosi: Drop locale workaround
mkosi will always run all commands with the C.UTF-8 locale so we
don't need a workaround in the build script anymore.
2023-02-21 13:01:30 +01:00
Daan De Meyer
f88f720a8b mkosi: Drop ld workaround
Build scripts will always run in an environment with /etc/ available
now, so we don't need this workaround anymore.
2023-02-21 13:01:30 +01:00
Daan De Meyer
8d8337da5e mkosi: Update to latest 2023-02-21 13:01:22 +01:00
Yu Watanabe
a2275dcb9d core/manager: falling back to execute generators without sandboxing
When running in a container, like podman, docker or so, creating new mount
namespace may be disabled.

Fixes #26474.
Fixes RHBZ#2165004 (https://bugzilla.redhat.com/show_bug.cgi?id=2165004).
2023-02-21 11:11:03 +01:00
Lennart Poettering
f010478168 docs: document the new HEADER_COMPATIBLE_TAIL_ENTRY_BOOT_ID flag 2023-02-21 10:47:53 +01:00
Lennart Poettering
ced1196802 journal-file: drop checking if files are from the future at time of open
We nowadays check for ordering anyway at time of writing entries, hence
we don't have to do that at moment of opening, too.

Benefit of dropping this check: we can safely archive files from the
future instead of marking them as broken.
2023-02-21 10:47:53 +01:00
Lennart Poettering
07f1c7aa9d journal-file: allow opening journal files for write when machine ID is not initialized
We allow reading them, and we allow creating them, but we so far did not
allow opening existing ones for write – if the machine ID is not
initialized.

Let's fix that.

(This is just to fix an asymmetry. I have no immediate use for this. But
test code should in theory be able to use this, if it runs in an
incompletely initialized environment.)
2023-02-21 10:47:53 +01:00
Lennart Poettering
51ab0afed4 journal-file: lazily fill in machine ID into journal header, if needed
Previously, if we ran in an environment where /etc/machine-id was
not defined, we'd never bother to write it ever again. So it would stay
at all zeroes till the end of times.

Let's make this more robust: whenever we try to append an entry, let's
try to refresh it from the status quo if not initialized yet. Moreover,
when copying records from a different journal file, let's propagate the
machine ID from there.

This should make things more robust and systematic, and match how we
propagate the boot ID and the seqnum ID to some level.
2023-02-21 10:47:53 +01:00
Lennart Poettering
8e64ec0470 journal-file: write machine ID when create the file, not when we open it for writing
This doesn't actually change much, but makes the code less surprising.

Status quo ante:

1. Open a journal file
2. If newly created set header machine ID to zero
3. If existing and open for write check if machine ID in header matches
   local one, if not, refuse.
4. if open for writing, now refresh the machine ID from the local system

Of course, step 4 is pretty much pointless for existing files, as the
check in 3 made sure it is already in order or we'd refuse operating on
it anyway. With this patch this is simplified to:

1. Open a journal file
2. If newly created initialized machine ID to local machine ID
3. If existing, compare machine ID in header with local one, if not
   matching refuse.

Outcome is the same.
2023-02-21 10:47:53 +01:00
Lennart Poettering
9204fc642a journal-file: don't update boot_id in journal header on open
The header of the journal file contains a boot ID field that is
currently updated whenever we open the journal file. This is not ideal:
pretty often we want to archive a journal file, and need to open it for
that. Archiving a foreign journal file should not mark it as ours, it
should just change the status flag in the file header.

The boot ID in the header is aleady rewritten whenever we write a
journal entry to the file anyway, hence all this patch effectively does
is slightly "delay" when the boot ID in the header is updated: instead
of immediately on open it is updated on the first entry that is written.

Net effect: archived journal files don't all look like they were written
to on a boot newer then they actually were

And more importantly: the "tail_entry_monotonic" field suddenly becomes
useful, since we know which boot it belongs to. Generally, monotonic
timestamps without boot ID information are useless, and this fixes it.

A new (compatible) header flag marks file where the boot_id can be
understood this way. This can be used by code that wants to make use of
the "tail_entry_monotonic" field to ensure it actually can do so safely.

This also renames the structure definition in journal-def accordingly,
to indicate we now follow the stricter semantics for it.
2023-02-21 10:47:53 +01:00
Lennart Poettering
512f2da5c7 update TODO 2023-02-21 10:18:33 +01:00
Yu Watanabe
0c2aedb451 tree-wide: use FORK_REARRANGE_STDIO and FORK_CLOSE_ALL_FDS 2023-02-21 07:39:18 +09:00
Yu Watanabe
911f8f0183 process-util: rename FORK_NULL_STDIO -> FORK_REARRANGE_STDIO
And make safe_fork_full() takes fds to be assigned to stdio.
2023-02-21 07:37:51 +09:00
Steve Ramage
f72dcb92c4 man: add DefaultStartupMemoryLow= as term in term list 2023-02-21 07:05:30 +09:00
Zbigniew Jędrzejewski-Szmek
a324a8958b meson: adjust whitespace handling in jinja2 rendering
In 6abe882bae the renderer was made to
unconditionally append a newline to output. This works, but is ugly. A nicer
solution is to tell jinja2 to not strip the newline in the first place, via
keep_trailing_newline=True. It seems that the result is unchanged because all
our source files have exactly one trailing newline.

Also, enable lstrip_blocks=True. This would cause whitespace on the line before
an {%if block to be automatically stripped. It seems reasonable to enable that
if trim_blocks=True.

Overall, no change is expected, though I didn't test combinations of
configurations, so there might be a change in some cases. But now the rules of
rendering are more logical, e.g. we should be able to indent nested conditional
statements without getting unexpected whitespace in the output.
2023-02-21 06:41:19 +09:00
Yu Watanabe
e814f8b246
Merge pull request #26506 from keszybz/tiny-cleanups
Various trivial cleanups and follow-ups
2023-02-21 06:41:01 +09:00
Yu Watanabe
53b3512f9c
Merge pull request #26499 from mrc0mmand/assorted-tweaks
A couple of test tweaks for recent CI fails
2023-02-21 05:55:37 +09:00
Daan De Meyer
c87ff62210 ukify: Set fast_load option when parsing PE files
Let's skip parsing of some irrelevant information that we don't use
to speed up building UKIs with large initrds from +-15s to less than
1s.
2023-02-20 20:02:22 +01:00
Lennart Poettering
e43e735add
Merge pull request #26508 from poettering/cap-fixes
various fixes to capability handling
2023-02-20 19:04:13 +01:00
Lennart Poettering
76875ba9cb capability-util: use UINT32_MAX as shortcut where appropriatea 2023-02-20 16:49:46 +01:00
Lennart Poettering
3b3ebabfa6 capability-util: add macro for largest cap we're willing to accept
Let's hide the hard to grasp 62 behind a name.
2023-02-20 16:49:45 +01:00
Lennart Poettering
3fd5190b5e capability-util: add CAP_MASK_ALL + CAP_MASK_UNSET macros
We should be more careful with distinguishing the cases "all bits set in
caps mask" from "cap mask invalid". We so far mostly used UINT64_MAX for
both, which is not correct though (as it would mean
AmbientCapabilities=~0 followed by AmbientCapabilities=0) would result
in capability 63 to be set (which we don't really allow, since that
means unset).
2023-02-20 16:49:45 +01:00
Lennart Poettering
6c5fff017e cap-list: make sure never to accidentally return more than 63 caps
The rest of our codebase stores caps masks in a uint64_t, and also
assumes UINT64_MAX was a suitable value for "unset mask". Hence refuse
any caps outside of 0…62.

(right now the kernel knows 40 caps, hence 22 more to go before we have
to reconsider our life's choices.)
2023-02-20 16:49:45 +01:00
Lennart Poettering
ebb93f3ccf cap-list: rework capability_set_to_string()
Let's use strextend_with_separator() and CAPABILITY_TO_STRING().
2023-02-20 16:49:45 +01:00
Lennart Poettering
c52c4d6974 cap-list: add CAPABILITY_TO_STRING() macro using compound initialization to allocate fallback buffer
Let's add a helper that can return a numeric string in case we don't
recognize a name for a capability.
2023-02-20 16:27:26 +01:00
Lennart Poettering
d0e67c69ba cap-list: refuse parsing numeric capability 63
We refuse it otherwise currently, simply because we cannot store it in a
uint64_t caps mask value anymore while retaining the ability to use
UINT64_MAX as "unset" marker.

The check actually was in place already, just one off.
2023-02-20 16:13:49 +01:00
Lennart Poettering
3f444e94f5 cap-list: modernize capability_set_from_string() a bit
Make return parameter optional. And return whether there were any caps
we didn't recognize via 0/1 return value.
2023-02-20 16:13:49 +01:00
Lennart Poettering
8142d73574 cap-list: rename capability_set_to_string_alloc() → capability_set_to_string()
We typically don't use the _alloc() suffix anymore for anything, hence
drop it here too.
2023-02-20 16:13:49 +01:00
Daan De Meyer
0cd90cf4f3
Merge pull request #26437 from DaanDeMeyer/repart-exclude
repart: Add ExcludeFiles= option
2023-02-20 15:49:29 +01:00
Zbigniew Jędrzejewski-Szmek
beca6b6e6b TODO: add entry for time-based glob cleanup 2023-02-20 15:27:42 +01:00
Zbigniew Jędrzejewski-Szmek
164297cd9a man/tmpfiles.d: adjust the table in synopsis, improve spelling
r and R take globs, so let's name the argument appropriately in the tl;dr listing.

Also, use 'clean-up' in the file name where it represents the verb "clean up",
and other minor spelling adjustments.
2023-02-20 15:27:42 +01:00
Zbigniew Jędrzejewski-Szmek
6e01955b30 shared/hwdb-util: drop "variable" with a single use
In 6a34639e76 arg_hwdb_bin_dir was replaced by
default_hwdb_bin_dir, which is constant. Generally we'd use a #define instead,
but since there's just one use, let's just avoid the indirection altogether.
2023-02-20 15:27:30 +01:00
Luca Boccassi
96f321b6b4 man: document DefaultStartupMemoryLow=
Fixes https://github.com/systemd/systemd/issues/26493
2023-02-20 13:35:15 +00:00
Daan De Meyer
eb483e7ae1
Merge pull request #26465 from DaanDeMeyer/openat-helpers
Add more openat() helpers of utility functions
2023-02-20 13:58:59 +01:00
Daan De Meyer
a9af827613 repart: Add ExcludeFiles= option 2023-02-20 13:51:46 +01:00
Zbigniew Jędrzejewski-Szmek
650a4a9565 efi/measure: adjust formatting 2023-02-20 13:38:32 +01:00
Zbigniew Jędrzejewski-Szmek
bad6b4405c measure: wrap long lines and avoid one cast 2023-02-20 13:38:32 +01:00
Zbigniew Jędrzejewski-Szmek
f274f8bf25 sleep: use shared constant for freeze timeout
Let's keep all the timeout definitions in one place.
2023-02-20 13:38:32 +01:00
Daan De Meyer
9dcb8923cc smack-util: Add renameat_and_apply_smack_floor_label()
Also add mac_smack_apply_at() as its a requirement for
renameat_and_apply_smack_floor_label().
2023-02-20 12:45:43 +01:00
Daan De Meyer
e8729892e8 tmpfile-util-label: Add fopen_temporary_at_label() 2023-02-20 12:44:44 +01:00
Daan De Meyer
d9daf0d144 copy: Add copy_file_at() 2023-02-20 12:44:18 +01:00