Commit Graph

30 Commits

Author SHA1 Message Date
Vladimir Serbinenko ca0a4f689a verifiers: File type for fine-grained signature-verification controlling
Let's provide file type info to the I/O layer. This way verifiers
framework and its users will be able to differentiate files and verify
only required ones.

This is preparatory patch.

Signed-off-by: Vladimir Serbinenko <phcoder@gmail.com>
Signed-off-by: Daniel Kiper <daniel.kiper@oracle.com>
Reviewed-by: Ross Philipson <ross.philipson@oracle.com>
2018-11-09 13:25:31 +01:00
Andrei Borzenkov ec4af117c6 acpi: add missing efi_call wrapper to acpi command
Fixed loading of ACPI tables on EFI (side effect was apparent memory
corruption ranging from unpredictable behavior to system reset).

Reported by Nando Eva <nando4eva@ymail.com>
2017-04-02 14:47:20 +03:00
Andrei Borzenkov 8fe17d91af acpi: fix memory leak
Found by: Coverity scan.
CID: 96673
2016-01-12 20:26:30 +03:00
Vladimir Serbinenko d43a5ee651 tsc: Use alternative delay sources whenever appropriate.
PIT isn't available on some of new hardware including Hyper-V. So
use pmtimer for calibration. Moreover pmtimer calibration is faster, so
use it on coreboor where booting time is important.

Based on patch by Michael Chang.
2015-11-27 11:39:55 +01:00
Andrei Borzenkov 07258815e9 acpi: do not skip BIOS scan if EBDA length is zero
EBDA layout is not standardized so we cannot assume first two bytes
are length. Neither is it required by ACPI standard. HP 8710W is known
to contain zeroes here.

Closes: 45002
2015-05-08 06:15:16 +03:00
Vladimir Serbinenko e1d4520bfb acpi: Fix unused function warning. 2015-02-22 14:42:43 +01:00
Vladimir Serbinenko 4192f2e3d1 commands/acpi: Use ALIGN_UP rather than manual expression.
Improves readability and hopefully automatic scanning.

Found by: Coverity Scan.
2015-01-27 16:32:21 +01:00
Vladimir Serbinenko e902163e48 commands/acpi: Use ALIGN_UP rather than manual expression.
Improves readability and hopefully automatic scanning.

Found by: Coverity Scan.
2015-01-24 20:41:43 +01:00
Vladimir Serbinenko ed55931073 * grub-core/commands/acpi.c: Use grub_addr_t rather than long when
appropriate.
2013-12-15 14:27:04 +01:00
Vladimir 'phcoder' Serbinenko de73de1748 * grub-core/commands/acpi.c: Use sizeof rather than hardcoding the size. 2013-04-05 11:01:19 +02:00
Vladimir 'phcoder' Serbinenko ce7d92a9f2 Add new defines GRUB_RSDP_SIGNATURE_SIZE and GRUB_RSDP_SIGNATURE. 2013-04-05 10:56:43 +02:00
Nickolai Zeldovich efd4f11754 * grub-core/commands/acpi.c (grub_acpi_create_ebda): Don't
dereference null pointer. While the code is technically correct, gcc
	may eliminate a null check if pointer is already dereferenced.
2013-03-07 08:52:29 +01:00
Colin Watson d0d4b8a063 Remove nested functions from memory map iterators.
* grub-core/efiemu/mm.c (grub_efiemu_mmap_iterate): Add hook_data
argument, passed to hook.
* grub-core/kern/i386/coreboot/mmap.c
(grub_linuxbios_table_iterate): Likewise.
(grub_machine_mmap_iterate: iterate_linuxbios_table): Make static
instead of nested.
(grub_machine_mmap_iterate): Add hook_data argument.
* grub-core/kern/i386/multiboot_mmap.c (grub_machine_mmap_iterate):
Add hook_data argument, passed to hook.
* grub-core/kern/i386/pc/mmap.c (grub_machine_mmap_iterate):
Likewise.
* grub-core/kern/i386/qemu/mmap.c (grub_machine_mmap_iterate):
Likewise.
* grub-core/kern/ieee1275/mmap.c (grub_machine_mmap_iterate):
Likewise.
* grub-core/kern/mips/arc/init.c (grub_machine_mmap_iterate):
Likewise.
* grub-core/kern/mips/loongson/init.c (grub_machine_mmap_iterate):
Likewise.
* grub-core/kern/mips/qemu_mips/init.c (grub_machine_mmap_iterate):
Likewise.
* grub-core/mmap/efi/mmap.c (grub_efi_mmap_iterate): Likewise.
(grub_machine_mmap_iterate): Likewise.
* grub-core/mmap/mmap.c (grub_mmap_iterate): Likewise.
* include/grub/efiemu/efiemu.h (grub_efiemu_mmap_iterate): Update
prototype.
* include/grub/memory.h (grub_memory_hook_t): Add data argument.
Remove NESTED_FUNC_ATTR from here and from all users.
(grub_mmap_iterate): Update prototype.
(grub_efi_mmap_iterate): Update prototype.  Update all callers to
pass appropriate hook data.
(grub_machine_mmap_iterate): Likewise.

* grub-core/commands/acpi.c (grub_acpi_create_ebda: find_hook): Make
static instead of nested.
* grub-core/commands/lsmmap.c (grub_cmd_lsmmap: hook): Likewise.
Rename to ...
(lsmmap_hook): ... this.
* grub-core/efiemu/mm.c (grub_efiemu_mmap_init: bounds_hook):
Likewise.
(grub_efiemu_mmap_fill: fill_hook): Likewise.
* grub-core/kern/i386/coreboot/init.c (grub_machine_init:
heap_init): Likewise.
* grub-core/kern/i386/pc/init.c (grub_machine_init: hook): Likewise.
Rename to ...
(mmap_iterate_hook): ... this.
* grub-core/kern/ieee1275/init.c (grub_claim_heap: heap_init):
Likewise.
* grub-core/lib/ieee1275/relocator.c
(grub_relocator_firmware_get_max_events: count): Likewise.
(grub_relocator_firmware_fill_events: fill): Likewise.  Rename
to ...
(grub_relocator_firmware_fill_events_iter): ... this.
* grub-core/lib/relocator.c (grub_relocator_alloc_chunk_align:
hook): Likewise.  Rename to ...
(grub_relocator_alloc_chunk_align_iter): ... this.
* grub-core/loader/i386/bsd.c (generate_e820_mmap: hook): Likewise.
Rename to ...
(generate_e820_mmap_iter): ... this.
* grub-core/loader/i386/linux.c (find_mmap_size: hook): Likewise.
Rename to ...
(count_hook): ... this.
(grub_linux_boot: hook): Likewise.  Rename to ...
(grub_linux_boot_mmap_find): ... this.
(grub_linux_boot: hook_fill): Likewise.  Rename to ...
(grub_linux_boot_mmap_fill): ... this.
* grub-core/loader/i386/multiboot_mbi.c (grub_fill_multiboot_mmap:
hook): Likewise.  Rename to ...
(grub_fill_multiboot_mmap_iter): ... this.
* grub-core/loader/multiboot.c (grub_get_multiboot_mmap_count:
hook): Likewise.  Rename to ...
(count_hook): ... this.
* grub-core/loader/multiboot_mbi2.c (grub_fill_multiboot_mmap:
hook): Likewise.  Rename to ...
(grub_fill_multiboot_mmap_iter): ... this.
* grub-core/loader/powerpc/ieee1275/linux.c
(grub_linux_claimmap_iterate: alloc_mem): Likewise.
* grub-core/loader/sparc64/ieee1275/linux.c (alloc_phys: choose):
Likewise.  Rename to ...
(alloc_phys_choose): ... this.
(determine_phys_base: get_physbase): Likewise.
* grub-core/mmap/i386/mmap.c (grub_mmap_malign_and_register:
find_hook): Likewise.
* grub-core/mmap/i386/pc/mmap.c (preboot: fill_hook): Likewise.
(malloc_hook: count_hook): Likewise.
* grub-core/mmap/i386/uppermem.c (grub_mmap_get_lower: hook):
Likewise.  Rename to ...
(lower_hook): ... this.
(grub_mmap_get_upper: hook): Likewise.  Rename to ...
(upper_hook): ... this.
(grub_mmap_get_post64: hook): Likewise.  Rename to ...
(post64_hook): ... this.
* grub-core/mmap/mips/uppermem.c (grub_mmap_get_lower: hook):
Likewise.  Rename to ...
(lower_hook): ... this.
(grub_mmap_get_upper: hook): Likewise.  Rename to ...
(upper_hook): ... this.
* grub-core/mmap/mmap.c (grub_mmap_iterate: count_hook): Likewise.
(grub_mmap_iterate: fill_hook): Likewise.
(fill_mask): Pass addr and mask within a single struct.
(grub_cmd_badram: hook): Make static instead of nested.  Rename
to ...
(badram_iter): ... this.
(grub_cmd_cutmem: hook): Likewise.  Rename to ...
(cutmem_iter): ... this.
2013-01-15 12:02:35 +00:00
Vladimir 'phcoder' Serbinenko 4a92934301 * grub-core/commands/acpi.c (options): Fix a dot in the middle of the
sentence.
	Reported by: Milo Casagrande.
