Michael Marineau
6078f83638
gpt: properly detect and repair invalid tables
...
GPT_BOTH_VALID is 4 bits so simple a boolean check is not sufficient.
This broken condition allowed gptprio to trust bogus disk locations in
headers that were marked invalid causing arbitrary disk corruption.
2016-08-22 17:33:17 -07:00
Michael Marineau
c2f5fde6ab
gpt: add verbose debug logging
2016-08-22 13:02:29 -07:00
Michael Marineau
a8ad608425
gpt: do not use disk sizes GRUB will reject as invalid later on
...
GRUB assumes that no disk is ever larger than 1EiB and rejects
reads/writes to such locations. Unfortunately this is not conveyed in
the usual way with the special GRUB_DISK_SIZE_UNKNOWN value.
2016-07-25 15:35:01 -07:00
Matthew Garrett
bb3473d7c8
Rework TPM measurements
...
Rework TPM measurements to use fewer PCRs. After discussion with upstream,
it's preferable to avoid using so many PCRs. Instead, measure into PCRs 8
and 9 but use a prefix in the event log to indicate which subsystem carried
out the measurements.
2016-03-23 17:03:43 -07:00
Daniel Kiper
eba6db6323
relocator: Fix integer underflow.
2016-02-12 16:07:57 +01:00
Vladimir Serbinenko
e72de13b9e
Add RNG module.
2016-02-12 12:39:38 +01:00
Colin Watson
47e67d809c
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 .
2016-01-20 15:56:55 +00:00
Vladimir Serbinenko
e4c49cab9b
arm64/setjmp: Add missing move for arg1 == 0 case.
2016-01-07 21:10:05 +01:00
Vladimir Serbinenko
607d66116a
iee1275/datetime: Fix off-by-1 error.
2016-01-07 15:53:42 +01:00
Matthew Garrett
2d410729e9
Measure the kernel commandline
...
Measure the kernel commandline to ensure that it hasn't been modified
2016-01-05 14:35:17 -08:00
Vladimir Serbinenko
f2b54835f2
Disable progress indicator in grub-shell.
...
This disables progress indicator for tests. This in turn fixes test
flakiness as they ended up timing-dependent.
2016-01-05 21:10:10 +01:00
Vladimir Serbinenko
76588d1319
xen/relocator: Use local symbol to ensure that code is relocation-free.
2015-12-31 14:54:56 +01:00
Vladimir Serbinenko
60ae582142
backtrace: Fix register call syntax
2015-12-31 14:54:48 +01:00
Vladimir Serbinenko
79cfad6fbe
backtrace: Remove assembly assumption that grub_backtrace_pointer is under 4G
2015-12-30 18:19:44 +01:00
Michael Marineau
286f1b63df
Merge branch 'master' of git://git.savannah.gnu.org/grub
2015-12-17 12:01:00 -08:00
Hector Marco-Gisbert
451d80e52d
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>
2015-12-16 07:57:18 +03:00
Vladimir Serbinenko
25a9b8f208
fdt.mod: Move license tag to the right file.
2015-11-09 16:15:30 +01:00
Vladimir Serbinenko
cfabe05cc6
mips: Make setjmp code N32-compliant.
2015-10-11 13:20:26 +02:00
Andrei Borzenkov
6e21195890
progress: avoid NULL dereference for net files
...
From original patch by dann frazier <dann.frazier@canonical.com>:
grub_net_fs_open() saves off a copy of the file structure it gets passed and
uses it to create a bufio structure. It then overwrites the passed in file
structure with this new bufio structure. Since file->name doesn't get set
until we return back to grub_file_open(), it means that only the bufio
structure gets a valid file->name. The "real" file's name is left
uninitialized. This leads to a crash when the progress module hook is called
on it.
grub_net_fs_open() already saved copy of file name as ->net->name, so change
progress module to use it.
Also, grub_file_open may leave file->name as NULL if grub_strdup fails. Check
for it.
Also-By: dann frazier <dann.frazier@canonical.com>
2015-10-10 11:44:14 +03:00
Alex Crawford
53a4e99990
gpt: add search by disk uuid command
2015-08-31 16:20:37 -07:00
Michael Marineau
91391dc52b
Merge pull request #14 from coreos/gnu
...
Merge upstream GRUB changes
2015-08-13 13:32:56 -07:00
Michael Marineau
d9823e47bc
Merge pull request #13 from marineam/lecrc32
...
gpt: clean up little-endian crc32 computation
2015-07-31 16:24:02 -07:00
Michael Marineau
c7c750ecc2
Merge upstream changes as of April 29th
2015-07-31 15:41:48 -07:00
Michael Marineau
c78ed0bff4
gpt: clean up little-endian crc32 computation
...
- Remove problematic cast from *uint8_t to *uint32_t (alignment issue).
- Remove dynamic allocation and associated error handling paths.
- Match parameter ordering to existing grub_crypto_hash function.
2015-07-31 15:19:41 -07:00
Vladimir Serbinenko
eecdbebc84
Remove mips_attributes.
...
mips_attributes was introduced to work around clang problems with
-msoft-float. Those problems are now fixed and moreover .gnu_attributes
itself is unportable and creates problem with clang.
Revert "mips: Fix soft-float handling."
This partially reverts commit 6a4ecd276e
.
2015-07-22 21:05:11 +02:00
Andrei Borzenkov
a6f7d1abce
reed_solomon: fix memory leak
...
Found by: Coverity scan.
CID: 96688
2015-06-20 23:38:18 +03:00
Andrei Borzenkov
48cd9dc104
syslinux_parse: assorted issues found by Coverity
...
1. Remove unneeded NULL check
CID: 96607
2. Do not allocate storage for initrd, copy it directly from input
buffer. Avoids memory leak in failure path.
CID: 96604
3. Unchecked error return from print()
CID: 96601, 73595
2015-06-19 18:38:25 +03:00
Andrei Borzenkov
8067fe28ed
syslinux_parse: make print_escaped actually stop before `to'
...
The only current user is mboot.c32 which unfortunately is not covered
by regression tests.
2015-06-19 17:35:17 +03:00
dann frazier
3ac342205d
arm64/setjmp: Add missing license macro
...
Including the setjmp module in an arm64-efi image will cause it to
immediately exit with an "incompatible license" error.
The source file includes a GPLv3+ boilerplate, so fix this by declaring a
GPLv3+ license using the GRUB_MOD_LICENSE macro.
Signed-off-by: dann frazier <dann.frazier@canonical.com>
2015-06-01 17:02:04 +01:00
Daniel Kiper
71783dc978
i386/relocator: Remove unused extern grub_relocator64_rip_addr
...
Signed-off-by: Daniel Kiper <daniel.kiper@oracle.com>
2015-05-07 18:00:47 +02:00
Andrei Borzenkov
f11db3c7fc
core: avoid NULL derefrence in grub_divmod64s
...
It can be called with NULL for third argument. grub_divmod32* for
now are called only from within wrappers, so skip check.
Reported-By: Michael Zimmermann <sigmaepsilon92@gmail.com>
2015-04-06 19:30:51 +03:00
Lunar
c9ee9bedef
syslinux: Support {vesa,}menu.c32.
2015-03-27 15:15:13 +01:00
Vladimir Serbinenko
dc06aa949b
syslinux_parse: Fix the case of unknown localboot.
...
Reported by: Jordan Uggla
2015-03-04 14:19:29 +01:00
Vladimir Serbinenko
064360e667
Remove libgcc dependency.
...
libgcc for boot environment isn't always present and compatible.
libgcc is often absent if endianness or bit-size at boot is different
from running OS.
libgcc may use optimised opcodes that aren't available on boot time.
So instead of relying on libgcc shipped with the compiler, supply
the functions in GRUB directly.
Tests are present to ensure that those replacement functions behave the
way compiler expects them to.
2015-03-03 20:50:37 +01:00
Vladimir Serbinenko
94f701a826
crypto: restrict cipher block size to power of 2.
...
All current ciphers have blocks which are power of 2 and it's
unlikely to change. Other block length would be tricky to handle anyway.
This restriction allows avoiding extra divisions.
2015-02-26 22:04:40 +01:00
Vladimir Serbinenko
80310ad07d
Add missing lib/division.c
2015-02-26 18:22:40 +01:00
Vladimir Serbinenko
6a4ecd276e
mips: Fix soft-float handling.
...
Add -msoft-float alongside clang arguments to specify ABI.
Specify ABI in asm files explicitly.
This trigers asm warning due to gcc failing to propagate -msoft-float
but it's tolerable.
2015-02-23 22:33:28 +01:00
Vladimir Serbinenko
e29af836d0
Don't remove initrd= parameter.
...
Based on simplified patch by Lunar.
Reported by: Lunar
2015-02-16 15:56:26 +01:00
Vladimir Serbinenko
b23635fcff
syslinux_parse: Always output comments even if no entries are found.
2015-02-16 10:54:20 +01:00
Andrei Borzenkov
2efab86d5a
syslinux_parse: fix memory leak.
...
Found by: Coverity scan.
2015-01-28 20:09:25 +03:00
Vladimir Serbinenko
9ee5ae1fae
Document intentional fallthroughs.
...
Found by: Coverity scan.
2015-01-27 17:17:58 +01:00
Vladimir Serbinenko
49978c5c4f
lib/syslinux_parse: Add missing error check.
...
Found by: Coverity scan.
2015-01-26 09:42:04 +01:00
Vladimir Serbinenko
ca7c1fd6f3
lib/syslinux_parse: Fix memory leak.
...
Found by: Coveriy scan.
2015-01-26 09:41:43 +01:00
Vladimir Serbinenko
aa64393144
lib/syslinux_parse: Add missing alloc check.
...
Found by: Coverity scan.
2015-01-26 09:40:42 +01:00
Vladimir Serbinenko
065ed900d4
grub-core/lib/pbkdf2.c (grub_crypto_pbkdf2): Check that hash len is not 0.
2015-01-21 17:42:12 +01:00
Vladimir Serbinenko
59d4036594
Replace explicit sizeof divisions by ARRAY_SIZE.
2015-01-21 17:37:31 +01:00
Andrei Borzenkov
dbbac5a04c
grub-core/lib/syslinux_parse.c: do not free array
...
say->msg is inline array in a structure and should not be freed.
CID: 73610
2014-11-30 18:49:14 +03:00
Michael Marineau
c70627bc9f
gpt: add search by partition label and uuid commands
...
Builds on the existing filesystem search code. Only for GPT right now.
2014-11-27 18:49:24 -08:00
Michael Marineau
13761c8675
gpt: move gpt guid printing function to common library
2014-11-27 16:39:07 -08:00
Michael Marineau
d3c2759e83
gpt: split out checksum recomputation
...
For basic data modifications the full repair function is overkill.
2014-11-15 13:32:37 -08:00
Michael Marineau
051545ddf0
gpt: add write function and gptrepair command
...
The first hint of something practical, a command that can restore any of
the GPT structures from the alternate location. New test case must run
under QEMU because the loopback device used by the other unit tests does
not support writing.
2014-10-20 14:10:47 -07:00
Michael Marineau
478458d404
gpt: add new repair function to sync up primary and backup tables.
2014-10-20 13:54:58 -07:00
Michael Marineau
dc6076187e
gpt: consolidate crc32 computation code
...
The gcrypt API is overly verbose, wrap it up in a helper function to
keep this rather common operation easy to use.
2014-10-20 13:54:58 -07:00
Michael Marineau
4dd009a6fb
gpt: record size of of the entries table
...
The size of the entries table will be needed later when writing it back
to disk. Restructure the entries reading code to flow a little better.
2014-10-20 13:54:58 -07:00
Michael Marineau
3b2674aef7
gpt: rename misnamed header location fields
...
The header location fields refer to 'this header' and 'alternate header'
respectively, not 'primary header' and 'backup header'. The previous
field names are backwards for the backup header.
2014-10-20 13:52:55 -07:00
Michael Marineau
f82f65f338
gpt: start new GPT module
...
This module is a new implementation for reading GUID Partition Tables
which is much stricter than the existing part_gpt module and exports GPT
data directly instead of the generic grub_partition structure. It will
be the basis for modules that need to read/write/update GPT data.
The current code does nothing more than read and verify the table.
2014-10-18 13:54:54 -07:00
Andrey Borzenkov
954fe77163
cleanup: grub_cpu_to_XXX_compile_time for constants
...
This tries to catch all cases where grub_cpu_to_XXX was used for constant
expressions (including sizeof).
2014-09-22 20:47:10 +04:00
Piotr Krysiuk
5a6db38d62
Allow loading old kernels by placing GDT in conventional memory.
2014-04-20 16:00:55 +02:00
Vladimir Serbinenko
a72fc329eb
* grub-core/lib/syslinux_parse.c: Fix timeout quoting.
2014-04-06 00:44:44 +02:00
Vladimir Serbinenko
8063ce197f
Replace few instances of memcmp/memcpy in the code that should be grub_memcmp/grub_memcpy.
2014-04-04 07:58:42 +02:00
Vladimir Serbinenko
46b74dd3cb
* grub-core/lib/relocator.c: Fix the case when end of leftover is used.
2014-03-26 08:48:30 +01:00
Vladimir Serbinenko
4127206896
Make rijndael.c respect aliasing rules.
...
Trivial backport of dfb4673da8ee52d95e0a62c9f49ca8599943f22e.
2013-12-24 16:57:28 +01:00
Leif Lindholm
c415eaa98f
fdt: additions required for arm64 Linux loader
...
- Add grub_fdt_create_empty_tree() function.
- Add 64-bit setprop.
2013-12-22 18:38:44 +00:00
Vladimir Serbinenko
0d8b81f89a
Fix ARM Linux Loader on non-FDT platforms.
2013-12-22 00:30:19 +01:00
Vladimir Serbinenko
ae558c2ccf
Enable -Wformat=2 if it's supported.
2013-12-21 15:28:28 +01:00
Vladimir Serbinenko
76a2a43011
* grub-core/lib/crypto.c: Don't discard const attribute.
2013-12-21 13:34:03 +01:00
Vladimir Serbinenko
0d26164edd
* grub-core/lib/disk.c: Fix potential overflow.
2013-12-21 13:32:39 +01:00
Vladimir Serbinenko
2622b1e8a8
* grub-core/lib/arg.c: Don't discard const attribute.
2013-12-21 13:28:52 +01:00
Vladimir Serbinenko
1962ed95cc
* grub-core/lib/syslinux_parse.c: Declare timeout unsigned.
2013-12-18 12:29:30 +01:00
Vladimir Serbinenko
a43b3e5d8e
Silence spurious warning.
2013-12-18 06:19:16 +01:00
Vladimir Serbinenko
8f5add13ff
Implement syslinux parser.
2013-12-18 05:28:05 +01:00
Vladimir Serbinenko
25a7863d77
Add Yeeloong 3A reboot and halt.
2013-12-17 22:53:18 +01:00
Vladimir Serbinenko
e14d409b6f
* grub-core/lib/arg.c: Ensure at least a single space between commands.
2013-12-17 14:42:02 +01:00
Vladimir Serbinenko
2c384f1e6e
* grub-core/lib/i386/xen/relocator.S: Fix hypercall ABI violation.
...
GRUB relied on %ebx being preserved across hypercall which isn't true.
2013-12-17 13:40:52 +01:00
Vladimir Serbinenko
d16ff5897f
* grub-core/lib/x86_64/xen/relocator.S: Fix hypercall ABI violation.
...
GRUB relied on %rdi being preserved across hypercall which isn't true.
2013-12-17 13:19:58 +01:00
Vladimir Serbinenko
d87cb3ae3c
* grub-core/lib/posix_wrap/errno.h: Undefine errno before redefining.
2013-12-16 14:36:48 +01:00
Leif Lindholm
3f1423e789
* grub-core/lib/fdt.c: change memcpy => grub_memcpy
2013-12-10 16:51:10 +00:00
Leif Lindholm
bbeee1c4a3
grub-core/lib/fdt.c: correctly update size_dt_struct in add_subnode()
2013-12-05 11:44:41 +00:00
Leif Lindholm
b29b77fee2
New port arm64-efi
2013-11-30 16:50:31 +01:00
Vladimir Serbinenko
35de6d4bac
* grub-core/lib/libgcrypt/mpi/longlong.h: Fix compilation error with
...
-march=armv3.
2013-11-30 11:19:06 +01:00
Vladimir Serbinenko
d6c92cdc34
Merge branch 'master' into leiflindholm/arm64
...
Conflicts:
include/grub/util/install.h
2013-11-25 13:02:27 +01:00
Vladimir Serbinenko
e77c81f6f8
* grub-core/lib/reed_solomon.c: Use section _text, _text rather than
...
.text when compiling for Apple.
2013-11-24 05:14:11 +01:00
Vladimir Serbinenko
a92b5cb8d8
* grub-core/lib/libgcrypt/mpi/longlong.h: Use C version with mips
...
clang.
2013-11-23 00:36:13 +01:00
Vladimir Serbinenko
7dd0a30361
* grub-core/lib/crypto.c (grub_crypto_hash): Remove variable length
...
array.
2013-11-20 20:09:18 +01:00
Vladimir Serbinenko
96fa2d9d02
Merge branch 'master' into leiflindholm/arm64
2013-11-18 17:51:28 +01:00
Vladimir Serbinenko
2df8f43d3e
* grub-core/lib/sparc64/setjmp.S: Force spilling of current window.
2013-11-18 10:01:36 +01:00
Vladimir Serbinenko
04f39f6df8
* grub-core/lib/relocator.c (grub_mm_check_real): Accept const char *
...
as file argument.
2013-11-18 02:45:25 +01:00
Vladimir Serbinenko
59c943ecf6
* grub-core/lib/powerpc/setjmp.S (grub_setjmp): Save r31.
...
(grub_longjmp): Restore r31.
* include/grub/powerpc/setjmp.h (grub_jmp_buf): Reserve space for r31.
2013-11-18 02:35:32 +01:00
Leif Lindholm
15a463d742
ARM 64 port by Leif Lindholm
2013-11-16 20:52:55 +01:00
Vladimir Serbinenko
9ef81064a3
* grub-core/kern/arm/cache.S: Don't switch back to ARM mode when
...
compiling to thumb2.
* grub-core/kern/arm/cache_armv7.S: Likewise.
* grub-core/lib/arm/setjmp.S: Likewise.
2013-11-16 17:37:06 +01:00
Vladimir Serbinenko
ef28ee8bc1
Add missing includes of loader.h.
2013-11-13 00:43:03 +01:00
Vladimir Serbinenko
4b85f1228a
* grub-core/lib/crypto.c (grub_crypto_cbc_decrypt): Remove variable
...
length arrays.
2013-11-12 02:49:17 +01:00
Vladimir Serbinenko
9c6482b8d6
* grub-core/lib/pbkdf2.c: Remove variable length arrays.
2013-11-12 01:52:55 +01:00
Vladimir Serbinenko
2def66169e
* grub-core/lib/xzembed/xz_dec_stream.c: Remove variable length arrays.
2013-11-12 01:26:56 +01:00
Vladimir Serbinenko
8445b0115f
* grub-core/lib/i386/relocator_common.S [__APPLE__ && __x86_64__]: Use
...
rip-relative addressing in prologue.
2013-11-11 23:02:51 +01:00
Vladimir Serbinenko
631187be8c
Add missing includes of loader.h.
2013-11-11 02:30:09 +01:00
Vladimir Serbinenko
3617c59bab
* include/grub/lib/LzmaDec.h: Fix to include LzmaTypes.h and
...
not Types.h.
* grub-core/lib/LzmaDec.c: Fix prologue to make it compileable in GRUB
environment.
(LzmaDec_InitDicAndState): Make static.
2013-11-10 20:37:01 +01:00
Vladimir Serbinenko
33690255c5
Fix grub_machine_fini bitrot.
...
Reported by: Glenn Washburn.
2013-11-10 13:33:26 +01:00
Vladimir Serbinenko
9612ebc00e
Add new ports: i386-xen and x86_64-xen. This allows running GRUB in
...
XEN PV environment and load kernels.
2013-11-09 21:29:11 +01:00
Vladimir Serbinenko
2df1255117
* grub-core/lib/cmdline.c (grub_loader_cmdline_size): Fix empty cmdline
...
handling.
2013-11-09 17:31:21 +01:00