Commit graph

9114 commits

Author SHA1 Message Date
Andrei Borzenkov
740c08ed2f Use ssize_t for grub_util_fd_read result
Fixes commit 0415dbe28f.
2014-11-28 21:43:07 +03:00
Andrei Borzenkov
ea44693fc8 grub-core/disk/luks.c: fix use after free and memory leaks
configure_ciphers:

- several memory leaks where allocated ciphers were not freed. CID: 73813,
73710

- use after free. It is probably quite innocent as grub is single threaded,
but could potentially be a problem with memory allocator debugger turned on.
CID: 73730

luks_recover_key:

- memory leak. CID: 73854
2014-11-28 21:12:00 +03:00
Andrei Borzenkov
0415dbe28f grub-install-common: avoid out of bound access when read failed
Check that modinfo.sh could be read successfully; abort on error. Avoids
potential out-of-bound array access.

CID: 73819
2014-11-28 20:45:27 +03:00
Andrei Borzenkov
478b567520 grub-mkstandalone: out of bound access to tar header magic
Magic size is 6 bytes and we copied 7 bytes in it.

CID: 73587, 73888
Closes bug 43690
2014-11-28 20:39:22 +03:00
Michael Chang
7c4b6b7bb4 send router solicitation for ipv6 address autoconf v2
Many routers have long router advertisment interval configured by
default. The Neighbor Discovery protocol (RFC4861) has defined default
MaxRtrAdvInterval value as 600 seconds and
MinRtrAdvInterval as 0.33*MaxRtrAdvInterval. This makes
net_ipv6_autoconf fails more often than not as currently it passively
listens the RA message to perfom address autoconfiguration.

This patch tries to send router solicitation to overcome the problem of
long RA interval.

v2:
use cpu_to_be macro for network byte order conversion
add missing error handling
2014-11-28 20:21:34 +03:00
Andrei Borzenkov
e2dd6daa8c grub-fs-tester: consistently print output of grub ls if test fails 2014-11-20 20:56:51 +03:00
Andrei Borzenkov
2ccaa3b9fd Fix date in last ChangeLog entry 2014-11-20 20:54:49 +03:00
Leif Lindholm
004a2b1efd efi: check *path non-null before grub_strrchr
The EFI version of grub_machine_get_bootlocation crops the boot image
name back to the last / in order to get a directory path. However, it
does not check that *name is actually set before calling grub_strrchr
to do this, and neither does grub_strrchr before dereferencing a NULL
pointer.

Parent function, grub_set_prefix_and_root, does check the pointer
before using.
2014-11-17 14:11:01 +00:00
Michael Chang
72ec399ad8 icmp6 fix no respond to neighbor solicit message
The structure size used in grub_netbuff_pull to get the pointer to
option header is apparently wrong, which leads to subsequent range check
failed and therefore not responding to any neighbor solicit message in my
testing.
2014-11-03 20:03:04 +03:00
Andrei Borzenkov
9a67e1ac8e Use full initializer for initrd_ctx to avoid fatal warnings with older GCC
struct ... foo = { 0, } is valid initializer, but older GCC emits
warning which is fatal error due to -Werror=missing-field-initializer.
So simply use full initializer to avoid these errors. This was fixed
probably in GCC 4.7.

See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=36750
2014-10-14 20:12:15 +04:00
Colin Watson
77063f4cb6 Fix in-tree --platform=none
* configure.ac: Only remove include/grub/cpu and
include/grub/machine in the --platform=none case, not all of
include/grub.
2014-09-25 20:59:26 +01:00
Colin Watson
5d90f6e533 Add a new "none" platform that only builds utilities
This makes it possible to build generally-useful utilities such as
grub-mount even if the rest of GRUB has not been ported to the target
CPU.

