grub.git
8 years agoxen_boot: Remove obsolete module type distinctions.
Vladimir Serbinenko [Fri, 22 Jan 2016 09:18:47 +0000 (10:18 +0100)]
xen_boot: Remove obsolete module type distinctions.

8 years agoarm: Ignore qemu clock bug
Vladimir Serbinenko [Fri, 8 Jan 2016 15:22:47 +0000 (16:22 +0100)]
arm: Ignore qemu clock bug

8 years agoi386-ieee1275: Increase maximum heap size to accomodate highres graphi tests
Vladimir Serbinenko [Fri, 8 Jan 2016 15:22:19 +0000 (16:22 +0100)]
i386-ieee1275: Increase maximum heap size to accomodate highres graphi tests

8 years agoRemove pragmas related to -Wunreachable-code
Colin Watson [Wed, 20 Jan 2016 15:56:55 +0000 (15:56 +0000)]
Remove pragmas related to -Wunreachable-code

-Wunreachable-code has been a no-op since GCC 4.5; GRUB hasn't been
compiled with it since 2012; and GCC 6 produces "error:
'-Wunreachable-code' is not an option that controls warnings" for these.

Fixes Debian bug #812047.

8 years agoloader/bsd: Fix signed/unsigned comparison
Colin Watson [Sat, 16 Jan 2016 20:40:55 +0000 (20:40 +0000)]
loader/bsd: Fix signed/unsigned comparison

8 years agoahci, ehci: Fix typos
Colin Watson [Sat, 16 Jan 2016 20:37:15 +0000 (20:37 +0000)]
ahci, ehci: Fix typos

8 years agogrub-probe: fix memory leak
Andrei Borzenkov [Sat, 16 Jan 2016 18:47:28 +0000 (21:47 +0300)]
grub-probe: fix memory leak

Found by: Coverity scan.
CID: 73783

8 years agotftp: fix memory leaks in open
Andrei Borzenkov [Sat, 16 Jan 2016 18:27:57 +0000 (21:27 +0300)]
tftp: fix memory leaks in open

If protocol open fails, file is immediately freed, so data was leaked.

Found by: Coverity scan.
CID: 96659

8 years agotcp: fix memory leaks
Andrei Borzenkov [Sat, 16 Jan 2016 17:59:50 +0000 (20:59 +0300)]
tcp: fix memory leaks

Found by: Coverity scan.
CID: 96639, 96647

8 years agonet: fix memory leaks
Andrei Borzenkov [Sat, 16 Jan 2016 17:48:33 +0000 (20:48 +0300)]
net: fix memory leaks

Found by: Coverity scan.
CID: 96638, 96648

8 years agolegacycfg: fix memory leaks and add NULL check
Andrei Borzenkov [Sat, 16 Jan 2016 17:34:02 +0000 (20:34 +0300)]
legacycfg: fix memory leaks and add NULL check

Memory leaks found by Coverity scan.
CID: 96642, 96645

8 years agoloader: Unintended sign extension
Andrei Borzenkov [Wed, 13 Jan 2016 17:15:07 +0000 (20:15 +0300)]
loader: Unintended sign extension

CID: 96707, 96699, 96693, 96691, 96711, 96709, 96708, 96703, 96702,
96700, 96698, 96696, 96695, 96692, 96710, 96705

8 years agoscript: fix memory leak
Andrei Borzenkov [Tue, 12 Jan 2016 19:50:30 +0000 (22:50 +0300)]
script: fix memory leak

Found by: Coverity scan.
CID: 96637

8 years agonormal: fix memory leak
Andrei Borzenkov [Tue, 12 Jan 2016 19:36:53 +0000 (22:36 +0300)]
normal: fix memory leak

Found by: Coverity scan.
CID: 96641, 96670, 96667

8 years agoxnu: fix memory leak
Andrei Borzenkov [Tue, 12 Jan 2016 18:43:43 +0000 (21:43 +0300)]
xnu: fix memory leak

Found by: Coverity scan.
CID: 96663

8 years agotruecrypt: fix memory leak
Andrei Borzenkov [Tue, 12 Jan 2016 18:41:48 +0000 (21:41 +0300)]
truecrypt: fix memory leak

Found by: Coverity scan.
CID: 156611

8 years agogfxmenu: fix memory leak
Andrei Borzenkov [Tue, 12 Jan 2016 18:33:34 +0000 (21:33 +0300)]
gfxmenu: fix memory leak

Found by: Coverity scan.
CID: 96657

8 years agoefiemu: fix memory leak
Andrei Borzenkov [Tue, 12 Jan 2016 18:25:40 +0000 (21:25 +0300)]
efiemu: fix memory leak

Found by: Coverity scan.
CID: 156610

8 years agoefidisk: fix memory leak
Andrei Borzenkov [Tue, 12 Jan 2016 18:16:34 +0000 (21:16 +0300)]
efidisk: fix memory leak

Found by: Coverity scan.
CID: 96644

8 years agoverify: fix memory leak
Andrei Borzenkov [Tue, 12 Jan 2016 18:10:12 +0000 (21:10 +0300)]
verify: fix memory leak

Found by: Coverity scan.
CID: 96643

8 years agopassword_pbkdf2: fix memory leak
Andrei Borzenkov [Tue, 12 Jan 2016 17:53:26 +0000 (20:53 +0300)]
password_pbkdf2: fix memory leak

Found by: Coverity scan.
CID: 96656

8 years agoparttool: fix memory leak
Andrei Borzenkov [Tue, 12 Jan 2016 17:41:44 +0000 (20:41 +0300)]
parttool: fix memory leak

Found by: Coverity scan.
CID: 96652

8 years agonativedisk: fix memory leak
Andrei Borzenkov [Tue, 12 Jan 2016 17:37:43 +0000 (20:37 +0300)]
nativedisk: fix memory leak

Based on Coverity scan.
CID: 96660

Extended to also cover other error return places.

8 years agoacpi: fix memory leak
Andrei Borzenkov [Tue, 12 Jan 2016 17:26:30 +0000 (20:26 +0300)]
acpi: fix memory leak

Found by: Coverity scan.
CID: 96673

8 years agogrub-install: include ehci in list of native modules
Andrei Borzenkov [Sun, 10 Jan 2016 13:08:06 +0000 (16:08 +0300)]
grub-install: include ehci in list of native modules

This matches behavior of "nativedisk" command.

Reported and tested by Smith Henry <sh37092@gmail.com>

8 years agogrub-mkimage: remove redundant NULL check
Andrei Borzenkov [Sun, 10 Jan 2016 08:51:34 +0000 (11:51 +0300)]
grub-mkimage: remove redundant NULL check

Found by: Coverity scan.
CID: 73737

8 years agonet: remove dead and redundant code
Andrei Borzenkov [Sun, 10 Jan 2016 08:33:13 +0000 (11:33 +0300)]
net: remove dead and redundant code

server cannot be NULL at this point (we return error earlier if it is).
Also structure is zalloc'ed, so no need to explicitly initialize
members to 0.

Found by: Coverity scan.
CID: 73837

8 years agohostdisk: fix device detection
Andrei Borzenkov [Sun, 10 Jan 2016 07:41:04 +0000 (10:41 +0300)]
hostdisk: fix device detection

Condition was apparently reversed so GRUB assumed all devices were
files. This later made it skip BLKFLSBUF ioctl on Linux which caused
various page cache coherency issues. Observed were

- failure to validate blocklist install (read content did not match
  just written)

- failure to detect Linux MD on disk after online hot addition
  (GRUB got stale superblock)

Closes: 46691

8 years agosetup: fix NULL pointer dereference
Andrei Borzenkov [Sat, 9 Jan 2016 18:25:22 +0000 (21:25 +0300)]
setup: fix NULL pointer dereference

Check return value of grub_guess_root_devices

Found by: Coverity scan.
CID: 73638, 73751

8 years agomkimage: fix unintended sign extension
Andrei Borzenkov [Sat, 9 Jan 2016 18:05:44 +0000 (21:05 +0300)]
mkimage: fix unintended sign extension

Found by: Coverity scan.
CID: 73691, 73717

8 years agoutil/getroot: delete dead code
Andrei Borzenkov [Sat, 9 Jan 2016 17:54:54 +0000 (20:54 +0300)]
util/getroot: delete dead code

is_part cannot be non-zero at this point.

Found by: Coveruty scan.
CID: 73838

8 years agoloader/multiboot: fix unintended sign extension
Andrei Borzenkov [Sat, 9 Jan 2016 16:58:51 +0000 (19:58 +0300)]
loader/multiboot: fix unintended sign extension

Found by: Coveruty scan.
CID: 73700, 73763

8 years agokern/elf: fix unintended sign extension
Andrei Borzenkov [Sat, 9 Jan 2016 16:41:26 +0000 (19:41 +0300)]
kern/elf: fix unintended sign extension

