Commit graph

32 commits

Author SHA1 Message Date
Peter Jones
f725fa7cb2 calloc: Use calloc() at most places
This modifies most of the places we do some form of:

  X = malloc(Y * Z);

to use calloc(Y, Z) instead.

Among other issues, this fixes:
  - allocation of integer overflow in grub_png_decode_image_header()
    reported by Chris Coulson,
  - allocation of integer overflow in luks_recover_key()
    reported by Chris Coulson,
  - allocation of integer overflow in grub_lvm_detect()
    reported by Chris Coulson.

Fixes: CVE-2020-14308

Signed-off-by: Peter Jones <pjones@redhat.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
2020-07-29 16:55:47 +02:00
Vincent Legoll
53e70d30cf grub-mkrescue: Fix error message about the wrong command having failed: mformat instead of mcopy
Signed-off-by: Vincent Legoll <vincent.legoll@gmail.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
2019-05-20 13:01:11 +02:00
Alexander Graf
f1957dc8a3 RISC-V: Add to build system
This patch adds support for RISC-V to the grub build system. With this
patch, I can successfully build grub on RISC-V as a UEFI application.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
2019-02-25 14:02:05 +01:00
Vladimir Serbinenko
e66dc5d71e Fail if xorriso failed.
If xorriso failed most likely we didn't generate a meaningful image.
2017-08-07 18:08:39 +02:00
Vladimir Serbinenko
9e962fd3c4 mkrescue: Check xorriso presence before doing anything else.
mkrescue can't do anything useful without xorriso, so abort early if it's
not available.
2017-08-07 18:05:17 +02:00
Vladimir Serbinenko
ff84a9b868 Error out if mtools invocation fails. 2016-01-22 19:28:08 +01:00
Vladimir Serbinenko
dbab354157 grub-mkrescue: Delete temporary file
Reported by: Thomas Schmitt
2015-12-29 17:48:34 +01:00
Vladimir Serbinenko
2dcf260d89 util/grub-mkrescue: Fix compilation 2015-05-07 19:45:06 +02:00
Vladimir Serbinenko
5fd1cb980a grub-mkrescue: Recognize -output as an alias of --output.
This helps us to be in line with xorriso -as mkisofs.

Suggested by: Thomas Schmitt
2015-05-07 16:34:34 +02:00
Vladimir Serbinenko
70b002de55 Remove -V in grub-mkrescue.c
It clashhes with -V which is alias to -volid.
2015-04-24 17:52:30 +02:00
Vladimir Serbinenko
cf47a2fba5 grub-mkrescue: pass all unrecognized options unchanged to xorriso. 2015-03-20 12:55:27 +01:00
Vladimir Serbinenko
eeea31b220 util/grub-mkrescue.c: Always include part_msdos and part_gpt on EFI.
When booted from stick, EFI would use GPT partition and our root
device detection algortihm depends on GRUB's ability to see the same
partitions. Hence include msdos and gpt partmap modules on EFI even when
they're not needed to access root filesystem.
2015-01-24 17:45:16 +01:00
Vladimir Serbinenko
006c78f378 * util/grub-mkrescue.c: Build fix for argp.h with older gcc. 2014-02-03 14:35:51 +01:00
Andrey Borzenkov
0776112c53 add part_apple to EFI rescue image to fix missing prefix
On Mac rescue image is booted from HFS+ partition, so bootpath looks like
/ACPI(a0341d0,0)/PCI(1,1f)/ATAPI(0,0,0)/HD(3,5d1,ca3,0000000000000000,20,0)/EndEntire

grub fails to find device for this path because it cannot scan partition
table. The simplest fix is to add part_apple by default.
2014-01-12 15:29:21 +04:00
Andrey Borzenkov
e7cfa8d5e1 Change grub-mkrescue to use bootaa64.efi too
Also add ChangeLog entry for previous change.
2014-01-07 20:34:25 +04:00
Vladimir Serbinenko
808e97c4e7 ARM64 support for grub-mkrescue. 2013-12-23 18:17:09 +01:00
Andrey Borzenkov
3bf2db8959 split grub-mkresecue help text to facilitate translations
Split single string in help message into several strings used before in shell
grub-mkrescue to minimize changes to existing translations.

Reported by Benno Schulenberg
2013-12-22 22:51:54 +04:00
Vladimir Serbinenko
ae558c2ccf Enable -Wformat=2 if it's supported. 2013-12-21 15:28:28 +01:00
Colin Watson
971038be55 * util/grub-mkrescue.c: Rephrase mkrescue description. 2013-12-21 02:37:14 +01:00
Vladimir Serbinenko
bfdfeb2508 Clarify several translatable messages. 2013-12-21 01:41:16 +01:00
Vladimir Serbinenko
b8765fa082 Implement better integration with Mac firmware. 2013-12-17 15:21:02 +01:00
Vladimir Serbinenko
6cc8959712 * util/grub-mkrescue.c: Fix incorrect file usage in fallback code.
Reported by: Jon McCune
2013-12-17 00:33:55 +01:00
Vladimir Serbinenko
f23bc65103 Transform -C option to grub-mkstandalone to --core-compress available
in all grub-install flavours.
2013-12-07 16:18:22 +01:00
Vladimir Serbinenko
422e6e886c * util/grub-mkrescue.c (main): Check that fread succeeded. 2013-11-29 03:54:21 +01:00
Colin Watson
5c7206e45e Speed up test suite by avoiding fsync
Add grub_util_disable_fd_syncs call to turn grub_util_fd_sync calls into
no-ops, and use it in programs that copy files but do not need to take
special care to sync writes (grub-mknetdir, grub-rescue,
grub-mkstandalone).

On my laptop, this reduces partmap_test's runtime from 1236 seconds to
204 seconds.
2013-11-27 10:10:22 +00:00
Colin Watson
c6a823e267 * util/grub-mkrescue.c (main): If a source directory is not
specified, read platform-specific files from subdirectories of
pkglibdir, not pkgdatadir.
2013-11-21 17:36:45 +00:00
Colin Watson
a1f00cc557 * util/grub-mkrescue.c (main): Fix typo. 2013-11-18 15:30:47 +00:00
Vladimir Serbinenko
96adefdb12 * util/grub-mkrescue.c (main): Fix a typo to make yeeloong part
work again.
2013-11-18 14:36:31 +01:00
Vladimir Serbinenko
4336b5d85e * util/grub-mkrescue.c (make_image_fwdisk_abs): Insert all partmap
modules to be in line with make_image_abs.
2013-11-18 02:03:36 +01:00
Vladimir Serbinenko
6aa6077bcc * util/grub-mkrescue.c (main): Add trailing \n in
.disk_label.contentDetails to be in line with previous shell script.
2013-11-17 02:05:45 +01:00
Vladimir Serbinenko
66c00cb159 * util/grub-mkrescue.c (main): Use right source file for bootinfo.txt. 2013-11-17 02:03:03 +01:00
Vladimir Serbinenko
cd46aa6cef Rewrite grub-install, grub-mkrescue, grub-mkstandalone and grub-mknetdir
the function of these files exceeds what can be sanely handled in shell
	in posix-comaptible way. Also writing it in C extends the functionality
	to non-UNIX-like OS and minimal environments.
2013-11-16 20:21:16 +01:00