Skip to content
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

Don't set user_insecure_mode and ignore_db in import_one_mok_state #362

Closed
wants to merge 1 commit into from

Conversation

AdamWill
Copy link
Contributor

@AdamWill AdamWill commented Apr 9, 2021

This seems completely incorrect and unnecessary, unless I'm
missing something. We already set them both to 0 at the start of
import_mok_state, which is the only thing that uses
import_one_mok_state, so it's unnecessary. It's incorrect
because it means those variables will be set to 0 even when they
should be set to 1 - even if they are momentarily set to 1 when
import_one_mok_state is called on the relevant variable, they
immediately get set back to 0 when it's called on the next
variable.

Signed-off-by: Adam Williamson awilliam@redhat.com

This seems completely incorrect and unnecessary, unless I'm
missing something. We already set them both to 0 at the start of
`import_mok_state`, which is the only thing that uses
`import_one_mok_state`, so it's unnecessary. It's incorrect
because it means those variables will be set to 0 even when they
should be set to 1 - even if they are momentarily set to 1 when
`import_one_mok_state` is called on the relevant variable, they
immediately get set back to 0 when it's called on the *next*
variable.

Signed-off-by: Adam Williamson <awilliam@redhat.com>
@AdamWill
Copy link
Contributor Author

AdamWill commented Apr 9, 2021

Note I am absolutely not a C or SB or EFI expert and this may be wildly and terribly wrong, please check it carefully. But it's my guess as to what causes the problem I hit with 15.4 (my system doesn't boot with SB enabled; with 15 it boots after briefly showing a "Booting in insecure mode" message) and what might solve it. See https://bodhi.fedoraproject.org/updates/FEDORA-2021-cab258a413 . I don't think I can test this without figuring out how to do key enrolment and stuff, because I can't do a properly signed build of shim...

@martinezjavier
Copy link
Contributor

martinezjavier commented Apr 9, 2021

@AdamWill yes, I think you are correct and your patch will fix the issue. I was also able to reproduce the issue with Qemu and OVMF, basically did the following:

1) Enable SB support in firmware settings
2) Run mokutil --disable-validation and reboot
3) shim 15 boots correctly with SB validation disabled
4) Update to shim shim 15.4 and reboot
5) shim 15.4 fails to boot and prints this message:
      Bootloader has not verified loaded image.
      System is compromised.  halting.

@aburmash
Copy link
Collaborator

aburmash commented Apr 9, 2021

Can confirm, issue is not Fedora specific and is clearly caused by the code piece reported. With validation disabled shim still tries to validate the binaries it boots.

@vathpela
Copy link
Contributor

vathpela commented Apr 9, 2021

I've pushed this to main as 822d07a.

@vathpela vathpela closed this Apr 9, 2021
@AdamWill
Copy link
Contributor Author

AdamWill commented Apr 9, 2021

thanks for improving the commit message!

@steve-mcintyre
Copy link
Collaborator

Problem and fix tested and confirmed locally for me too

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants