Commit Graph

27 Commits

Author SHA1 Message Date
Steve McIntyre
fd2d9f032c New upstream version 15.8 2024-05-03 16:02:10 +01:00
Steve McIntyre
e6ace38abd New upstream version 15.6 2022-06-23 00:16:56 +01:00
Steve McIntyre
8529e0f7f7 New upstream version 15.5 2022-04-27 22:41:59 +01:00
Steve McIntyre
031e5cce38 New upstream version 15.3 2021-03-23 23:49:46 +00:00
Mathieu Trudel-Lapierre
f892ac6608 New upstream version 15+1531942534.dd3230d 2018-07-24 16:24:23 -04:00
Mathieu Trudel-Lapierre
ab881f03a3 New upstream version 12+1503074702.5202f80 2017-08-29 13:55:31 -04:00
Mathieu Trudel-Lapierre
f4173af1ad New upstream version 12+1501864225.b586175 2017-08-07 17:34:45 -04:00
Mathieu Trudel-Lapierre
62f0afa2ec Import upstream version 0.9+1474479173.6c180c6 2016-09-21 20:29:42 -04:00
Mathieu Trudel-Lapierre
d3819813b8 Import upstream version 0.9+1465500757.14a5905 2016-07-26 12:02:18 -04:00
Gary Ching-Pang Lin
8bf83b55dc [fallback] Try to boot the first boot option anyway
Some UEFI implementations never care the boot options, so the
restored boot options could be just ignored and this results in
endless reboot. To avoid this situation, this commit makes
fallback.efi to load the first matched boot option even if there
is no boot option to be restored. It may not be perfect, but at
least the bootloader is loaded...

Signed-off-by: Gary Ching-Pang Lin <glin@suse.com>
2014-05-13 13:30:07 -04:00
Gary Ching-Pang Lin
30cead3b40 [fallback] Fix the data size for boot option comparison
Signed-off-by: Gary Ching-Pang Lin <glin@suse.com>
2014-05-13 13:24:12 -04:00
Gary Ching-Pang Lin
ec7eddbf05 [fallback] Avoid duplicate old BootOrder
set_boot_order() already copies the old BootOrder to the variable,
bootorder. Besides, we can adjust BootOrder when adding the newly
generated boot option. So, we don't have to copy the old one again
in update_boot_order(). This avoid the duplicate entries in BootOrder.

Signed-off-by: Gary Ching-Pang Lin <glin@suse.com>
2014-05-13 13:23:41 -04:00
Kees Cook
47a9d2c908 additional bounds-checking on section sizes
This adds additional bounds-checking on the section sizes. Also adds
-Wsign-compare to the Makefile and replaces some signed variables with
unsigned counteparts for robustness.

Signed-off-by: Kees Cook <kees@ubuntu.com>
2014-04-11 14:41:22 -04:00
Peter Jones
9fcd221ef1 [fallback] Attempt to re-use existing entries when possible.
Some firmwares seem to ignore our boot entries and put their fallback
entries back on top.  Right now that results in a lot of boot entries
for our stuff, a la https://bugzilla.redhat.com/show_bug.cgi?id=995834 .

Instead of that happening, if we simply find existing entries that match
the entry we would create and move them to the top of the boot order,
the machine will continue to operate in failure mode (which we can't
avoid), but at least we won't create thousands of extra entries.

Signed-off-by: Peter Jones <pjones@redhat.com>
2014-01-31 10:31:10 -05:00
Peter Jones
6edc6ec0a3 [fallback] For HD() device paths, use just the media node and later.
UEFI 2.x section 3.1.2 provides for "short-form device path", where the
first element specified is a "hard drive media device path", so that you
can move a disk around on different buses without invalidating your
device path.  Fallback has not been using this option, though in most
cases efibootmgr has.

Note that we still keep the full device path, because LoadImage()
isn't necessarily the layer where HD() works - one some systems BDS is
responsible for resolving the full path and passes that to LoadImage()
instead.  So we have to do LoadImage() with the full path.
2014-01-31 10:30:36 -05:00
Peter Jones
dd77b3447c Rewrite directory traversal allocation path so coverity can grok it.
The things we do for our tools.  In this case, make the AllocatePool()
happen outside of a conditional, even though that conditional will
always bee satisfied.  This way coverity won't think we're setting fi
to NULL and passing it to StrCaseCmp.

Signed-off-by: Peter Jones <pjones@redhat.com>
2013-11-21 11:48:24 -05:00
Andrew Boie
2c5f9938ad fallback.c: fix 32-bit compilation
fh->Read expects pointer to 32-bit int, use UINTN

Change-Id: If1a728efd51a9a24dfcd8123e84bf4c0713491fe
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2013-11-12 10:30:02 -05:00
Peter Jones
35b0b55b3e Fix some minor type errors.
Signed-off-by: Peter Jones <pjones@redhat.com>
2013-05-15 13:37:15 -04:00
Peter Jones
40cf2a423d Pass parameters correctly when booting.
Signed-off-by: Peter Jones <pjones@redhat.com>
2013-05-14 13:10:52 -04:00
Peter Jones
8807e36aae [fallback] Try to execute the first new boot option.
I'm told rebooting is sometimes unreliable when called here, and we'll
get bootx64.efi loaded anyway.  I'll just assume that's true and try to
load the first option, since it's clearly what we'd prefer happens next.

Signed-off-by: Peter Jones <pjones@redhat.com>
2013-05-02 14:58:44 -04:00
Peter Jones
4f80140b53 Explain byte order handling better.
Signed-off-by: Peter Jones <pjones@redhat.com>
2013-04-30 14:21:41 -04:00
Gary Ching-Pang Lin
39baf6dff7 Don't update BootOrder until all csv files are processed 2013-04-30 09:46:23 -04:00
Gary Ching-Pang Lin
117b1214d8 Reset the system after restoring the boot entries 2013-04-30 09:46:23 -04:00
Gary Ching-Pang Lin
17266fd057 Fix crash due to memory allocation 2013-04-30 09:46:23 -04:00
Peter Jones
404e126344 Get rid of extra "continue".
It's confusing, and it doesn't actually accomplish anything when applied
to *either* loop.

Signed-off-by: Peter Jones <pjones@redhat.com>
2013-04-30 09:46:22 -04:00
Peter Jones
e172354b7e Fix error checking on AllocateZeroPool() in update_boot_order()
Signed-off-by: Peter Jones <pjones@redhat.com>
2013-04-30 09:46:22 -04:00
Peter Jones
eb9f7f1c23 Add a fallback loader for when shim is invoked as BOOTX64.EFI
If shim is invoked as \EFI\BOOT\BOOT*.EFI and a file exists named
\EFI\BOOT\FALLBACK.EFI, try it instead of our second stage.  So don't
put fallback.efi on your install media in \EFI\BOOT, because that won't
do whatever it is you're hoping for, unless you're hoping not to start
the installer.

So here's the process for using this:
in /EFI/fedora/ (or whichever directory you happen to own), you put:
  shim.efi
  grub.efi
  boot.csv - format is: shim.efi,Nice Label,cmdline arguments,comments
           - filenames refer only to files in this directory, with no
	     leading characters such as L"./" or L"/EFI/fedora/"
           - note that while this is CSV, the character encoding is
	     UCS-2

and if /EFI/BOOT/BOOTX64.EFI doesn't already exist, then in /EFI/BOOT:
  shim.efi as BOOTX64.EFI
  fallback.efi

Signed-off-by: Peter Jones <pjones@redhat.com>
2013-04-30 09:46:22 -04:00