2012-03-06 15:03:33 +01:00
Vladimir 'phcoder' Serbinenko bb51c6c647 * grub-core/commands/acpi.c: Add TRANSLATORS comments.
* grub-core/commands/gptsync.c: Likewise.
	* grub-core/commands/hashsum.c: Likewise.
	* grub-core/commands/i386/pc/sendkey.c: Likewise.
	* grub-core/commands/legacycfg.c: Likewise.
	* grub-core/io/gzio.c: Likewise.
	* grub-core/net/net.c: Likewise.
	* grub-core/term/gfxterm.c: Likewise.
	* grub-core/term/terminfo.c: Likewise.
	* grub-core/tests/test_blockarg.c: Likewise.
	* grub-core/video/video.c: Likewise.
	* util/grub-install.in: Likewise.
	* util/grub-mkfont.c: Likewise.
2012-03-06 14:11:10 +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 9c4b5c13e6 Improve gettext support. Stylistic fixes and error handling fixes while
on it.
2012-02-08 19:26:01 +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 f2b60fbdb8 Replace UINT_TO_PTR and PTR_TO_UINT with explicit grub_addr_t casts.
* include/grub/types.h (UINT_TO_PTR): Removed. All users switched to
	grub_addr_t casts.
	(PTR_TO_UINT64): Likewise.
	(PTR_TO_UINT32): Likewise.
2011-12-15 19:59:49 +01:00
Vladimir 'phcoder' Serbinenko cc8f366887 * grub-core/commands/acpi.c (grub_acpi_create_ebda) [!x86]: Disable.
(grub_cmd_acpi) [!x86]: Disable EBDA.
2011-12-13 00:55:00 +01:00
Vladimir 'phcoder' Serbinenko e745cf0ca6 Implement automatic module license checking according to new GNU
guidelines.

	* grub-core/kern/dl.c (grub_dl_check_license): New function.
	(grub_dl_load_core): Use grub_dl_check_license.
	* include/grub/dl.h (GRUB_MOD_SECTION): New macro.
	(GRUB_MOD_LICENSE): Likewise.
	(GRUB_MOD_DUAL_LICENSE): Likewise.
	All modules updated.
2011-04-11 23:01:51 +02:00
Vladimir 'phcoder' Serbinenko a1d84a5e5e Unify memory types.
* grub-core/Makefile.am (KERNEL_HEADER_FILES): Include memory.h.
	* grub-core/commands/lsmmap.c (grub_cmd_lsmmap): Output user-readable
	types.
	* grub-core/kern/i386/multiboot_mmap.c (grub_lower_mem): Removed.
	(grub_upper_mem): Likewise.
	* grub-core/kern/ieee1275/init.c (grub_upper_mem): Likewise.
	* include/grub/memory.h (grub_memory_type_t): New enum.
	All users updated.
2010-09-19 00:04:31 +02:00
Vladimir 'phcoder' Serbinenko ed80f7d586 * include/grub/command.h (GRUB_COMMAND_FLAG_CMDLINE): Removed. All
users updated.
	(GRUB_COMMAND_FLAG_MENU): Likewise.
	(GRUB_COMMAND_FLAG_BOTH): Likewise.
	(GRUB_COMMAND_FLAG_TITLE): Removed.
	(GRUB_COMMAND_FLAG_NO_ECHO): Likewise.
	(GRUB_COMMAND_FLAG_EXTCMD): Moved into enum.
	(GRUB_COMMAND_FLAG_DYNCMD): Likewise.
	(GRUB_COMMAND_FLAG_BLOCKS): Likewise.
	(grub_command_flags_t): New enum. All users updated.
