Commit graph

21 commits

Author SHA1 Message Date
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
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
Vladimir 'phcoder' Serbinenko
92750e4c60 Add ability to generate newc additions on runtime. 2013-03-22 21:01:28 +01:00
Vladimir 'phcoder' Serbinenko
1a2fd1e674 * include/grub/misc.h (ALIGN_UP_OVERHEAD): New define.
* grub-core/loader/i386/linux.c (grub_cmd_initrd): Align initrds at 4.
	* grub-core/loader/i386/pc/linux.c (grub_cmd_initrd): Likewise.
	* grub-core/loader/ia64/efi/linux.c (grub_cmd_initrd): Likewise.
	* grub-core/loader/mips/linux.c (grub_cmd_initrd): Likewise.
	* grub-core/loader/powerpc/ieee1275/linux.c (grub_cmd_initrd): Likewise.
	* grub-core/loader/sparc64/ieee1275/linux.c (grub_cmd_initrd): Likewise.
2012-03-05 01:17:55 +01:00
Vladimir 'phcoder' Serbinenko
67093bc0ed Another round of string clarification and adding TRANSLATORS comments. 2012-02-26 17:28:05 +01:00
Vladimir 'phcoder' Serbinenko
ebcecdf1c3 Increase warning level.
* conf/Makefile.common (CFLAGS_GNULIB): Add -Wno-redundant-decls
	-Wno-unreachable-code -Wno-conversion -Wno-old-style-definition.
	* configure.ac (HOST_CFLAGS): Add bunch of -W arguments.
	(TARGET_CFLAGS): Likewise.
	(HOST_CFLAGS): Add -Werror unless --disable-werror is activated.
	* grub-core/Makefile.core.def (decompressor_xz): Add
	-Wno-unreachable-code.
	(normal): Add -Wno-redundant-decls.
	(xzio): Add -Wno-unreachable-code.
	(lzopio): Add -Wno-redundant-decls -Wno-error.
	* grub-core/commands/acpi.c: Add exception to -Wcast-align.
	* grub-core/commands/lsacpi.c: Add exception to -Wcast-align.
	* grub-core/gensymlist.sh: Add exception to -Wmissing-format-attribute.
	* grub-core/kern/dl.c: Add exception to -Wcast-align.
	* grub-core/kern/efi/efi.c (grub_efi_modules_addr): Likewise.
	* grub-core/kern/i386/coreboot/init.c: Add exception to
	-Wsuggest-attribute=noreturn.
	* grub-core/kern/ia64/dl.c: Add exception to -Wcast-align.
	* grub-core/kern/ia64/dl_helper.c: Likewise.
	* grub-core/kern/mips/dl.c: Likewise.
	* grub-core/kern/sparc64/dl.c: Likewise.
	* grub-core/lib/LzmaEnc.c: Add exception to -Wshadow.
	* grub-core/lib/libgcrypt_wrap/cipher_wrap.h (memcpy): Likewise.
	(memcmp): Likewise.
	* grub-core/lib/pbkdf2.c: Add exception to -Wunreachable-code.
	* grub-core/loader/ia64/efi/linux.c: Add exception to -Wcast-align.
	* grub-core/loader/mips/linux.c: Likewise.
	* grub-core/loader/multiboot_elfxx.c: Likewise.
	* grub-core/script/parser.y: Add exception to -Wunreachable-code.
	* grub-core/video/sm712.c: Add exception to -Wcast-align.
	* util/import_gcry.py: Add -Wno-cast-align to modules checked by hand.
	* grub-core/font/font.c (grub_font_loader_init): Add explicit cast and
	fixme.
	* grub-core/fs/iso9660.c (grub_iso9660_iterate_dir): Likewise.
	* grub-core/kern/i386/multiboot_mmap.c (grub_machine_mmap_init):
	Fix prototype.
