mirror of
https://github.com/edera-dev/sprout.git
synced 2026-11-04 19:02:20 +00:00
fix(shim): don't overwrite original handlers when already hooked
If the security hook was installed while already installed, the protocols contained Sprout's own handlers, which were then saved as the "original" handlers. A verification failure would then call back into the hook forever. Keep the existing saved state in that case.
This commit is contained in:
1 parent
ad37a2bcf3
commit
bcc78fd4a3
1 file changed
+7
@@ -216,6 +216,13 @@ impl SecurityHook {
|
||||
|
||||
// Acquire the lock to the global state and replace it.
|
||||
let mut global_state = GLOBAL_HOOK_STATE.lock();
|
||||
|
||||
// If the hook is already installed, the protocols contain our hooks.
|
||||
// Storing them as the original hooks would cause infinite recursion on
|
||||
// verification failure, so keep the existing state instead.
|
||||
if global_state.is_some() {
|
||||
return Ok(true);
|
||||
}
|
||||
global_state.replace(state);
|
||||
|
||||
// Install the hooks into the UEFI stack.
|
||||
|
||||
Reference in new issue
Block a user