Commit graph

1968 commits

Author SHA1 Message Date
Andrei Borzenkov
1018e91dce mkimage: zero fill alignment space
This did not cause real problem but is good for reproducible builds. I hit
it with recent bootinfoscript that displays embedded config; I was puzzled
by random garbage at the end.

Prezero memory buffer used to assemble core.img. This makes individual
memset redundant. Also ensure buffer is filled with zeroes in several other
places.

Also remove redundant zeroing code where we fill in the whole memory block
anyway.
2015-11-06 21:33:28 +03:00
Eric Snowberg
8cb4c4edbe sparc64 - use correct drive name within grub_util_sparc_setup
Incorrect drive name was being passed into grub_util_sparc_setup,
causing the grub-install to fail.

Signed-off-by: Eric Snowberg <eric.snowberg@oracle.com>
2015-10-07 19:51:57 +03:00
Vladimir Serbinenko
a2721778e5 grub-install: Use a+ in fopen rather than r+.
r+ does not create a file if none exists.
2015-07-27 12:42:47 +02:00
Andrei Borzenkov
4358e0c81e grub-probe: fix memory leak in probe (ofpath)
Found by: Coverity scan.
CID: 73772
2015-06-19 20:47:44 +03:00
Andrei Borzenkov
03f1f24e37 grub-probe: restructure code to make static analysis easier
Current code in probe() could not be verified to not contain memory leaks.
Restructure code and ensure grub_device_close is always called at the end of
loop.

Calms down Coverity scan.
CID: 73739
2015-06-19 20:47:43 +03:00
Andrei Borzenkov
5082ea6184 remove extra newlines in grub_util_* strings
grub_util_{info,warn,error} already add trailing newlines, so remove
them from format strings. Also trailing full stops are already added.
2015-05-13 09:47:17 +03:00
Vladimir Serbinenko
2dcf260d89 util/grub-mkrescue: Fix compilation 2015-05-07 19:45:06 +02:00
Vladimir Serbinenko
9916ed6f82 grub-install-common: Increase buf size to 8192 as modinfo.sh is bigger. 2015-05-07 17:09:58 +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
Andrei Borzenkov
104dff36ea grub-mkconfig: use $pkgdatadir in scripts
Otherwise scripts will source wrong grub-mkconfig_lib.
2015-04-29 19:18:54 +03: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
Andrei Borzenkov
12bf557039 do not emit cryptomount without crypto UUID 2015-03-28 22:13:35 +03:00
Daniel Kahn Gillmor
85a7be2414 util/mkimage: Use stable timestamp when generating binaries. 2015-03-27 13:26:48 +01:00
Vladimir Serbinenko
cf47a2fba5 grub-mkrescue: pass all unrecognized options unchanged to xorriso. 2015-03-20 12:55:27 +01:00
Vladimir Serbinenko
27d1a67f8a Fix canonicalize_file_name clash.
canonicalize_file_name clashed with gnulib function. Additionally
it was declared in 2 places: emu/misc.h and util/misc.h. Added
grub_ prefix and removed second declaration.
2015-03-04 01:00:19 +01:00
Andrei Borzenkov
018f79da6f grub-probe: free temporary variable 2015-02-28 20:19:57 +03:00
Vladimir Serbinenko
afd6b6bbae grub-probe: Mark a "[default=]" for translation. 2015-02-28 16:22:46 +01:00
Jiri Slaby
32cd33bd19 util: mkimage, fix gcc5 build failure
gcc5 reports:
../util/mkimage.c: In function 'grub_install_get_image_target':
../util/mkimage.c:954:5: error: loop exit may only be reached after undefined behavior [-Werror=aggressive-loop-optimizations]
     && j < ARRAY_SIZE (image_targets[i].names); j++)
     ^
../util/mkimage.c:953:39: note: possible undefined statement is here
      for (j = 0; image_targets[i].names[j]
                                        ^

Well, let's move the index 'j' test before accesing the array to:
1) make the loop obvious
2) make gcc happy

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
2015-02-12 22:18:01 +03:00
Andrei Borzenkov
016875dd52 setup: fix blocklist size calculation
Found by: Coverity scan.
2015-01-30 22:57:39 +03:00
Andrei Borzenkov
151c19a42a grub-fstest: fix descriptor leak
Found by: Coverity scan.
2015-01-30 22:45:58 +03:00
Andrei Borzenkov
7aaed66455 grub-mkimage: fix potential NULL pointer dereference
Move fatal check whether symtab_section is NULL before first reference.