2010-09-14 23:06:01 +02:00
Tristan Gingold 126b4c32ab * commands/lsacpi.c: New file.
* grub-core/Makefile.core.def (lsacpi): New module.
	* include/grub/acpi.h (GRUB_ACPI_FADT_SIGNATURE): New definition.
	(GRUB_ACPI_MADT_SIGNATURE): Likewise.
	(grub_acpi_madt_entry_header): New struct.
	(grub_acpi_madt): Likewise.
	(grub_acpi_madt_entry_interrupt_override): Likewise.
	(grub_acpi_madt_entry_sapic): Likewise.
	(grub_acpi_madt_entry_lsapic): Likewise.
	(grub_acpi_madt_entry_platform_int_source): Likewise.
	* include/grub/types.h (PRIxGRUB_UINT32_T): New definition.
	(PRIuGRUB_UINT32_T): Likewise.
	(PRIxGRUB_UINT64_T): Likewise.

	Also-By: Robert Millan <rmh.grub@aybabtu.com>

	Also-By: Vladimir Serbinenko <phcoder@gmail.com>
2010-09-11 17:48:54 +02:00
Vladimir 'phcoder' Serbinenko fc2ef1172c * grub-core/io/gzio.c (grub_gzio_open): Removed "transparent" parameter.
Made static.
	(grub_gzfile_open): Removed. All users updated.
	(GRUB_MOD_INIT): New function.
	(GRUB_MOD_FINI): Likewise.
	* grub-core/kern/file.c (grub_file_filters_all): New variable.
	(grub_file_filters_enabled): Likewise.
	(grub_file_open): Handle filters.
	* grub-core/loader/i386/bsd.c (GRUB_MOD_INIT): Load gzio.
	* grub-core/normal/main.c (GRUB_MOD_INIT): Likewise.
	* include/grub/file.h (grub_file_filter_id_t): New type.
	(grub_file_filter_t): Likewise.
	(grub_file_filters_all): New extern variable.
	(grub_file_filters_enabled): Likewise.
	(grub_file_filter_register): New inline function.
	(grub_file_filter_unregister): Likewise.
	(grub_file_filter_disable): Likewise.
	(grub_file_filter_disable_compression): Likewise.
	* include/grub/gzio.h: Removed.
2010-09-05 13:05:36 +02:00
Vladimir 'phcoder' Serbinenko df3df23d5c Reorganise memory map handling 2010-09-04 17:10:10 +02:00
Tristan Gingold 1782b135e5 * commands/lsacpi.c: New file.
* grub-core/Makefile.core.def (lsacpi): New module.
	* include/grub/acpi.h (GRUB_ACPI_FADT_SIGNATURE): New definition.
	(GRUB_ACPI_MADT_SIGNATURE): Likewise.
	(grub_acpi_madt_entry_header): New struct.
	(grub_acpi_madt): Likewise.
	(grub_acpi_madt_entry_interrupt_override): Likewise.
	(grub_acpi_madt_entry_sapic): Likewise.
	(grub_acpi_madt_entry_lsapic): Likewise.
	(grub_acpi_madt_entry_platform_int_source): Likewise.
	* include/grub/types.h (PRIxGRUB_UINT32_T): New definition.
	(PRIuGRUB_UINT32_T): Likewise.
	(PRIxGRUB_UINT64_T): Likewise.

	Also-By: Robert Millan <rmh.grub@aybabtu.com>

	Also-By: Vladimir Serbinenko <phcoder@gmail.com>
2010-09-01 01:05:32 +02:00
BVK Chaitanya 928bad4708 merge with mainline 2010-08-26 09:30:11 +05:30
BVK Chaitanya 16c7cb32c8 merge with mainline 2010-08-19 16:54:00 +05:30
BVK Chaitanya 8c41176882 automake commit without merge history 2010-05-06 11:34:04 +05:30