Found by: Coverity scan.
CID: 73729, 73735, 73758, 73760

8 years agoxfs: fix possible inode corruption in directory scan
Andrei Borzenkov [Sat, 9 Jan 2016 15:55:55 +0000 (18:55 +0300)]
xfs: fix possible inode corruption in directory scan

grub_xfs_iterate_dir did not restore first character after inline
name when match was found. Dependning on XFS format this character
could be inode number and we could return to the same node later in
find_file if processing cycled symlinks.

CID: 86724

8 years agorescue_parser: restructure code to avoid Coverity false positive
Andrei Borzenkov [Sat, 9 Jan 2016 15:15:27 +0000 (18:15 +0300)]
rescue_parser: restructure code to avoid Coverity false positive

If line contains single word, line and argv[0] are aliases, so
no NULL dereference is possible, but Coverity does not know it.
Change code to avoid ambiguity and also remove redundant call to
grub_strchr.

CID: 86725

8 years agogrub-mklayout: check subscript bounds
Andrei Borzenkov [Sat, 9 Jan 2016 11:13:36 +0000 (14:13 +0300)]
grub-mklayout: check subscript bounds

Found by: Coverity scan.
CID: 73686

8 years agogrub-probe: fix memory leak
Andrei Borzenkov [Sat, 9 Jan 2016 10:49:37 +0000 (13:49 +0300)]
grub-probe: fix memory leak

Found by: Coverity scan.
CID: 73783

8 years agogfxmenu: fix memory leak
Andrei Borzenkov [Sat, 9 Jan 2016 10:43:04 +0000 (13:43 +0300)]
gfxmenu: fix memory leak

Found by: Coverity scan.
CID: 73766

8 years agoutil/setup: fix grub_util_path_list leak
Andrei Borzenkov [Sat, 9 Jan 2016 10:28:42 +0000 (13:28 +0300)]
util/setup: fix grub_util_path_list leak

Add helper grub_util_free_path_list and use it where appropriate.

Found by: Coverity scan.
CID: 73727

8 years agosetup: fix memory leak
Andrei Borzenkov [Sat, 9 Jan 2016 10:10:10 +0000 (13:10 +0300)]
setup: fix memory leak

Found by: Coverity scan.
CID: 73680, 73715

8 years agoefiemu: check return value of grub_efiemu_write_value
Andrei Borzenkov [Sat, 9 Jan 2016 08:05:33 +0000 (11:05 +0300)]
efiemu: check return value of grub_efiemu_write_value

Found by: Coverity scan.
CID: 73590

8 years agoefiemu: change code to avoid Coverity false positive
Andrei Borzenkov [Sat, 9 Jan 2016 07:59:51 +0000 (10:59 +0300)]
efiemu: change code to avoid Coverity false positive

CID: 73623

8 years agoefiemu: fix unintended sign extension
Andrei Borzenkov [Sat, 9 Jan 2016 07:53:31 +0000 (10:53 +0300)]
efiemu: fix unintended sign extension

Found by: Coverity scan.
CID: 73883, 73637

8 years agohfs: fix memory leak
Andrei Borzenkov [Fri, 8 Jan 2016 08:16:56 +0000 (11:16 +0300)]
hfs: fix memory leak

Found by: Coverity scan.
CID: 156531

8 years agogrub-module-verifier: fix unintended sign extension
Andrei Borzenkov [Fri, 8 Jan 2016 08:05:16 +0000 (11:05 +0300)]
grub-module-verifier: fix unintended sign extension

Found by: Coverity scan.
CID: 156533, 156532

8 years agoTests: Support arm-efi
Vladimir Serbinenko [Fri, 8 Jan 2016 08:49:08 +0000 (09:49 +0100)]
Tests: Support arm-efi

8 years agoarm64/setjmp: Add missing move for arg1 == 0 case.
Vladimir Serbinenko [Thu, 7 Jan 2016 20:10:05 +0000 (21:10 +0100)]
arm64/setjmp: Add missing move for arg1 == 0 case.

8 years agogrub-shell: Support arm64-efi
Vladimir Serbinenko [Thu, 7 Jan 2016 20:02:53 +0000 (21:02 +0100)]
grub-shell: Support arm64-efi

8 years agoarm-efi: Reduce timer event frequency by 10
Mark Salter [Thu, 7 Jan 2016 19:53:41 +0000 (20:53 +0100)]
arm-efi: Reduce timer event frequency by 10

