| Summary: | efivar: Cannot write to EFI variables which have a '-' in their name | ||||||
|---|---|---|---|---|---|---|---|
| Product: | Base System | Reporter: | probono | ||||
| Component: | bin | Assignee: | Warner Losh <imp> | ||||
| Status: | Closed FIXED | ||||||
| Severity: | Affects Some People | CC: | emaste, grahamperrin, imp, markj, yuripv | ||||
| Priority: | --- | Keywords: | needs-qa | ||||
| Version: | 12.1-RELEASE | Flags: | imp:
mfc-stable13+
|
||||
| Hardware: | Any | ||||||
| OS: | Any | ||||||
| URL: | https://reviews.freebsd.org/D29620 | ||||||
| Attachments: |
|
||||||
|
Description
probono
2020-11-10 20:15:20 UTC
Looking at the error message and breakdown_name() in usr.sbin/efivar/efivar.c, this rather looks like "efivar cannot write to EFI variables which have a '-' in their name". If you look at the code linked below, the issue is quite obvious -- we use strrchr() to find the end of GUID, and in this case it's not correct: https://svnweb.freebsd.org/base/head/usr.sbin/efivar/efivar.c?revision=366165&view=markup#l87 This needs a better way of distinguishing between GUID and var name. Created attachment 219556 [details]
possible fix using regex to match guid part
Possible fix using regex to match guid part. Doing comp/free every time breakdown_name() is called should not be too expensive.
OR, we could do a cp = name + 36 (guid len) and be done with it as it looks like guid is checked somewhere else anyway :) Confirm, thuis Is there a way to compile the patched version without needing to download and/or compile the entire FreeBSD source? (In reply to probono from comment #5) usr.sbin/efivar has a Makefile [1] so one should be able to make install in that directory after patching to install just that component. [1] https://svnweb.freebsd.org/base/head/usr.sbin/efivar/Makefile?revision=326472&view=markup The proposed patch isn't quite right. You can specify names as well as UUIDs and there's a table lookup for those names. https://reviews.freebsd.org/D29620 has my proposed alternate fix that doesn't break the name lookup. Thank you very much, highly appreciated. ^Triage: Re-open to request MFH Thank you for re-opening. I'd like to request merge to stable/13 and stable/12 branches, for future releases to include the change. Thanks! ^Triage: committed back in 2022. Only mfc-stable13 now applies. already MFC'd to 13, will be in 13.3 |