Found by: Coverity scan.
2015-01-30 22:26:05 +03:00
Andrei Borzenkov
11aae26cc3 util/grub-probe: fix memory leaks.
Found by: Coverity scan.
2015-01-27 22:11:52 +03:00
Vladimir Serbinenko
9ee5ae1fae Document intentional fallthroughs.
Found by: Coverity scan.
2015-01-27 17:17:58 +01:00
Andrei Borzenkov
bd196014ec util/setup: fix memory leak.
Found by: Coverity scan.
2015-01-26 23:04:09 +03:00
Andrei Borzenkov
fe4efe0d50 util/mkimage: fix memory leaks.
Found by: Coverity scan.
2015-01-26 23:04:09 +03:00
Andrei Borzenkov
1a87156e01 util/grub-mount: fix descriptor leak.
Found by: Coverity scan.
2015-01-26 23:04:09 +03:00
Andrei Borzenkov
bd4e20eedf util/grub-mkstandalone: fix memory leak.
Found by: Coverity scan.
2015-01-26 23:04:09 +03:00
Andrei Borzenkov
be0743b052 util/grub-install: rearrange code to avoid memory leak.
Found by: Coverity scan.
2015-01-26 23:04:09 +03:00
Andrei Borzenkov
5e27fb06f2 util/install: fix memory leak.
Found by: Coverity scan.
2015-01-26 23:04:09 +03:00
Andrei Borzenkov
64440daa21 util/setup: fix memory leak.
Found by: Coverity scan.
2015-01-26 23:04:09 +03:00
Vladimir Serbinenko
11eed6abce util/misc.c: Check ftello return value.
Found by: Coverity scan.
2015-01-26 09:56:24 +01:00
Vladimir Serbinenko
5d61a6a612 grub-macbless: Fix resource leak.
Found by: Coverity scan.
2015-01-26 09:55:58 +01:00
Vladimir Serbinenko
3c6384832b grub-install: Fix memory leak.
Found by: Coverity scan.
2015-01-26 09:55:30 +01:00
Vladimir Serbinenko
c3f5230597 grub-install-common: Fix sizeof usage.
Found by: Coverity scan.
2015-01-26 09:54:50 +01:00
Vladimir Serbinenko
866f469683 util/getroot: Add missing grub_disk_close.
Found by: Coverity scan.
2015-01-26 09:54:14 +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
Andrei Borzenkov
cdae5bf208 Avoid use of non-portable echo -n in grub-mkconfig
util/grub-mkconfig_lib.in(version_test_gt): "echo -n" is not really needed,
final newline is stripped by command substitution.

util/grub.d/10_kfreebsd.in, util/grub.d/10_linux.in,
util/grub.d/20_linux_xen.in: change how list is built, to avoid echo -n
completely.

util/grub.d/30_os-prober.in: add spaces to printed line directly

Closes 43668.
2014-12-07 14:56:17 +03:00
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
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
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
Andrey Borzenkov
c291f47b2c Fix typo (gettext_print instead of gettext_printf) 2014-08-14 21:02:31 +04: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
Glenn Washburn
fa33530870 * util/grub-install.c: Fix handling of --disk-module. 2014-06-22 01:45:11 +02:00
Trevor Woerner
87de66d9d8 * util/grub-gen-asciih.c (add_glyph): Fix uninitialised variable. 2014-06-21 20:26:47 +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
24024dac7f Fix partmap, cryptodisk, and abstraction handling in grub-mkconfig.
Commit 588744d0dc caused grub-mkconfig
no longer to be forgiving of trailing spaces on grub-probe output
lines, which among other things means that util/grub.d/10_linux.in
no longer detects LVM.  To fix this, make grub-probe's output
delimiting more consistent.  As a bonus, this improves the coverage
of the -0 option.

Fixes Debian bug #735935.

* grub-core/disk/cryptodisk.c
(grub_util_cryptodisk_get_abstraction): Add a user-data argument.
* grub-core/disk/diskfilter.c (grub_diskfilter_get_partmap):
Likewise.
* include/grub/cryptodisk.h (grub_util_cryptodisk_get_abstraction):
Update prototype.
* include/grub/diskfilter.h (grub_diskfilter_get_partmap): Likewise.
* util/grub-install.c (push_partmap_module, push_cryptodisk_module,
probe_mods): Adjust for extra user-data arguments.
* util/grub-probe.c (do_print, probe_partmap, probe_cryptodisk_uuid,
probe_abstraction): Use configured delimiter.  Update callers.
2014-03-31 14:48:46 +01:00
Colin Watson
9b35fe819f Fix grub-probe -0 option
* util/grub-probe,c (options): Make -0 work again (broken by
conversion to argp).
(main): Simplify logic.
2014-03-31 13:51:17 +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
Vladimir Serbinenko
511ece7ceb * util/grub-mkfont.c: Build fix for argp.h with older gcc. 2014-02-03 14:34:27 +01:00