Timer event to keep grub msec counter was running at 1000HZ. This was too
fast for UEFI timer driver and resulted in a 10x slowdown in grub time
versus wallclock. Reduce the timer event frequency and increase tick
increment accordingly to keep better time.

8 years agox86_64-efi: Automatically add -bios OVMF.fd to qemu in tests.
Vladimir Serbinenko [Thu, 7 Jan 2016 18:29:53 +0000 (19:29 +0100)]
x86_64-efi: Automatically add -bios OVMF.fd to qemu in tests.

8 years agoAllow GRUB_QEMU_OPTS to override machine.
Vladimir Serbinenko [Thu, 7 Jan 2016 18:28:47 +0000 (19:28 +0100)]
Allow GRUB_QEMU_OPTS to override machine.

8 years agoarm64: Disable tests that need native drivers.
Vladimir Serbinenko [Thu, 7 Jan 2016 18:27:56 +0000 (19:27 +0100)]
arm64: Disable tests that need native drivers.

8 years agoDisable NetBSD bootcheck on EFI until it supports ACPI on EFI.
Vladimir Serbinenko [Thu, 7 Jan 2016 18:26:45 +0000 (19:26 +0100)]
Disable NetBSD bootcheck on EFI until it supports ACPI on EFI.

8 years agogrub-shell: Use new cbfstool syntax.
Vladimir Serbinenko [Thu, 7 Jan 2016 14:55:45 +0000 (15:55 +0100)]
grub-shell: Use new cbfstool syntax.

8 years agogrub-shell: On i386-ieee1275 don't try to switch to console.
Vladimir Serbinenko [Thu, 7 Jan 2016 14:54:42 +0000 (15:54 +0100)]
grub-shell: On i386-ieee1275 don't try to switch to console.

console goes to serial as well, so this doesn't stop garbage from going
to serial. But it creates garbage itself.

8 years agohddboot_test: reenable on OVMF
Vladimir Serbinenko [Thu, 7 Jan 2016 14:54:06 +0000 (15:54 +0100)]
hddboot_test: reenable on OVMF

OVMF now supports booting from disks.

8 years agoiee1275/datetime: Fix off-by-1 error.
Vladimir Serbinenko [Thu, 7 Jan 2016 14:53:42 +0000 (15:53 +0100)]
iee1275/datetime: Fix off-by-1 error.

8 years agoAdjust bootcheck tests for multiboot/coreboot/qemu to match real support.
Vladimir Serbinenko [Thu, 7 Jan 2016 14:51:03 +0000 (15:51 +0100)]
Adjust bootcheck tests for multiboot/coreboot/qemu to match real support.

coreboot has ACPI while 2 others don't. *BSD need ACPI and have trouble
without it. Don't even attempt to boot *BSD on multiboot or qemu targets.

On coreboot boot all *BSD except 32-bit NetBSD which apparently does some
early BIOS calls.

8 years agominixfs_test: Check if mkfs.minixfs supports -B option.
Vladimir Serbinenko [Tue, 5 Jan 2016 15:36:21 +0000 (16:36 +0100)]
minixfs_test: Check if mkfs.minixfs supports -B option.

8 years agoAdd memdisk support to grub-emu.
Vladimir Serbinenko [Tue, 5 Jan 2016 11:59:44 +0000 (12:59 +0100)]
Add memdisk support to grub-emu.

Use it to add custom files, so that tests which need them work.

8 years agoMove file loading functions to grub-emu.
Vladimir Serbinenko [Tue, 5 Jan 2016 11:49:12 +0000 (12:49 +0100)]
Move file loading functions to grub-emu.

So that we can use it in grub-emu as well as utils.

8 years agoDisable progress indicator in grub-shell.
Vladimir Serbinenko [Tue, 5 Jan 2016 11:47:30 +0000 (12:47 +0100)]
Disable progress indicator in grub-shell.

This disables progress indicator for tests. This in turn fixes test
flakiness as they ended up timing-dependent.

8 years agoUpdate checksums
Vladimir Serbinenko [Tue, 5 Jan 2016 10:54:39 +0000 (11:54 +0100)]
Update checksums

8 years agoacpihalt: add GRUB_ACPI_OPCODE_CREATE_DWORD_FIELD (0x8a)
Andrei Borzenkov [Sat, 2 Jan 2016 18:33:18 +0000 (21:33 +0300)]
acpihalt: add GRUB_ACPI_OPCODE_CREATE_DWORD_FIELD (0x8a)

