Page MenuHomeFreeBSD

libefivar: more glabel support
AbandonedPublic

Authored by asomers on Feb 15 2023, 6:39 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sep 26 2024, 3:32 PM
Unknown Object (File)
Sep 26 2024, 3:29 PM
Unknown Object (File)
Sep 25 2024, 7:11 PM
Unknown Object (File)
Sep 20 2024, 7:35 PM
Unknown Object (File)
Aug 8 2024, 5:28 AM
Unknown Object (File)
Jun 24 2024, 5:56 AM
Unknown Object (File)
May 22 2024, 4:03 PM
Unknown Object (File)
Apr 25 2024, 1:51 PM
Subscribers
None

Details

Reviewers
imp
corvink
Summary

In efivar_device_path_to_unix_path, prefer returning a glabel over a
partition. This fixes "efibootmgr -Ep" when the efi partition is
mounted by label.

PR: 269564
Reported by: corvink
MFC after: 3 days
Sponsored by: Axcient

Test Plan

manually tested with "efibootmgr -pE" and "efivar -Op 8be4df61-93ca-11d2-aa0d-00e098032b8c-Boot0014" on a system that uses UEFI and mounts the boot partition by its partition label.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 49808
Build 46699: arc lint + arc unit

Event Timeline

asomers created this revision.
imp requested changes to this revision.Feb 15 2023, 7:51 PM

Why prefer a glabel? There's no requirement that it be used for the mount point, so this introduces a bug where there IS a label, but the label isn't used, I believe.

I think this is not such a good way to go.
https://reviews.freebsd.org/D38614
has a much better way, imho, and the patch series fixes a number of other bugs with it. I think that one fix will address this issue.

lib/libefivar/efivar-dp-xlate.c
112

there's already code to find the class, so you don't need to iterate like this.
Also, != 0 continue would have produced less indentaiton.

This revision now requires changes to proceed.Feb 15 2023, 7:51 PM

hmmm, the posted review isn't quite enough for this case.

https://reviews.freebsd.org/D38614 won't solve the original problem that Corvin described in PR 269564. The find_geom_efimedia function doesn't even get executed by "efibootmgr -pE". Are you planning to fix that?

https://reviews.freebsd.org/D38614 won't solve the original problem that Corvin described in PR 269564. The find_geom_efimedia function doesn't even get executed by "efibootmgr -pE". Are you planning to fix that?

Right. this won't either when there are multiple labels if you pick the wrong one first. I'm working on a fix...

https://reviews.freebsd.org/D38619 should do the trick. It worked for all the cases I could throw at it, including creating a new label on the fly in /dev/label to mount the ESP on, mounting via msdos label, mounting via gpt label and mounting the raw device. It also removes some bogus code I wrote when I only thought I understood how geom worked...