summaryrefslogtreecommitdiffstats
path: root/src/boot (follow)
Commit message (Collapse)AuthorAgeFilesLines
* basic|boot: silence Wunterminated-string-initialization gcc15 warningsCristian Rodríguez2024-08-071-1/+1
| | | | | | | gcc15 has -Wunterminated-string-initialization in -Wextra and warns about string constants that are not null terminated even though the functions do do out of bounds access. Silence the warnings by simply not providing an explicit size.
* boot: fix typoYu Watanabe2024-08-021-1/+1
| | | | Follow-up for dcac1e4a9ba231d8e88d36dbecf3d8b6c9b07cb2.
* efi: fix link to legacy EFI handover protocolLuca Boccassi2024-07-311-1/+1
|
* stub: allocate and zero enough space in legacy x86 handover protocolLuca Boccassi2024-07-316-10/+29
| | | | | | | | | | | | A PE image's memory footprint might be larger than its file size due to uninitialized memory sections. Normally all PE headers should be parsed to check the actual required size, but the legacy EFI handover protocol is only used for x86 Linux bzImages, so we know only the last section will require extra memory. Use SizeOfImage from the PE header and if it is larger than the file size, allocate and zero extra memory before using it. Fixes https://github.com/systemd/systemd/issues/33816
* Fix detection of TDX confidential VM on Azure platformDaniel P. Berrangé2024-07-301-3/+6
| | | | | | | | | | | The original CVM detection logic for TDX assumes that the guest can see the standard TDX CPUID leaf. This was true in Azure when this code was originally written, however, current Azure now blocks that leaf in the paravisor. Instead it is required to use the same Azure specific CPUID leaf that is used for SEV-SNP detection, which reports the VM isolation type. Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
* sd-varlink: make our internal Varlink API public as sd-varlink.[ch]Lennart Poettering2024-07-165-27/+28
| | | | | | | | | | It's time. sd-json was already done earlier in this cycle, let's now make sd-varlink public too. This is mostly just a search/replace job of epical proportions. I left some functions internal (mostly IDL handling), and I turned some static inline calls into regular calls.
* stub: const'ify a few parametersLennart Poettering2024-07-121-6/+6
|
* boot: compare filename suffixes without caseLennart Poettering2024-07-121-1/+1
| | | | This is VFAT world after all.
* stub: Add support for .ucode EFI addonsTobias Fleig2024-07-081-45/+120
| | | | This extends #31872 to also load microcode from addon files.
* stub: mem fixes in devicetree addon handling (#33624)tfg132024-07-041-3/+3
| | | | | | | | | * stub: mem fixes in devicetree addon handling Two bugs here: The elements are of size `DevicetreeAddon`, not `size_t`, and `[]` binds stronger than `*`. This means the first element is ok, but the second corrupts the stack. Found this while refactoring #32463
* vmm: make sure we can handle smbios objects without variable partLennart Poettering2024-07-041-2/+11
| | | | | | | An smbios object with no variable part is a special case, it's just suffixed with two NUL btes. handle that properly. This is inspired by a similar fix from https://github.com/systemd/systemd/pull/29726
* meson: Fix various versionsDaan De Meyer2024-07-041-3/+3
| | | | | | | | | Follow up for 8b3b01c4b7e0fde39b4be354990ee68f5e612c52 We switch to PROJECT_VERSION instead of PROJECT_VERSION_FULL where we report our version and which is likely being parsed to avoid breaking compat. If we didn't, the output would change from systemd 255 to systemd 255.1 which could break various tools.
* Merge pull request #33567 from poettering/boot-fixletsLuca Boccassi2024-07-046-233/+251
|\ | | | | sd-boot,sd-stub: a variety of smaller fixes
| * boot: don't set OsIndications field if already set correctlyLennart Poettering2024-07-031-3/+8
| |
| * boot: cover for hardware keys on phones/tabletsBrenton Simpson2024-07-031-2/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The patch is originally from Brenton Simpson, I (Lennart) just added some comments and rebased it. I didn't test this, but the patch looks so obviously right to me, that I think we should just merge it, instead of delaying this further. In the worst case noone notices, in the best case this makes sd-boot work reasonably nicely on devices that only have a hadware power key + volume rocker. Fixes: #30598 Replaces: #31135
| * measure: drop incomplete support for PCRs != 11Lennart Poettering2024-07-031-67/+50
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | At this point we have a clearer model: * systemd-measure should be used for measuring UKIs on vendor build systems, i.e. only cover stuff predictable by the OS vendor, and identical on all systems. And that is pretty much only PCR 11. * systemd-pcrlock should cover the other PCRs, which carry inherently local information, and can only be predicted locally and not already on vendor build systems. Because of that, let's not bother with any PCRs except for 11 in systemd-measure. This was added at a time where systemd-pcrlock didn't exist yet, and hence it wasn't clear how this will play out in the end.
| * boot: compare auto- prefix case-insensitivelyLennart Poettering2024-07-031-3/+2
| |
| * boot: split out inner part of config_load_type2_entries()Lennart Poettering2024-07-031-119/+134
| | | | | | | | | | | | | | | | | | Let's simplify the code a bit, and parse Type 2 entries in a function of its own, separate from the directory enumeration. This closely follows a similar split we did a long time ago for Type 1. This is just refactoring, no real code change.
| * boot: indent error code path, but leave main code path unindentedLennart Poettering2024-07-031-3/+10
| |
| * efi: don't non-chalantly drop const from memory bufferLennart Poettering2024-07-031-1/+1
| |
| * efi: drop "ret_" prefix from "ret_sections[]" parameterLennart Poettering2024-07-032-24/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | While we write data to this parameter, it's not really a return parameter, we after all do not fully set it, we just fill in some fields. Hence it must be initialized beforehand. According to our coding style only parameters that are purely used for returning something should be named "ret_xyz", hence this one should not be. (We'll later rely on the current behaviour that it leaves array entries for which we find no sections untouched, hence leave behaviour as is, just rename the parameters to something more appropriate). (Since we are dropping the "ret_" prefix of "ret_sections", let's rename the old "section" parameter at the same time to "section_names", to make clearer what it is about).
| * efi: fix mangle_stub_cmdline() for empty stringsLennart Poettering2024-07-031-6/+4
| |
| * efi: add limit on how large files can be we load into memory at onceLennart Poettering2024-07-032-5/+11
| |
* | src/boot/efi/meson.build: ensure VERSION_TAG exists in case of cross buildChen Qi2024-07-041-3/+4
| | | | | | | | | | | | | | | | The GIT_VERSION is changed to use VERSION_TAG, but in case of cross build for src/boot/efi, it's not set, causing build error because the compiler cannot know it's a macro thus treating it as some variable and error out. Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
* | meson: Deal with potential stable versionsDaan De Meyer2024-07-041-2/+2
|/ | | | | The meson.version file might contain e.g. 256.2~devel in a stable branch so let's make sure we deal with that.
* efivars: rename efivar_get_uint_string() → efivar_get_uint64_str16()Lennart Poettering2024-07-024-19/+20
| | | | | | | | Be explicit with the type, and more inline with our other code, that likes to indicate the string char width in the name. Also, switch to a fixed size type, since EFI variables should really be binary exact the same on all archs.
* efi: rename efivar_(set|get)() → efivar_(set|get)_str16()Lennart Poettering2024-07-025-24/+24
| | | | | | These functions after all write EFI UTF-16 strings, i.e. are relatively high-level, hence give them a specific name indicating the type, to match our other helpers that have similar type suffixes.
* efivars: use appropropriate uint8_t type when dealing with "raw" bytesLennart Poettering2024-07-021-3/+3
| | | | | We don't actually want chars here, but rather raw bytes, in particular to avoid signedness issues. Hence, let's use uint8_t here.
* efivars: change return parameter of efivar_get_raw() to be void**Lennart Poettering2024-07-025-10/+10
| | | | | | | This is the "raw", untyped version after all, hence we should return a void pointer, and let the client cast, if they know more. Replaces: #30812
* efi: split out efivars.[ch] from util.[ch]Lennart Poettering2024-07-0212-267/+286
| | | | | | These are quite a bunch of functions, let's give them their own file. No code changes, just some trivial refactoring.
* stub: move safety check for LoadOptions into if block where we actually use itLennart Poettering2024-06-281-7/+7
|
* stub: don't mangle command line if we got it as arrayLennart Poettering2024-06-281-1/+0
| | | | | | | | | | | | | | There are two ways to get the command line: from the EFI shell, preparsed, already split at whitespace. This we just combine with spaces, since kernel wants it as one string. And as one command line blob which is how we are invoked otherwise and which comes with all kinds of whitespace quite likely. Let's only strip leading and trailing whitespace in the latter case, given it's likely the concatenation of whitespace separated strings generated by shell scripts and such. But let's not strip it we already received a preparsed array.
* stub: make sure we always mangle the cmdlines we readLennart Poettering2024-06-281-12/+6
|
* efi: share setting of generic efivars between sd-stub/sd-bootLennart Poettering2024-06-265-61/+62
| | | | | | | | | | | | We have very similar code for setting generic efi vars in sd-stub and sd-boot. Let's share it. This changes behaviour in a minor way: if you chainload multiple versions of an sd-boot you'll see the efi vars of the first one now in the OS, not of the last one. But this should not matter, invocation like that should generally not happen.
* measure: normalize error pathsLennart Poettering2024-06-261-13/+27
| | | | | Always put the success path at least indentation, and indent the error paths.
* stub: rework linux handover to take "struct iovec"Lennart Poettering2024-06-264-43/+36
|
* stub: turn lookup_name() into shorter and more generic function that turns ↵Lennart Poettering2024-06-261-19/+14
| | | | sectin into char* string
* stub: add helper that turns PE section into char16_t* stringLennart Poettering2024-06-261-7/+19
|
* stub: reorder variablesLennart Poettering2024-06-261-6/+6
|
* stub: reorder things a bit, so that initrds are generated/looked up togetherLennart Poettering2024-06-261-5/+6
|
* stub: uniformly process "measured" flagsLennart Poettering2024-06-261-20/+12
| | | | | Always pass the pointer through so that the functions combine the flags directly, instead of doing that in the caller.
* stub: split out function that determines main cmdlineLennart Poettering2024-06-261-15/+28
|
* stub: normalize error handling when looking for PE sectionsLennart Poettering2024-06-261-5/+4
|
* stub: slightly reorder thingsLennart Poettering2024-06-261-7/+7
| | | | | | | Let's do the section measurement first, before we use any data of it. Let's bring up the boot splash next, so that it covers anything else we might do.
* stub: split out code that displays boot splashLennart Poettering2024-06-261-2/+14
|
* stub: split out code that loads all addons from disk into function of its ownLennart Poettering2024-06-261-27/+45
|
* stub: merge separate lists for addon cmdlines/devicetrees into oneLennart Poettering2024-06-261-56/+36
| | | | | Instead of keeping the lists for the global and per-UKI addons separate throughout, just merge them. We apply them in the same order after all.
* stub: don't make up errorsLennart Poettering2024-06-261-1/+1
|
* stub: add DevicetreeAddon structureLennart Poettering2024-06-261-114/+80
| | | | | | Instead of keeping three parallel arrays of dt base, dt size and dt filename, just introduce a proper structure and use an array of that, greatly simplifying DT handling.
* stub: split out call that loads embedded device treeLennart Poettering2024-06-261-13/+24
|