Fixes ACPI halt on ASUSTeK P8B75-V,
Bios: American Megatrends v: 0414 date: 04/24/2012

Reported-By: Goh Lip <g.lip@gmx.com>
8 years agoacpihalt: fix GRUB_DSDT_TEST compilation
Andrei Borzenkov [Sat, 2 Jan 2016 16:02:19 +0000 (19:02 +0300)]
acpihalt: fix GRUB_DSDT_TEST compilation

8 years agoAdd missing BUILD_EXEEXT
Andrei Borzenkov [Fri, 1 Jan 2016 08:13:54 +0000 (11:13 +0300)]
Add missing BUILD_EXEEXT

8 years agoconfigure.ac: Reorder efiemu check to after link format check.
Vladimir Serbinenko [Thu, 31 Dec 2015 21:34:26 +0000 (22:34 +0100)]
configure.ac: Reorder efiemu check to after link format check.

efiemu is supposed to be disabled when compiling through exe format.
Unfortunately format was determined only after efiemu check. Reorder to fix the
problem

8 years agoremove temporary .bin files (kernel and modules)
Andrey Borzenkov [Thu, 31 Dec 2015 20:00:25 +0000 (23:00 +0300)]
remove temporary .bin files (kernel and modules)

8 years agoadd dejavu built fonts to cleanfiles
Andrey Borzenkov [Thu, 31 Dec 2015 19:23:12 +0000 (22:23 +0300)]
add dejavu built fonts to cleanfiles

8 years agoAdd grub-module-verifier files to EXTRA_DIST
Andrei Borzenkov [Thu, 31 Dec 2015 18:35:11 +0000 (21:35 +0300)]
Add grub-module-verifier files to EXTRA_DIST

8 years agoconfigure: Add -fno-unwind-tables if supported.
Vladimir Serbinenko [Thu, 31 Dec 2015 18:20:03 +0000 (19:20 +0100)]
configure: Add -fno-unwind-tables if supported.

Unwind tables are useless for us bt consume space if present. Ensure that they
are not.

8 years agomodule-verifier: allow limited-range relocations on sparc64.
Vladimir Serbinenko [Thu, 31 Dec 2015 17:30:39 +0000 (18:30 +0100)]
module-verifier: allow limited-range relocations on sparc64.

clang as incomplete mcmodel=large support. As we don't currently need full
mcmodel=large support for sparc64, relax those checks.

8 years agoDisable build-time module check on emu.
Vladimir Serbinenko [Thu, 31 Dec 2015 17:20:11 +0000 (18:20 +0100)]
Disable build-time module check on emu.

On emu some checks can be laxer like check for relocation range. Additionally
module loading in emu is rarely used. So skip this check rather than making
it laxer for all platforms. In ideal we may want to have slightly different
check for emu but for now this is good enough.

8 years agoconfigure: Fix grub_cv_cc_fno_unwind_tables check.
Vladimir Serbinenko [Thu, 31 Dec 2015 17:19:15 +0000 (18:19 +0100)]
configure: Fix grub_cv_cc_fno_unwind_tables check.

Check tries -fno-dwarf2-cfi-asm but adds -fno-asynchronous-unwind-tables
to TARGET_CFLAGS. Fix this.

8 years agoAdd -mno-stack-arg-probe on mingw.
Vladimir Serbinenko [Thu, 31 Dec 2015 17:15:49 +0000 (18:15 +0100)]
Add -mno-stack-arg-probe on mingw.

This argument disables generation of calls to __chkstk_ms. Those calls are
useless on GRUB as function is dummy. Yet they increase module size and
use limited-range relocations which may not work under some memory layouts.
We currently don't use such layouts on concerned platforms but lt's correct
this.

8 years agoStrip .ARM.exidx
Vladimir Serbinenko [Thu, 31 Dec 2015 17:13:59 +0000 (18:13 +0100)]
Strip .ARM.exidx

This section is generated by clang and is useful only for debugging.
It contains exotic relocations, so strip them to avoid them interferring
with module loading.

8 years agomodule-verifier: Check range-limited relative relocations.
Vladimir Serbinenko [Thu, 31 Dec 2015 14:29:28 +0000 (15:29 +0100)]
module-verifier: Check range-limited relative relocations.

Check that they point to the same module, so will end up in the same
chunk of memory.

8 years agoxen/relocator: Use local symbol to ensure that code is relocation-free.
Vladimir Serbinenko [Thu, 31 Dec 2015 13:54:56 +0000 (14:54 +0100)]
xen/relocator: Use local symbol to ensure that code is relocation-free.

