-
Notifications
You must be signed in to change notification settings - Fork 301
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Mirror some more efi variables to mok-variables #723
Open
vathpela
wants to merge
14
commits into
rhboot:main
Choose a base branch
from
vathpela:mirror-more-stuff
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ebc9189
to
188444f
Compare
Note that this is now on top of #660 |
This fixes some minor errors with the testing of how ALIGN() and similar are defined, and makes an explicit "ALIGN_UP()" macro to complement the existing ALIGN_DOWN() macro. Signed-off-by: Peter Jones <pjones@redhat.com>
This moves decls for errlog.c into errlog.h Signed-off-by: Peter Jones <pjones@redhat.com>
9e22a36
to
c269276
Compare
This changes our debug and error logging to save the entire logs into mok-variables as "shim-dbg.txt" and "shim-log.txt". Signed-off-by: Peter Jones <pjones@redhat.com>
Previously when there were no load options, this would go in the debug log: load-options.c:313:parse_load_options() full load options: include/hexdump.h:92:vhexdumpf() hexdump of a NULL pointer! This changes it to say: load-options.c:315:parse_load_options() LoadOptions is empty Signed-off-by: Peter Jones <pjones@redhat.com>
c269276
to
6fbdcd3
Compare
This changes get_mem_attrs() to return EFI_UNSUPPORTED if LibLocateProtocol() does not return an error but does give us a NULL pointer. Signed-off-by: Peter Jones <pjones@redhat.com>
This adds a mok variable flag "MOK_VARIABLE_CONFIG_ONLY" to specify that the data should be added to our UEFI config table, but shim should not create a legacy UEFI variable. Signed-off-by: Peter Jones <pjones@redhat.com>
This adds a member to the mok_state_variable struct to provide a callback function for formatting external data. It basically has snprintf()-like semantics for filling the buffer, but without the actual printf-like formatting bits. Signed-off-by: Peter Jones <pjones@redhat.com>
Currently when you've added a variable and not correctly changed the test cases to match, you get a message like: ./test-mok-mirror test-mok-mirror: setting variable sort policy to MOCK_SORT_DESCENDING test-mok-mirror: setting delete policy to MOCK_VAR_DELETE_ATTR_ALLOW_ZERO running test_mok_mirror_with_enough_space test_mok_mirror_with_enough_space: passed running test_mok_mirror_setvar_out_of_resources check_config_table:232:mok.name[0] 72 != test.name[0] 0 check_config_table:232:Assertion `mok_entry->name[0] == mock_entry->name[0]' failed. This adds another two lines: test-mok-mirror: Failed on entry 4 mok.name:"HSIStatus" mock.name:"" test-mok-mirror: Entry is missing in expected variable list. Or: test-mok-mirror: Failed on entry 4 mok.name:"" mock.name:"HSIStatus" test-mok-mirror: Entry is missing in found variable list. Which will usually tell you which variable you forgot to add that's present in test data, or what's missing in the test data and present in the expected data. Signed-off-by: Peter Jones <pjones@redhat.com>
This moves the EFI Memory Attribute Protocol helper functions to their own file, since they're not related to PE things. Signed-off-by: Peter Jones <pjones@redhat.com>
hughsie asked me if I can make shim tell userland what kinds of accesses are allowed to the heap, stack, and allocations on the running platform, so that these could be reported up through fwupd's Host Security ID program (see https://fwupd.github.io/libfwupdplugin/hsi.html ). This adds a new config-only (i.e. not a UEFI variable) variable generated during boot, "/sys/firmware/efi/mok-variables/HSIStatus", which tells us those properties as well as if the EFI Memory Attribute Protocol is present. Signed-off-by: Peter Jones <pjones@redhat.com>
This debug printf in our mock variable test code, which isn't normally enabled, has a missing comma at the end of the format specifier. This causes __FILE__ to be part of the format specifier, which then means we've got a missing parameter and also the types don't match up like you'd hope. This causes the most confusing segfaults. Signed-off-by: Peter Jones <pjones@redhat.com>
This changes test-mock-variables and related code to not print all debug messages at SHIM_DEBUG=1, and also adds some prints and comments for context as to what's going on in the tests. Signed-off-by: Peter Jones <pjones@redhat.com>
Previously the mok mirror state flags were only used in the mok mirroring code. But there are other consumers of that data, namely our variable test cases, and it's useful for them to be able to check the flags. Signed-off-by: Peter Jones <pjones@redhat.com>
Some machines have EFI Boot Services variables but not Runtime variables, and thus it can be quite difficult to figure out what's going on once the system is booted. This changes mok variable mirroring to also mirror the following variables to the mok variable config table: AuditMode BootOrder BootCurrent BootNext Boot0000 Boot0001 Boot0002 Boot0003 Boot0004 Boot0005 Boot0006 DeployedMode SecureBoot SetupMode SignatureSupport Timeout PK KEK db dbx Kernel_SkuSiStatus There's no attempt to do anything involving creating runtime or boot-services only variables, it just mirrors them into the config table so they'll be exposed there. Signed-off-by: Peter Jones <pjones@redhat.com>
6fbdcd3
to
33410e0
Compare
jsetje
approved these changes
Feb 21, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if we want some way to disable the mirroring entirely. Something like MOK_VARIABLE_NOTHING ? I certainly don't want this by default, but some light memory only configs might want to be able to save the space.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Some machines have EFI Boot Services variables but not Runtime variables, and thus it can be quite difficult to figure out what's going on once the system is booted.
This changes mok variable mirroring to also mirror the following variables to the mok variable config table:
There's no attempt to do anything involving creating runtime or boot-services only variables, it just mirrors them into the config table so they'll be exposed there.