* configure.ac: Add "none" platform.  Default to it for unsupported
CPUs rather than stopping with a fatal error.  Don't downgrade
x86_64-none to i386.  Define COND_real_platform Automake conditional
if the platform is anything other than "none".  Don't do any include
directory linking for "none".
* Makefile.am: Skip building grub-core and all bootcheck targets if
!COND_real_platform.
* include/grub/time.h: Don't include <grub/cpu/time.h> if GRUB_UTIL
is defined.
2014-09-23 12:06:30 +01: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
Vladimir Serbinenko
6d05b6383c Revert " Use -Wl,--no-relax rather than -mno-relax for uniformity."
This reverts commit 063f2a04d1.
2014-09-21 19:02:11 +02:00
Valentin Dornauer
0f1f95c7b7 ACPIhalt: Add more ACPI opcodes.
The AML parser implements only a small subset of possible AML
	opcodes. On the Fujitsu Lifebook E744 this and another bug in
	the parser (incorrect handling of TermArg data types) would lead
	to the laptop not turning off (_S5 not found).

	* grub-core/commands/acpihalt.c: Support OpAlias in the AML parser;
	in skip_ext_op(), handle some Type2Opcodes more correctly (TermArgs
	aren't always simply strings!); Add function to skip TermArgs
	* include/grub/acpi.h: Add new opcodes
2014-09-21 18:58:14 +02:00
Vladimir Serbinenko
41c6f91fce * grub-core/normal/main.c: Don't drop to rescue console in
case of password-protected prompt and no menu entries.
2014-09-21 18:51:09 +02:00
Vladimir Serbinenko
7c378c3964 * grub-core/commands/keylayouts.c: Ignore unknown keys. 2014-09-21 18:49:49 +02:00
Vladimir Serbinenko
2988a849fc * grub-core/gmodule.pl.in: Accept newer binutils which output
empty column rather than 0x0.
2014-09-21 18:23:23 +02:00
Vladimir Serbinenko
5e42618e00 Fix wrong commit 2014-09-21 18:18:03 +02:00
Michael Chang
0aece00c54 * grub-core/osdep/unix/config.c: Remove extraneous comma. 2014-09-21 17:49:13 +02:00
Peter Jones
631a820038 Initialized initrd_ctx so we don't free a random pointer from the stack.
Currently, if "linux" fails, the "goto fail;" in grub_cmd_initrd sends us
into grub_initrd_close() without grub_initrd_init() being called, and thus
it never clears initrd_ctx->components.  grub_initrd_close() then frees that
address, which is stale data from the stack.  If the stack happens to have a
stale *address* there that matches a recent allocation, then you'll get a
double free later.

So initialize the memory up front.

Signed-off-by: Peter Jones <pjones@redhat.com>
2014-09-21 10:36:42 +04:00
Colin Watson
60049a0e72 Tidy up ChangeLog formatting. 2014-09-19 14:50:51 +01:00
Khem Raj
a276b84046 Fix build with glibc 2.20
* grub-core/kern/emu/hostfs.c: squahes below warning
  warning: #warning "_BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE"

Signed-off-by: Khem Raj <raj.khem@gmail.com>

Upstream-Status: Submitted
2014-09-15 19:59:27 +04:00
Michael Chang
54bd9a0610 Fix incorrect address reference in btrfs
We encountered a weird random kernel initrd unpacking error on btrfs
and finally found it was caused by incorrect address reference in range
check for type GRUB_BTRFS_EXTENT_REGULAR and the entire result is
unpredictable.

This is a quick fix to make the address reference to the
grub_btrfs_extent_data structure correctly, not the pointer variable
to it.

Any suggestions to this patch is welcome.
2014-09-08 11:33:40 +01:00
Colin Watson
2a5a532c00 Support grub-emu on x32 (ILP32 but with x86-64 instruction set)
* configure.ac: Remove -m64 from checks for -mcmodel=large and
-mno-red-zone.  These are always either unnecessary (x86_64-emu) or
already in TARGET_CFLAGS at this point, and they produce incorrect
results when building for x32.
* grub-core/kern/x86_64/dl.c (grub_arch_dl_relocate_symbols): Cast
pointers to Elf64_Xword via grub_addr_t, in order to work on x32.
* include/grub/x86_64/types.h (GRUB_TARGET_SIZEOF_VOID_P,
GRUB_TARGET_SIZEOF_LONG): Define to 4 on x32.
2014-09-07 23:04:50 +01:00
Colin Watson
4d94b2db58 * configure.ac: Remove several unnecessary semicolons. 2014-09-07 20:47:43 +01:00
Colin Watson
1de3a48098 * grub-core/kern/mips/arc/init.c (grub_machine_get_bootlocation):
Initialise pend to pacify GCC.
2014-08-25 15:19:48 -07:00
Andrey Borzenkov
c291f47b2c Fix typo (gettext_print instead of gettext_printf) 2014-08-14 21:02:31 +04:00
Vladimir Serbinenko
3c05833249 * grub-core/term/at_keyboard.c: Retry probing keyboard if
scancode setup failed.
2014-08-13 23:04:01 +02:00
Vladimir Serbinenko
d1224d209b * grub-core/kern/disk_common.c: Clump disk size to 1EiB. 2014-08-10 11:27:36 +02:00
Vladimir Serbinenko
0af3ae2d8b * grub-core/disk/i386/pc/biosdisk.c (grub_biosdisk_rw): Add
safety to avoid triggerring VirtualBox bug.
2014-08-10 11:27:13 +02:00
Vladimir Serbinenko
79c80b06b8 Fix Changelog 2014-08-10 10:04:04 +02:00
Vladimir Serbinenko
33f6ce671f * grub-core/fs/cbfs.c: Don't probe disks of unknow size.
Fixes hang on virtualbox.
2014-08-10 09:50:36 +02:00
Colin Watson
0901e7855f Fix an infinite loop in grub-mkconfig
* util/grub.d/10_hurd.in: Make kernel list progression not fail on
kernels whose paths contain regex metacharacters.
* util/grub.d/10_kfreebsd.in: Likewise.
* util/grub.d/10_linux.in: Likewise.
* util/grub.d/20_linux_xen.in: Likewise.

Reported by: Heimo Stranner.
2014-07-08 23:54:30 +01:00
Colin Watson
4250f552a6 * docs/grub-dev.texi (Finding your way around): The build system no
longer uses AutoGen directly.
2014-06-26 14:20:17 +01:00
Роман Пехов
1f6af2a9f8 * grub-core/commands/loadenv.c (check_blocklists): Fix overlap check. 2014-06-22 03:51:50 +04:00
Glenn Washburn
fa33530870 * util/grub-install.c: Fix handling of --disk-module. 2014-06-22 01:45:11 +02:00
Stephane Rochoy
15bd333e10 * grub-core/loader/i386/bsd.c (grub_netbsd_boot): Pass pointer to
EFI system table.
2014-06-22 01:35:52 +02:00
Stephane Rochoy
3f3ec8ef44 * grub-core/commands/efi/lsefisystab.c (grub_cmd_lsefisystab): Show
EFI system table physical address.
2014-06-22 01:34:57 +02:00
Trevor Woerner
87de66d9d8 * util/grub-gen-asciih.c (add_glyph): Fix uninitialised variable. 2014-06-21 20:26:47 +02:00
Vladimir Serbinenko
2c2c5c720d * grub-core/commands/verify.c (grub_pubkey_open): Trust procfs. 2014-06-21 20:11:08 +02:00
Vladimir Serbinenko
480c89858e * grub-core/commands/verify.c (grub_pubkey_open): Fix memdisk
check.
2014-06-21 20:10:48 +02:00
Vladimir Serbinenko
4b8b9135f1 * grub-core/kern/misc.c (__bzero): Don't compile in GRUB_UTIL.
Reported by: Yves Blusseau <blusseau@zetam.org>.
2014-04-20 16:12:41 +02:00
Piotr Krysiuk
5a6db38d62 Allow loading old kernels by placing GDT in conventional memory. 2014-04-20 16:00:55 +02:00
Colin Watson
3a310e842f Tolerate devices with no filesystem UUID returned by os-prober
* util/grub.d/30_os-prober.in: Tolerate devices with no filesystem
UUID.  Other parts of grub-mkconfig tolerate these, they were
previously allowed here up to commit
55e706c918, and they can arise in
practice when the system has active LVM snapshots.
Fixes Ubuntu bug #1287436.
2014-04-10 16:54:33 +01:00
Colin Watson
c4badfe836 Improve LVM "logical_volumes" string matching
* grub-core/disk/lvm.c (grub_lvm_detect): Search for
"logical_volumes" block a little more accurately.
2014-04-10 14:42:41 +01:00
Vladimir Serbinenko
a72fc329eb * grub-core/lib/syslinux_parse.c: Fix timeout quoting. 2014-04-06 00:44:44 +02:00
Vladimir Serbinenko
2009da62f2 Add missing #endif 2014-04-04 08:11:15 +02:00
Vladimir Serbinenko
6f6d4aa02c * include/grub/libgcc.h: Remove ctzsi2 and ctzdi2. They're no longer pulled from libgcc. 2014-04-04 08:02:38 +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