8 years agobacktrace: Fix register call syntax
Vladimir Serbinenko [Thu, 31 Dec 2015 13:54:48 +0000 (14:54 +0100)]
backtrace: Fix register call syntax

8 years agoVerify modules on build-time rather than failing in runtime.
Vladimir Serbinenko [Thu, 31 Dec 2015 12:09:15 +0000 (13:09 +0100)]
Verify modules on build-time rather than failing in runtime.

8 years agosparc64: Fix assembly to let compiler to fill in memory references.
Vladimir Serbinenko [Thu, 31 Dec 2015 12:07:16 +0000 (13:07 +0100)]
sparc64: Fix assembly to let compiler to fill in memory references.

This fixes the use of not fully relocatable (they assume that variables are
under 4G limit in virtual memory) references.

8 years ago30_os-prober: derive --class from os-prober generated label
Andrey Borzenkov [Wed, 30 Dec 2015 19:30:16 +0000 (22:30 +0300)]
30_os-prober: derive --class from os-prober generated label

Currently only Windows gets distinguished icons, everything else is displayed
using the same generic one. Add additional --class based on os-prober returned
label, which usually is expected to match primary distribution name.

Also use it for Windows as well - chainloader prober may actually return
different strings (Windows, MS-DOS, Windows9xME).

8 years agobacktrace: Remove assembly assumption that grub_backtrace_pointer is under 4G
Vladimir Serbinenko [Wed, 30 Dec 2015 17:19:44 +0000 (18:19 +0100)]
backtrace: Remove assembly assumption that grub_backtrace_pointer is under 4G

8 years agomenu: fix line count calculation for long lines
Andrei Borzenkov [Wed, 30 Dec 2015 03:20:51 +0000 (06:20 +0300)]
menu: fix line count calculation for long lines

It gave one extra screen line if length was exactly equal to screen
width.

Reported by Michael Chang.
Also-By: Michael Chang <mchang@suse.com>
8 years agogrub-mkrescue: Delete temporary file
Vladimir Serbinenko [Tue, 29 Dec 2015 16:48:34 +0000 (17:48 +0100)]
grub-mkrescue: Delete temporary file

Reported by: Thomas Schmitt

8 years agogrub-mount: Fix oath parsing.
Vladimir Serbinenko [Tue, 29 Dec 2015 16:43:05 +0000 (17:43 +0100)]
grub-mount: Fix oath parsing.

Brackets detection was copied from somewhere else and makes no sense in case
of grub-mount and prevents user from accessing and files with ) in them.

8 years agoexfat: Fix stream extension flag parsing.
Vladimir Serbinenko [Tue, 29 Dec 2015 16:42:25 +0000 (17:42 +0100)]
exfat: Fix stream extension flag parsing.

8 years agodevmapper: check for valid device abstraction in get_grub_dev
Andrei Borzenkov [Sat, 26 Dec 2015 18:45:22 +0000 (21:45 +0300)]
devmapper: check for valid device abstraction in get_grub_dev

This was lost when code was refactored. Patch restores previous behavior.

It is still not clear whether this is the right one. Due to the way we
detect DM abstraction, partitions on DM are skipped, we fall through to
generic detection which ends up in assuming parent device is BIOS disk.

It is useful to install GRUB on VM disk from the host. But it also means
that GRUB will mistakenly allow install on real system as well.

For now let's fix regression; future behavior needs to be discussed.

Closes: 45163

8 years agowindows: correct LBA in generated EFI HDD media paths
Andrei Borzenkov [Sat, 19 Dec 2015 08:32:26 +0000 (11:32 +0300)]
windows: correct LBA in generated EFI HDD media paths

GRUB keeps partition offset and size in units of 512B sectors. Media paths
are defined in terms of LBA which are presumed to match HDD sector size.

This is probably cosmetic (EFI requires that partition is searched by GUID)
and still incorrect if GPT was created using different logical block size.
But current code is obviously wrong and new has better chances to be correct.

8 years agolsefimmap: support persistent memory and other UEFI 2.5 features
Robert Elliott [Thu, 17 Dec 2015 16:53:32 +0000 (10:53 -0600)]
lsefimmap: support persistent memory and other UEFI 2.5 features

This should accompany
76ce1de740 Translate UEFI persistent memory type

1. Add a string for the EfiPersistentMemory type 14 that was
added in UEFI 2.5.