2012-02-10 16:48:48 +01:00
Vladimir 'phcoder' Serbinenko
44c6828db4 * grub-core/loader/i386/xnu.c (grub_xnu_boot): Fix printf.
* grub-core/loader/ia64/efi/linux.c (grub_cmd_fpswa): Likewise.
2012-02-09 23:32:03 +01:00
Vladimir 'phcoder' Serbinenko
690c531fc5 Remove "payload" command in ia64 Linux loader since I couldn't
find any evidence of it being used for anything.
	Replace "relocate" command with an environment variable

	* grub-core/loader/ia64/efi/linux.c (ia64_boot_param): Remove extra
	fields.
	(ia64_boot_payload): Removed.
	(last_payload): Likewise.
	(RELOCATE_OFF): Likewise.
	(RELOCATE_ON): Likewise.
	(RELOCATE_FORCE): Likewise.
	(relocate): Likewise.
	(free_pages): Don't free payloads.
	(grub_load_elf64): Use common error messages.
	Use "linux_relocate" variable.
	Increase the space after boot_params.
	(grub_cmd_payload): Removed.
	(grub_cmd_relocate): Likewise.
	(grub_cmd_fpswa): Improve messages.
	(cmd_payload): Removed.
	(cmd_relocate): Likewise.
	(GRUB_MOD_INIT): Don't register "payload" and "relocate".
	(GRUB_MOD_FINI): Don't unregister "payload" and "relocate".
2012-02-09 15:09:40 +01:00
Vladimir 'phcoder' Serbinenko
9c4b5c13e6 Improve gettext support. Stylistic fixes and error handling fixes while
on it.
2012-02-08 19:26:01 +01:00
Vladimir 'phcoder' Serbinenko
b525fd834d Clarify and unify messages.
* grub-core/commands/hashsum.c (options): Unify messages.
	* grub-core/commands/keystatus.c (GRUB_MOD_INIT): Don't mark a
	literal-only message as translatable.
	* grub-core/commands/lsacpi.c (GRUB_MOD_INIT): Likewise.
	* grub-core/loader/ia64/efi/linux.c (GRUB_MOD_INIT): Likewise.
	* grub-core/commands/legacycfg.c (GRUB_MOD_INIT): Add quoting around
	commands.
	* grub-core/commands/menuentry.c (options): Clarify that it's a keyboard
	key, not the key used to unlock. Clarify what it's used for.
	* grub-core/kern/emu/hostdisk.c (read_device_map): Unify error message.
	* grub-core/loader/xnu.c (grub_xnu_load_driver): Remove erroneous colon.
	* grub-core/script/main.c (GRUB_MOD_INIT): Clarify [n] to be [NUM].
	* util/grub-editenv.c (options): Unify "verbose" message.
	* util/grub-fstest.c (read_file): Unify error message.
	(fstest): Add quotes around commands.
	(options): Unify "verbose" message.
	* util/grub-install.in: Add quotes around variable name.
	* util/grub-kbdcomp.in: Unify error message.
	* util/grub-mkfont.c (main): Likewise.
	* util/grub-mkrescue.in: Likewise.
	* util/grub-mklayout.c (options): Unify "verbose" message.
	* util/grub-mkstandalone.in: Unify help and verbose messages.
	* util/grub-mount.c (options): Unify "verbose" message.
	* util/grub-probe.c (options): Likewise.
	* util/grub-script-check.c (options): Likewise.
	* util/grub-setup.c (setup): Unify no-terminator message.
	(options): Use DEVICE and not DEV.
	Unify "verbose" message.
	* util/ieee1275/ofpath.c (xrealpath): Unify error message.
2012-02-05 11:23:47 +01:00
Vladimir 'phcoder' Serbinenko
347998c27f * grub-core/loader/ia64/efi/linux.c (find_mmap_size): Replace fatal with
error.
	(allocate_pages): Check return value.
	Replace fatal with error.
	(grub_linux_boot): Replace printf with dprintf.
	Check find_mmap_size return value.
	Replace fatal with error.
	Don't call grub_machine_fini.
	(grub_load_elf64): Replace printf with dprintf.
	(grub_cmd_linux): Likewise.
	(grub_cmd_initrd): Likewise.
	(grub_cmd_payload): Likewise.
