Yu Watanabe
de2c62e847
bootctl: fix wrong type comparison
2023-03-20 13:58:20 +09:00
Yu Watanabe
0bc2bcf4fe
Merge pull request #26759 from medhefgo/boot-stack-protector
...
boot: Add support for stack protector/trapping math/ubsan
2023-03-18 15:07:45 +09:00
Yu Watanabe
16af02cd97
uki-util: move functions for inspecting kernel to uki-util.[ch]
2023-03-17 20:40:34 +09:00
Yu Watanabe
c8eced395b
bootctl: introduce inspect_kernel()
...
Then, now verb_kernel_identify() and verb_kernel_inspect() can share
most of the code.
2023-03-17 20:40:34 +09:00
Yu Watanabe
8102ff2e3d
bootctl: introduce uki_read_pretty_name()
...
No functional change, just prepration for later commits.
2023-03-17 20:40:34 +09:00
Yu Watanabe
748b15c277
bootctl: find matching section in read_pe_section()
...
No functional change, just refactoring.
2023-03-17 20:40:34 +09:00
Yu Watanabe
03221e746d
bootctl: return 0 instead of EXIT_SUCCESS
2023-03-17 20:40:34 +09:00
Yu Watanabe
ab94d98b29
bootctl: move verb_kernel_identity()
...
No functional change, just for making beautify later diffs.
2023-03-17 20:40:34 +09:00
Jan Janssen
1e7ff4ba88
boot: Add undefined sanitizer support
...
Sadly, no stack traces, but this is better than nothing.
2023-03-17 10:39:39 +01:00
Jan Janssen
0b482b37f9
meson: Share more C flags
2023-03-17 10:39:32 +01:00
Jan Janssen
f64f82aa8d
boot: Add support for -ftrapv
2023-03-17 10:35:29 +01:00
Jan Janssen
48e1b2c250
boot: Add support for -fstack-protector
2023-03-17 10:35:29 +01:00
Jan Janssen
a05f03225e
boot: Detect nested assertions
2023-03-17 10:35:29 +01:00
Daan De Meyer
f5abe8f957
Merge pull request #26784 from DaanDeMeyer/chase-fix
...
Allow creating files and directories with chase_symlinks_open() and further improvements
2023-03-15 15:51:47 +01:00
Daan De Meyer
39eb3ffaaa
fs-util: Drop unlink_noerrno()
2023-03-15 13:27:20 +01:00
Jan Janssen
ccde62954c
stub: Remove overlapping PE section warning
...
Now that we always create PE images with a non-zero image base we cannot
run into this issue anymore. Any tool that still uses the old hard-coded
section offsets will end up creating bad images with sections below the
image base. objcopy will warn about this and any PE loader will simply
refuse to load such an image. Meanwhile updated tools do not use
hard-coded offsets anymore.
2023-03-15 00:24:17 +00:00
Daan De Meyer
06344330a1
chase-symlinks: Remove unused ret_fd arguments
2023-03-14 13:46:58 +01:00
Yu Watanabe
5654a4f9c5
sd-boot: fix incompatible type
...
Fixes the following build error:
```
../src/boot/efi/vmm.c: In function ‘get_smbios_table’:
../src/boot/efi/vmm.c:217:24: error: incompatible types when returning type ‘_Bool’ but ‘const SmbiosHeader *’ was expected
217 | return false;
| ^~~~~
```
2023-03-12 19:49:16 +09:00
Yu Watanabe
c9501b03cd
Merge pull request #26641 from medhefgo/boot-elf2efi
...
boot: Drop gnu-efi / Add elf2efi.py
2023-03-11 17:15:01 +09:00
Morten Linderud
6dadf31d61
src: Fixup copy-paste error for terminal_urlify_man
...
Signed-off-by: Morten Linderud <morten@linderud.pw >
2023-03-10 20:21:30 +01:00
Jan Janssen
2c7c68e4e4
meson: Use static library for EFI tests
...
This also moves them so that fuzz builds do not need pyelftools around.
2023-03-10 11:41:08 +01:00
Jan Janssen
5d5525245b
boot: Fix unused function warning
2023-03-10 11:41:08 +01:00
Jan Janssen
31ffb6b183
boot: Add RISCV32 and LoongArch support
...
This is completely untested, but should work in theory, as it's just
adding a couple defines according to the specs.
2023-03-10 11:41:08 +01:00
Jan Janssen
c4ad9b23ca
boot: Fix debug experience
2023-03-10 11:41:08 +01:00
Jan Janssen
2afeaf1675
boot: Bring back bootloader builds
...
This adds back sd-boot builds by using meson compile targets directly.
We can do this now, because userspace binaries use the special
dependency that allows us to easily separate flags, so that we don't
pass anything to EFI builds that shouldn't be passed.
Additionally, we pass a bunch of flags to hopefully disable/override any
distro provided flags that should not be used for EFI binaries.
Fixes : #12275
2023-03-10 11:41:08 +01:00
Jan Janssen
dfca5587cf
tree-wide: Drop gnu-efi
...
This drops all mentions of gnu-efi and its manual build machinery. A
future commit will bring bootloader builds back. A new bootloader meson
option is now used to control whether to build sd-boot and its userspace
tooling.
2023-03-10 11:41:03 +01:00
Dan Streetman
c69bd0abdb
tpm2: add/rename functions to manage pcr selections
...
This renames some functions to match other to/from_string() naming,
and allows better management of TPML_PCR_SELECTION and TPMS_PCR_SELECTION
structs.
2023-03-09 10:46:19 -05:00
Gerd Hoffmann
78088b8f43
bootctl: tweak DOS header magic check
...
Read the magic first, try reading the full DOS exe header only in case
the magic check succeeds.
This avoids throwing an header read error on small dummy files as used
by test-kernel-install.
2023-03-07 08:14:46 +01:00
Zbigniew Jędrzejewski-Szmek
efcde781de
meson: adjust for removal of gnu-efi compat
...
gnu-efi-3.0.11-13.fc39 in Fedora dropped the old include paths.
2023-03-05 19:11:58 +00:00
Lennart Poettering
23e208e742
tmpfile-util: teach link_tmpfile() to optionally replace files
2023-03-03 13:44:12 +01:00
Jan Janssen
ce7180b680
boot: Provide div0 handlers for ARM
...
This is a cleaner approach to 5983306474 .
2023-02-28 14:37:05 +01:00
Jan Janssen
d14eb24925
boot: Fix data model detection for ARM
...
For whatever reason, ARM does not define __ILP32__.
2023-02-28 14:37:05 +01:00
Daan De Meyer
caeb2b616f
Merge pull request #26258 from DaanDeMeyer/boot-smbios
...
stub: Read extra kernel command line items from SMBIOS
2023-02-23 15:59:18 +01:00
Daan De Meyer
c8e5d82c97
vmm: Modernize get_smbios_table()
2023-02-23 09:51:20 +01:00
Daan De Meyer
717af0de46
stub: Read extra kernel command line items from SMBIOS
...
Let's read more kernel command line arguments from SMBIOS OEM string
io.systemd.stub.kernel-cmdline-extra. This allows adding debug kernel
command line arguments when booting in qemy without having to modify
the UKI.
2023-02-23 09:51:18 +01:00
David Tardon
fabaf9ae25
bootctl: drop unneeded initialization
2023-02-23 09:50:26 +01:00
Daan De Meyer
a885188b3a
vmm: Add smbios_find_oem_string()
...
This function can be used to find SMBIOS strings in the SMBIOS Type 11
table.
2023-02-23 09:50:18 +01:00
Daan De Meyer
761f62fe98
vmm: Add more const
...
SMBIOS tables are immutable, so let's access it via const pointers
where possible.
2023-02-23 09:50:18 +01:00
Daan De Meyer
e71f0f63da
efi-string: Add efi_memchr()
2023-02-23 09:49:56 +01:00
David Tardon
92651a7a2d
tree-wide: initialize fds with -EBADF
2023-02-23 09:48:54 +01:00
Jan Janssen
10e27f768b
boot: Take advantage of packed device paths
...
Now that device path types are marked as packed we can safely cast and
access them. If we ever take the address of a member, we would get a
compiler warning.
2023-02-22 21:56:26 +01:00
Jan Janssen
ea592abfc6
boot: Add GUID format helper macro
2023-02-22 21:56:20 +01:00
Jan Janssen
0b92662821
boot: Move more device path helpers to device-path-util.c
...
This also renames them to stay consistent with our naming style.
2023-02-22 21:54:11 +01:00
Jan Janssen
d755ac6214
boot: Remove some device path helper macros
...
In gnu-efi/EDK2 device paths are not marked as packed and instead the
Length field is split into 2 bytes. Accessing those requires these
helper macros as device paths may be unaligned.
Since our own efi headers define device path structs as packed, we can
access these directly, making code much more readable.
2023-02-22 21:54:11 +01:00
Jan Janssen
e6d7dc9ada
boot: Split out device path functions
...
No code changes aside from renaming path_replace_hd() and making its
parameter take any device path node type.
2023-02-22 21:54:11 +01:00
Jan Janssen
8e760b3fcd
boot: Move disk_get_part_uuid into part-discovery.c
...
Thematically, they are similar and disk.c is awfully small to warrant
the separation.
2023-02-22 21:54:11 +01:00
Daan De Meyer
ad36d31ea5
efi-string: Add startswith8()
...
startswith() from string-util-fundamental.h is defined for sd_char
which is char16_t, so let's add an implementation for char as well.
2023-02-22 16:55:07 +01:00
Daan De Meyer
bbef5a9617
efi-string: Fix strchr() null byte handling
...
strchr() should be able to search for the terminating null byte,
our implementation doesn't, let's fix that.
2023-02-22 16:55:07 +01:00
Yu Watanabe
4788f635e3
Merge pull request #26203 from medhefgo/meson
...
meson: Use dicts for test/fuzzer definitions
2023-02-22 10:27:16 +09:00
Jan Janssen
5fa3e628cd
boot: Drop _harder suffix
...
Since there is no use of gnu-efi functions anymore, we don't need to
distinguish them by name.
2023-02-21 21:07:04 +01:00