Bug 1292615 - Double free when kernel does not match EFI secure boot keys
Double free when kernel does not match EFI secure boot keys
Status: ON_QA
Product: Fedora
Classification: Fedora
Component: grub2 (Show other bugs)
25
x86_64 Linux
unspecified Severity unspecified
: ---
: ---
Assigned To: Peter Jones
Fedora Extras Quality Assurance
:
: 1317680 (view as bug list)
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2015-12-17 17:50 EST by Linus Torvalds
Modified: 2016-12-11 16:54 EST (History)
14 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed:
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Linus Torvalds 2015-12-17 17:50:29 EST
Description of problem:

I updated my main desktop to a Skylake CPU on an ASUS motherboard. Fedora 23 installed fine, although with the old kernel it uses the GPU isn't getting the loving it needs by default. 

However, when I then built my own kernel, grub2 failed to load it with a incomprehensible error message:

  double free at 0x616f5760
  Aborted. Press any key to exit.

which is obviously not very useful information.

It turns out that this is triggered by the fact that the ASUS motherboard comes with secure boot enabled, and I had forgotten to remove the keys for that.

But rather than report a key failure that would have informed me of my mistake, grub2 just screwed up entirely, and made the error rather obscure.

Version-Release number of selected component (if applicable):

grub2-tools-2.02-0.25.fc23.x86_64

How reproducible:

It seems to be 100% reproducible given the setup: secure boot enabled, but an unsigned kernel.

Steps to Reproduce:
1. Install current F23
2. Build your own kernel
3. Profit

Actual results:

Confusing internal failure at the boot loader stage.

Expected results:

"The selected kernel is nor signed by the system keys" or similar.

Additional info:

Motherboard: ASUS Z179-K
BIOS is the ASUS version of an AMI BIOS with UEFI.
Everything works fine once secure boot has been disabled.
Comment 1 Linus Torvalds 2015-12-23 13:58:46 EST
Also reported this upstream to the grub2 people, but they point out that the whole secure boot infrastructure is a RH addition, and hasn't been merged upstream yet.

So it's all on you guys.

Btw, how do I change the severity? This is actually pretty bad, because with the combination of 

 (a) the Fedora 23 4.2-based kernel is unusable on modern PC's due to Skylake graphics going into some old VGA-only mode

 (b) building your own kernel results in people thinking they did something wrong

most modern machines you buy today will be considered "doesn't work well with Fedora".
Comment 2 Brian Lane 2016-03-14 17:24:36 EDT
*** Bug 1317680 has been marked as a duplicate of this bug. ***
Comment 3 Adam Williamson 2016-04-14 11:51:40 EDT
There's another current double free bug:

https://bugzilla.redhat.com/show_bug.cgi?id=1313048

not sure if it's the same one, I would've figured that kernel would be signed (from the screenshot it looks like he was booting a Fedora kernel), but perhaps not.
Comment 4 Thorsten Leemhuis 2016-05-19 03:47:32 EDT
Saw this problem again on a F23 machine and notice this might be a dupe of Bug 1278508 – at least the latter comments in that report indicate the problem only happens when booting unsigned/non-trusted kernels on a Secure Boot enabled system. That alone is bad already, but due to Bug 1334628 you afaics can't easily disable the secure boot restriction via mokutil currently :-/
Comment 5 Jim Cromie 2016-07-03 09:18:18 EDT
me too.
but in my case, theres only the 1st line, no "press any key to continue"
I have to power cycle the laptop.

hex-number is different for each rcX kernel I tried,
dunno if it changes on each boot.

FWIW, I installed fc24 beta on a brand new laptop,
on 6/6/16 (at least thats the datestamp here)
-rw-------. 1 root root 1229 Jun  6 17:44 anaconda-ks.cfg

model name	: Intel(R) Core(TM) i7-6700HQ CPU @ 2.60GHz
Comment 6 Levente Farkas 2016-11-20 15:17:04 EST
the same happened with me with the latest fedora 24 :
kernel-core-4.8.8-200.fc24.x86_64
shim-0.8-9.x86_64
efibootmgr-14-3.fc24.x86_64
efivar-libs-30-4.fc24.x86_64
grub2-efi-2.02-0.34.fc24.x86_64

centos 7.2:
kernel-3.10.0-327.36.3.el7.x86_64
shim-0.9-2.el7.x86_64
efibootmgr-0.8.0-7.el7.x86_64
efivar-libs-0.11-1.el7.x86_64
grub2-efi-2.02-0.34.el7.centos.x86_64

I can boot from bios (ie select centos or fedora), but when I try to use fedora's grub2 and regenerate the fedora's grub.cfg to include centos in it's menu ie:
grub2-mkconfig -o /boot/efi/EFI/fedora/grub.cfg

then I'm not able to boot centos through fedora's grub. the only thing i've got is a double free.

ps. anyway it's my Asus UX360UA laptop with UEFI boot and secure boot enabled.
Comment 7 Fedora End Of Life 2016-11-24 09:18:59 EST
This message is a reminder that Fedora 23 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 23. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as EOL if it remains open with a Fedora  'version'
of '23'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora 23 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora, you are encouraged  change the 'version' to a later Fedora 
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.
Comment 8 Levente Farkas 2016-11-24 10:06:12 EST
it's still happened in fedora 25.
Comment 9 Peter Jones 2016-12-06 14:55:54 EST
Can somebody verify if the update here fixes this: https://bodhi.fedoraproject.org/updates/FEDORA-2016-ee4d91769e ?  I believe it will.
Comment 10 Levente Farkas 2016-12-07 08:44:51 EST
it's better. ie not double free. BUT if I put the bios into secure boot enable state then i've got "invalid signature". I try to dual boot on my laptop centos and fedora from fedora's grub2 AND also enable secure boot. probably in this case fedora only see fedora's key but not centos key (but i don't know how it's working). but it's still seems not possible.
without secure boot enable it's working.
Comment 11 Fedora Update System 2016-12-07 09:35:44 EST
grub2-2.02-0.35.fc24 has been submitted as an update to Fedora 24. https://bodhi.fedoraproject.org/updates/FEDORA-2016-a098b75b13
Comment 12 Fedora Update System 2016-12-07 23:53:14 EST
grub2-2.02-0.35.fc24 has been pushed to the Fedora 24 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2016-a098b75b13
Comment 13 Fedora Update System 2016-12-08 10:56:39 EST
grub2-2.02-0.38.fc24 has been submitted as an update to Fedora 24. https://bodhi.fedoraproject.org/updates/FEDORA-2016-a098b75b13
Comment 14 Fedora Update System 2016-12-08 14:23:13 EST
grub2-2.02-0.38.fc24 has been pushed to the Fedora 24 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2016-a098b75b13
Comment 15 Fedora Update System 2016-12-11 16:54:26 EST
grub2-2.02-0.38.fc24 has been pushed to the Fedora 24 stable repository. If problems still persist, please make note of it in this bug report.

Note You need to log in before you can comment on or make changes to this bug.