2012-02-03 13:53:12 +01:00
Vladimir 'phcoder' Serbinenko
4a9f8346c9 * grub-core/commands/ls.c: Gettextize.
* grub-core/commands/setpci.c: Likewise.
        * grub-core/commands/videotest.c: Likewise.
        * grub-core/disk/geli.c: Likewise.
        * grub-core/kern/mm.c: Likewise.
        * grub-core/lib/relocator.c: Likewise.
        * grub-core/loader/efi/appleloader.c: Likewise.
        * grub-core/loader/i386/xnu.c: Likewise.
        * grub-core/loader/ia64/efi/linux.c: Likewise.
        * grub-core/loader/xnu.c: Likewise.
        * grub-core/net/dns.c: Likewise.
        * grub-core/net/net.c: Likewise.
        * grub-core/script/lexer.c: Likewise.
        * grub-core/script/parser.y: Likewise.
        * grub-core/script/yylex.l: Likewise.
        * util/getroot.c: Likewise.
        * util/grub-setup.c: Likewise.
2012-02-03 11:56:49 +01:00
Vladimir 'phcoder' Serbinenko
280d9d3e3e * grub-core/disk/dmraid_nvidia.c (grub_dmraid_nv_detect): Skip
disks with unknown size.
	* grub-core/disk/raid.c (scan_devices): Allow disks with unknown sizes.
2012-01-14 11:42:52 +01:00
Vladimir 'phcoder' Serbinenko
3c76ea0c2c * util/grub.d/30_os-prober.in: Fix occurence of grub-probe instead of
grub_probe.
	Reported by: adamwill
2012-01-13 13:54:24 +01:00
Vladimir 'phcoder' Serbinenko
7a45a539db Don't override more informative errors.
* grub-core/commands/acpi.c (grub_cmd_acpi): Don't override errors.
	* grub-core/font/font.c (open_section): Likewise.
	* grub-core/loader/i386/bsd.c (grub_bsd_load_aout): New argument
	filename. Don't override errors.
	(grub_cmd_openbsd_ramdisk): Don't override errors.
	* grub-core/loader/i386/linux.c (grub_cmd_linux): Likewise.
	(grub_cmd_initrd): Likewise.
	* grub-core/loader/i386/pc/linux.c (grub_cmd_linux): Likewise.
	(grub_cmd_initrd): Likewise.
	* grub-core/loader/ia64/efi/linux.c (grub_load_elf64): Likewise.
	(grub_cmd_linux): Likewise.
	(grub_cmd_initrd): Likewise.
	(grub_cmd_payload): Likewise.
	* grub-core/loader/mips/linux.c (grub_cmd_initrd): Likewise.
	* grub-core/loader/multiboot.c (grub_cmd_multiboot): Likewise.
	(grub_cmd_module): Likewise.
	* grub-core/loader/powerpc/ieee1275/linux.c (grub_cmd_initrd): Likewise.
	* grub-core/loader/sparc64/ieee1275/linux.c (grub_cmd_initrd): Likewise.
	* grub-core/loader/xnu.c (grub_xnu_load_driver): Likewise.
	(grub_cmd_xnu_mkext): Likewise.
	(grub_cmd_xnu_ramdisk): Likewise.
	(grub_xnu_check_os_bundle_required): Likewise.
	(grub_xnu_load_kext_from_dir): Likewise.
	(grub_cmd_xnu_kextdir): Likewise.
	* grub-core/loader/xnu_resume.c (grub_xnu_resume): Likewise.
2011-12-26 12:58:08 +01:00
Vladimir 'phcoder' Serbinenko
005dd67cb6 * grub-core/disk/ahci.c: Add missing license statements.
* grub-core/fs/romfs.c: Likewise.
	* grub-core/lib/ia64/setjmp.S: Likewise.
	* grub-core/loader/i386/pc/freedos.c: Likewise.
	* grub-core/loader/ia64/efi/linux.c: Likewise.
	* grub-core/video/colors.c: Likewise.
	* include/grub/dl.h (GRUB_MOD_DEP): New macro.
2011-06-24 00:29:21 +02:00
phcoder
c18271ed00 Fix compilation errors 2011-01-03 02:28:14 +01:00
Vladimir 'phcoder' Serbinenko
4bec80482e Remove few bad hunks 2010-09-01 10:21:05 +02:00
Vladimir 'phcoder' Serbinenko
c84a9b54ad remove allocate_boot_pages and free_boot_pages. They are pointless now 2010-09-01 09:43:36 +02:00
Vladimir 'phcoder' Serbinenko
afef75b254 Use finish boot services and switch to new command line interface in linux loader 2010-09-01 03:05:36 +02:00
Vladimir 'phcoder' Serbinenko
6585de4c0c merge mainline into ia64 2010-08-31 21:47:26 +02:00