530 Commits

Author SHA1 Message Date
Robert Dower 2e9d312326 archive repository 2025-08-07 13:28:16 -07:00
William Douglas 86c739ceda Prevent segfault in boot_manager_remove_kernel_wrapper
Similar to 6dad804df0 add a check for a
NULL kernel argument.

Signed-off-by: William Douglas <william.douglas@intel.com>
2024-10-11 16:14:40 -07:00
William Douglas 35d8d1302f v3.3.1 release
Signed-off-by: William Douglas <william.douglas@intel.com>
v3.3.1
2024-10-11 15:32:03 -07:00
Joey Riches 0835017374 shim-systemd: Don't hardcode vendor name 2024-10-11 15:26:19 -07:00
Joey Riches 7efbc27f4e shim-systemd: Install & update the Mok Management executable on the ESP
The Mok Management EFI executable (generally mmx64.efi) is needed in a few cases (when secure boot is enabled):
- When using a third-party shim requiring you to enroll your own cert on first boot
- When using a custom kernel or bootloader allowing the user the enroll the hash of it in order to boot

According to the layout comment on the top of the file this should already be expected to be on the ESP, fix that.
2024-10-11 15:21:46 -07:00
Silke Hofstra a2f002d2d2 Fix LUKS glob order 2024-10-11 15:19:16 -07:00
Silke Hofstra 3d872fe5fa Require root for get-timeout
When running `get-timeout` without root, it will fail with an error ('failed to create a new libblkid probe').
Require root permissions for the `get-timeout` subcommand to clarify this.
2024-10-11 14:51:57 -07:00
Brett T. Warden 4e0345e9f4 Avoid segfault when user-specified initrd is a symlink to /dev/null
We check for a microcode update initrd, so we can early-load it, by
comparing the resolved file names to the ending "-ucode.cpio". In the
case that a user has explicitly masked an initrd by symlinking a name in
/etc/kernel/initrd.d/ to /dev/null, we store NULL in the resolved
filename pointer.

Before we do the actual comparison, we do a strlen to make sure the
filename is longer than the desired match. For a NULL pointer, that
results in a segfault, so for that case, explicitly code the length to 0
instead of calling strlen on it.

Signature:
[277506.631610] clr-boot-manage[2369580]: segfault at 0 ip 0000558974796218 sp 00007ffca90d9658 error 4 cpu 18 in libc-2.40.so[196218,558974628000+184000] likely on CPU 18 (core 8, socket 0)
[277506.631627] Code: 0f 84 5e fd ff ff 48 89 f8 0f bc c9 f3 a4 c3 0f 1f 00 89 f8 62 a1 fd 00 ef c0 25 ff 0f 00 00 3d e0 0f 00 00 0f 87 28 01 00 00 <62> f1 7d 20 74 07 c5 fb 93 c0 85 c0 74 1a 0f bc c0 c3 66 0f 1f 44

$ sudo CBM_DEBUG=1 clr-boot-manager update
[DEBUG] cbm (../src/cli/cli.c:L142): No such file: //etc/kernel/update_efi_vars
[INFO] cbm (../src/bootman/bootman.c:L788): Current running kernel: 6.10.12-1467.native
[INFO] cbm (../src/bootman/sysconfig.c:L179): Discovered UEFI ESP: /dev/disk/by-partuuid/cb7f514a-2dd7-445d-9dec-2d5d105c6eee
[INFO] cbm (../src/bootman/sysconfig.c:L256): Fully resolved boot device: /dev/sda1
[DEBUG] cbm (../src/bootman/bootman.c:L141): shim-systemd caps: 0x26, wanted: 0x26
[DEBUG] cbm (../src/bootman/bootman.c:L156): UEFI boot now selected (shim-systemd)
[DEBUG] cbm (../src/bootman/bootman.c:L829): Non regular file: ///etc/kernel/initrd.d/.., skipping.
Segmentation fault

 (gdb) bt
 #0  0x0000555555396218 in __strlen_evex () from /usr/lib64/libc.so.6
 #1  0x000055555555b9cc in _boot_manager_enumerate_initrds_freestanding () at ../src/bootman/bootman.c:889
 #2  0x000055555555d570 in boot_manager_enumerate_initrds_freestanding () at ../src/bootman/bootman.c:918
 #3  0x000055555555b170 in cbm_command_update_do () at ../src/cli/ops/update.c:82
 #4  0x000055555555b2ac in cbm_command_update () at ../src/cli/ops/update.c:44
 #5  0x000055555555990b in main () at ../src/cli/main.c:296
2024-10-11 14:51:01 -07:00
Brett T. Warden 6dad804df0 Prevent segfault in boot_manager_set_default_kernel
If boot_manager_set_default_kernel() is called with a NULL kernel
target, explicitly return false.
2024-06-13 09:35:15 -07:00
William Douglas 9b57ae6c92 Correct release file
Signed-off-by: William Douglas <william.douglas@intel.com>
2023-01-19 14:27:47 -08:00
William Douglas f520938371 v3.3.0 release
Signed-off-by: William Douglas <william.douglas@intel.com>
v3.3.0
2023-01-19 14:25:54 -08:00
William Douglas 8276f49e43 Add remove-kernel command
In some cases users will want to remove kernels from their systems
outside an update workflow. This is fairly painful to do manually so
add a command to handle the operation which removes both the /boot
data and configuration files as well as the /usr data.

The default symlink for a kernel type will remain as this is something
that the update mechanism should be in control of and figuring out
what would be the fallback is out of cbm's scope.

Signed-off-by: William Douglas <william.douglas@intel.com>
2023-01-04 14:46:43 -08:00
William Douglas 019f324d3f Add release process document and update mkrelease.sh
Signed-off-by: William Douglas <william.douglas@intel.com>
2022-10-24 12:04:17 -07:00
William Douglas ce4c8dd912 Version 3.2.12 release
Signed-off-by: William Douglas <william.douglas@intel.com>
v3.2.12
2022-10-12 13:42:41 -07:00
Brett T. Warden 5db267426a Verify that user-provided microcode is loaded first 2022-10-12 13:39:11 -07:00
Brett T. Warden cbe4f29a76 Verify that microcode initrd is first entry in UEFI config 2022-10-12 13:39:11 -07:00
Brett T. Warden 453fc25f23 Use INITRD vars in manpage
Define and use INITRD_DIRECTORY and USER_INITRD_DIRECTORY in the man
page
2022-10-12 13:39:11 -07:00
Brett T. Warden 0c6198fdf8 Add early ucode priority support to grub2 and syslinux 2022-10-12 13:39:11 -07:00
Brett T. Warden 52d200c206 Use streq instead of strcmp
When checking whether we're trying to print an initrd directive for the
early microcode initrd again, use the streq macro instead, as it handles
the edge cases for us.
2022-10-12 13:39:11 -07:00
Brett T. Warden 329f0e96e8 Refine matching for *-ucode.cpio
Make sure we only attempt to match at the end of the string, so we
don't accidentally fail if we also match earlier in the string, e.g.
foo-ucode.cpio-ucode.cpio
2022-10-12 13:39:11 -07:00
Brett T. Warden b15bc98f1e Prevent segfault if no *-ucode.cpio exists 2022-10-12 13:39:11 -07:00
Brett T. Warden 91676a51bf Don't remove early microcode initrd from hashmap
We still have to print the initrd entry first, but need to leave it in
the hashmap because it hasn't been copied to the ESP yet. Instead, just
skip printing it again when we print the rest.
2022-10-12 13:39:11 -07:00
Brett T. Warden ce08b2b375 Rework filename matching for style change
Avoid warnings about using assigments in conditional by moving the
assigment clear out of the conditional.
2022-10-12 13:39:11 -07:00
Brett T. Warden c76515f985 Add documentation for early microcode initrd 2022-10-12 13:39:11 -07:00
Brett T. Warden 2a7dae23ae Write early microcode initrd entry to bootloader config
Now that we identify microcode initrds for early loading, write the
entry for the one we've picked prior to all other initrds, then remove
it from the bootmanager's hashmap so we don't write it again with the
rest.
2022-10-12 13:39:11 -07:00
Brett T. Warden 3be582d464 Quell warning about using an assignment in if clause 2022-10-12 13:39:11 -07:00
Brett T. Warden 674d2f4669 Identify microcode initrds as candidates for early loading
Check the user- and system-owned initrd.d directories for potential
microcode initrds (*-ucode.cpio). Save the first one found.

Later, we'll make sure that's the first entry we emit when writing the
loader config files.
2022-10-12 13:39:11 -07:00
William Douglas 357f1e469a Version 3.2.11 release
Signed-off-by: William Douglas <william.douglas@intel.com>
v3.2.11
2022-05-26 10:59:46 -07:00
William Douglas be97af4d14 Add fallback if /proc/self/mounts root not fully resolved
In some cases (legacy in particular) /proc/self/mounts contains
/dev/root as the device the root path ('/') resolves to. This isn't
a valid device and so fall back to using stat in cases where
cbm_system_get_device_for_mountpoint doesn't return a device path.

Signed-off-by: William Douglas <william.r.douglas@gmail.com>
2022-05-26 10:53:59 -07:00
William Douglas 3989753020 Fix missed initializers
When using autofree, pointers must be initialized to NULL otherwise
use of uninitialized data might occur in the handler.

Signed-off-by: William Douglas <william.r.douglas@gmail.com>
2022-05-26 10:53:59 -07:00
Arjan van de Ven 53ff798e13 Merge pull request #246 from paulcarroty/patch-1
bring tests back to life
v3.2.10
2021-08-18 11:26:01 -07:00
Pavlo Rudy 8fc47f8d4e bring tests back to life 2021-07-10 17:13:04 +03:00
Arjan van de Ven d3f769f494 Merge pull request #238 from silkeh/add-btrfs-support
Add support for non-ext filesystems
2021-06-30 12:43:33 -07:00
Silke Hofstra 74dd4636e4 Add support for non-ext filesystems
Calling stat() on some filesystems, like Btrfs,
results in a dev_t with no relation to the backing device(s),
and subsequent failure to detect the root fs.

Add support such filesystems by retrieving the block device from
`/proc/self/mounts` and working on from there.

Resolves #61, #182 and #193.
2020-07-04 17:08:01 +02:00
Leandro Dorileo ab762315b6 OOM: add file and function name to OOM message
Signed-off-by: Leandro Dorileo <leandro.maciel.dorileo@intel.com>
2020-05-14 16:03:24 -07:00
Leandro Dorileo e969b2545c syslinux/extlinux: add timeout support
Make sure we honor users timeout configuration propagating it to config file when
running update command.

Signed-off-by: Leandro Dorileo <leandro.maciel.dorileo@intel.com>
2020-05-14 15:05:22 -07:00
Lucius Hu e7f856a428 completions: Update bash and zsh completions
- Added `--image` and `--no-efi-update` flags
- Minor changes in zsh script.
2020-05-05 22:06:06 -07:00
Leandro Dorileo b1141099b6 v3.2.9 release
Signed-off-by: Leandro Dorileo <leandro.maciel.dorileo@intel.com>
v3.2.9
2020-04-22 14:56:50 -07:00
Mark D Horn 453ecff9d7 probe: Add check for Software RAID root device
Software RAID does not see PARTUUID, so only use UUID.

Signed-off-by: Mark D Horn <mark.d.horn@intel.com>
2020-04-22 14:37:32 -07:00
Leandro Dorileo e5c4fad232 v3.2.8 release
Signed-off-by: Leandro Dorileo <leandro.maciel.dorileo@intel.com>
v3.2.8
2020-03-31 16:08:51 -07:00
Leandro Dorileo 4f0686abb1 systemd compatibility
With recent systemd changes cbm use cases will break if we don't add ".conf" to the
loader.conf default entry configuration.

Signed-off-by: Leandro Dorileo <leandro.maciel.dorileo@intel.com>
2020-03-31 15:41:15 -07:00
Leandro Dorileo 7aedefbc5c v3.2.7 release
Signed-off-by: Leandro Dorileo <leandro.maciel.dorileo@intel.com>
v3.2.7
2020-02-25 12:58:59 -08:00
Leandro Dorileo 44a7a599c9 extlinux/syslinux: fix set-kernel
Currently we can't set default kernel with extlinux/syslinux because we basically
the current implementation doesn't load the installed kernel data and when comparing
the detected ones to check with the selected kernel we'll use a data the set-kernel
command doesn't provide us. Long story short this patch brings to life the
set-kernel command for legacy bios mode bootloaders.

Signed-off-by: Leandro Dorileo <leandro.maciel.dorileo@intel.com>
2020-02-21 16:00:06 -08:00
Leandro Dorileo 8a412ee96d syslinux/extlinux: implement get default kernel operation
This will affact the list-kernels command that for now with legacy bios mode will
not list the actual default kernel(the one starting with *).

Signed-off-by: Leandro Dorileo <leandro.maciel.dorileo@intel.com>
2020-02-21 16:00:06 -08:00
Leandro Dorileo 82ea85da97 extlinux/syslinux: unify implementation
The biggest difference between extlinux and syslinux from cbm point of view is the
bootloaders install/update command. Having said that, This patch unifies the
syslinux and extlinux implementation reducing much of duplication on that side.

Signed-off-by: Leandro Dorileo <leandro.maciel.dorileo@intel.com>
2020-02-21 16:00:06 -08:00
Leandro Dorileo ba4fdd3440 extlinux: mark boot partition as legacy bios bootable
Make sure extlinux is consistent with syslinux and mark the boot partition as legacy
bios bootable.

Signed-off-by: Leandro Dorileo <leandro.maciel.dorileo@intel.com>
2020-02-18 15:58:03 -08:00
Leandro Dorileo c57bb34148 mkrelease: put together all the required steps before release
Make our life easier, put together all the required steps before cutting a new
release instead of having to remember it all.

Change the VERSION file, create the release commit and tag. Bonus point added a
--help flag so we can easily remember how this script works.

Signed-off-by: Leandro Dorileo <leandro.maciel.dorileo@intel.com>
2020-02-13 20:16:56 -08:00
Leandro Dorileo 42c2d4a0e0 v3.2.6 release
Signed-off-by: Leandro Dorileo <leandro.maciel.dorileo@intel.com>
2020-02-13 10:28:18 -08:00
Leandro Dorileo 2d9d985160 syslinux/extlinux: check if config file is empty
For some reason (may be a user manual intervention or some issue on previous
updates) the syslinux/extlinux config file may be empty and in that case cbm will
segfault when reading the content's buffer.

Signed-off-by: Leandro Dorileo <leandro.maciel.dorileo@intel.com>
v3.2.6
2020-02-12 11:08:00 -08:00
Leandro Dorileo 0f3c531ea8 syslinux: remove mtools dependency
By using syslinux-nomtools we don't depend on mtools and reduce the footprint for
smaller images.

Signed-off-by: Leandro Dorileo <leandro.maciel.dorileo@intel.com>
2020-02-12 11:08:00 -08:00