2. Decode the memory attributes that were added in UEFI 2.5:
* NV (non-volatile)
* MORE_RELIABLE (higher reliable, e.g., mirrored memory in a system
  with partial memory mirroring)
* RO (read-only)

3. Use proper IEC binary units (KiB, MiB, etc.) for power-of-two
values rather than misusing SI power-of-ten units (KB, MB, etc.)

4. The lsmmap command only decodes memory ranges sizes up to GiB scale
units.  Persistent memory ranges will reach into the TiB scale.
Since 64-bit size field supports TiB, PiB, and EiB, decode all of
them for completeness.

5. In the lsefimmap command, rewrite the print statements to
* avoid rounding
* avoid a big nested if/else tree.

For example: In the sixth entry below, the value of 309MB implies
316416KB but is really reporting 316436KB.

Widen the size column to 6 digits to accommodate typical cases.
The worst case value would require 14 digits; if that happens,
let the columns get out of sync.

Old format:
Type      Physical start  - end             #Pages     Size Attributes
conv-mem  0000000000000000-0000000000092fff 00000093  588KB UC WC WT WB
reserved  0000000000093000-0000000000093fff 00000001    4KB UC WC WT WB
conv-mem  0000000000094000-000000000009ffff 0000000c   48KB UC WC WT WB
conv-mem  0000000000100000-000000000fffffff 0000ff00  255MB UC WC WT WB
BS-code   0000000010000000-0000000010048fff 00000049  292KB UC WC WT WB
conv-mem  0000000010049000-000000002354dfff 00013505  309MB UC WC WT WB
ldr-data  000000002354e000-000000003ecfffff 0001b7b2  439MB UC WC WT WB
BS-data   000000003ed00000-000000003ed7ffff 00000080  512KB UC WC WT WB
conv-mem  000000003ed80000-000000006af5ffff 0002c1e0  705MB UC WC WT WB
reserved  000000006af60000-000000006b55ffff 00000600    6MB UC WC WT WB
BS-data   000000006b560000-000000006b560fff 00000001    4KB UC WC WT WB
RT-data   000000006b561000-000000006b5e1fff 00000081  516KB RT UC WC WT WB
BS-data   000000006b5e2000-000000006ecfafff 00003719   55MB UC WC WT WB
BS-code   000000006ecfb000-000000006ecfbfff 00000001    4KB UC WC WT WB
conv-mem  000000006ecfc000-00000000711fafff 000024ff   36MB UC WC WT WB
BS-data   00000000711fb000-000000007128dfff 00000093  588KB UC WC WT WB
Unk 0d    0000000880000000-0000000e7fffffff 00600000   24GB UC WC WT WB NV
reserved  0000001680000000-0000001c7fffffff 00600000   24GB UC WC WT WB NV

New format:
Type      Physical start  - end             #Pages        Size Attributes
conv-mem  0000000000000000-0000000000092fff 00000093    588KiB UC WC WT WB
reserved  0000000000093000-0000000000093fff 00000001      4KiB UC WC WT WB
conv-mem  0000000000094000-000000000009ffff 0000000c     48KiB UC WC WT WB
conv-mem  0000000000100000-000000000fffffff 0000ff00    255MiB UC WC WT WB
BS-code   0000000010000000-0000000010048fff 00000049    292KiB UC WC WT WB
conv-mem  0000000010049000-000000002354dfff 00013505 316436KiB UC WC WT WB
ldr-data  000000002354e000-000000003ecfffff 0001b7b2 450248KiB UC WC WT WB
BS-data   000000003ed00000-000000003ed7ffff 00000080    512KiB UC WC WT WB
conv-mem  000000003ed80000-000000006af5ffff 0002c1e0 722816KiB UC WC WT WB
reserved  000000006af60000-000000006b55ffff 00000600      6MiB UC WC WT WB
BS-data   000000006b560000-000000006b560fff 00000001      4KiB UC WC WT WB
RT-data   000000006b561000-000000006b5e1fff 00000081    516KiB RT UC WC WT WB
BS-data   000000006b5e2000-000000006ecfafff 00003719  56420KiB UC WC WT WB
BS-code   000000006ecfb000-000000006ecfbfff 00000001      4KiB UC WC WT WB
conv-mem  000000006ecfc000-0000000071222fff 00002527  38044KiB UC WC WT WB
BS-data   0000000071223000-00000000712ddfff 000000bb    748KiB UC WC WT WB
persist   0000000880000000-0000000e7fffffff 00600000     24GiB UC WC WT WB NV
reserved  0000001680000000-0000001c7fffffff 00600000     24GiB UC WC WT WB NV

8 years agokernel: print and reset grub_errno after each embedded config line
Andrei Borzenkov [Wed, 16 Dec 2015 18:20:30 +0000 (21:20 +0300)]
kernel: print and reset grub_errno after each embedded config line

Otherwise it causes subsequent file open to fail, because grub_file_open
misinterprets set grub_errno for grub_file_get_device_name failure.

Closes: 46540

8 years agoErase backspaced character in grub_username_get
Andrei Borzenkov [Wed, 16 Dec 2015 16:20:10 +0000 (19:20 +0300)]
Erase backspaced character in grub_username_get

It probably does not work across linefeed, but hopefully user names are not
that long (and nobody is using terminal that small).

8 years agoFix security issue when reading username and password
Hector Marco-Gisbert [Wed, 16 Dec 2015 04:57:18 +0000 (07:57 +0300)]
Fix security issue when reading username and password

This patch fixes two integer underflows at:
  * grub-core/lib/crypto.c
  * grub-core/normal/auth.c

CVE-2015-8370

Signed-off-by: Hector Marco-Gisbert <hecmargi@upv.es>
Signed-off-by: Ismael Ripoll-Ripoll <iripoll@disca.upv.es>
Also-By: Andrey Borzenkov <arvidjaar@gmail.com>
8 years agoNEWS: more additions
Andrei Borzenkov [Tue, 15 Dec 2015 07:41:01 +0000 (10:41 +0300)]
NEWS: more additions

Also-By: Robert Elliott <elliott@hpe.com>
8 years agoTranslate UEFI persistent memory type
Robert Elliott [Thu, 3 Dec 2015 17:38:36 +0000 (11:38 -0600)]
Translate UEFI persistent memory type

Define
* GRUB_EFI_PERSISTENT_MEMORY (UEFI memory map type 14) per UEFI 2.5
* GRUB_MEMORY_PERSISTENT (E820 type 7) per ACPI 3.0
* GRUB_MEMORY_PERSISTENT_LEGACY (E820 unofficial type 12) per ACPI 3.0

and translate GRUB_EFI_PERSISTENT_MEMORY to GRUB_MEMORY_PERSISTENT in
grub_efi_mmap_iterate().

Includes
* adding the E820 names to lsmmap
* handling the E820 types in make_efi_memtype()

Suggested-by: Vladimir 'φ-coder/phcoder' Serbinenko <phcoder@gmail.com>
Suggested-by: Andrei Borzenkov <arvidjaar@gmail.com>
8 years agoDocument bootlocation discovery limitations and xen platform limitations
Vladimir Serbinenko [Mon, 14 Dec 2015 15:21:24 +0000 (16:21 +0100)]
Document bootlocation discovery limitations and xen platform limitations

8 years agotcp: ack when we get an OOO/lost packet
Josef Bacik [Wed, 12 Aug 2015 15:16:22 +0000 (08:16 -0700)]
tcp: ack when we get an OOO/lost packet

While adding tcp window scaling support I was finding that I'd get some packet
loss or reordering when transferring from large distances and grub would just
timeout.  This is because we weren't ack'ing when we got our OOO packet, so the
sender didn't know it needed to retransmit anything, so eventually it would fill
the window and stop transmitting, and we'd time out.  Fix this by ACK'ing when
we don't find our next sequence numbered packet.  With this fix I no longer time
out.  Thanks,

Signed-off-by: Josef Bacik <jbacik@fb.com>
8 years agoi386: fix TSC calibration using PIT
Michael Chang [Tue, 1 Dec 2015 15:49:38 +0000 (18:49 +0300)]
i386: fix TSC calibration using PIT

Condition was accidentally reversed, so PIT calibration always failed
when PIT was present and always succeeded when PIT was missing, but in
the latter case resulted in absurdly fast clock.

Reported and tested by Vitaly Kuznetsov <vkuznets@redhat.com>

8 years agoDo not include generated gnulib headers in tarball
Andrei Borzenkov [Sat, 28 Nov 2015 18:11:34 +0000 (21:11 +0300)]
Do not include generated gnulib headers in tarball

gnulib files are already handled by recursive make distdir invocation.
Including all generated headers (after make completed) causes build
failure if target system is different (different compile version etc).

8 years agoReplace numbers with grub_memory_type_t enums
Andrei Borzenkov [Fri, 27 Nov 2015 16:52:16 +0000 (19:52 +0300)]
Replace numbers with grub_memory_type_t enums