Commit graph

370 commits

Author SHA1 Message Date
Andrei Borzenkov
527eeeeee6 core: add LVM RAID1 support
Closes 44534.
2015-03-19 21:30:27 +03:00
Vladimir Serbinenko
87ec3b7fa9 Don't continue to query block-size if disk doesn't have it.
Stops poluting screen with a lot of "block-size: exception -21".
2015-03-03 20:50:37 +01:00
Vladimir Serbinenko
67a6a9512a raid6: Optimize by removing division. 2015-02-26 22:07:22 +01:00
Vladimir Serbinenko
f76c98b79e dmraid_nvidia: Fix division by 0 and missing byte-swap. 2015-02-26 22:06:19 +01:00
Vladimir Serbinenko
94f701a826 crypto: restrict cipher block size to power of 2.
All current ciphers have blocks which are power of 2 and it's
unlikely to change. Other block length would be tricky to handle anyway.
This restriction allows avoiding extra divisions.
2015-02-26 22:04:40 +01:00
Vladimir Serbinenko
967e5aa591 ofdisk: Exclude floppies from scanning.
It causes similar hang as CD on at least the qemu.
2015-02-21 16:16:48 +01:00
Andrei Borzenkov
8f5ebb1245 diskfilter_make_raid: more memory leaks in failure path 2015-02-15 10:14:07 +03:00
Vladimir Serbinenko
2ae9457e6e disk/lvm: Use zalloc to ensure that segments are initialised to sane value.
Reported by: EmanueL Czirai.
2015-02-14 20:31:00 +01:00
Andrei Borzenkov
fc535b32b9 diskfilter: fix double free of lv names for mdraid
Avoid micro-optimization in grub_diskfilter_make_raid and make sure
name and fullname are independent strings. This avoids need to special
case it everywhere else.

Also fix memory leak in failure case in grub_diskfilter_make_raid.

Closes: 41582
2015-02-14 19:08:58 +03:00
Andrei Borzenkov
e27fdbd686 diskfilter: fix crash in validate_lv for mdraid arrays
Commit 750f4bacd3 put LV validation before
actual vg assignment. Make grub_diskfilter_make_raid to assign ->vg as
happens in other cases for consistency. Also clean up redundant code and add
explicit NULL lv->vg check in validate_lv.

Also fix segment validation in validate_lv; it became obvious when crash
was fixed.

Closes: 44199
2015-02-14 17:56:01 +03:00
Vladimir Serbinenko
9ee5ae1fae Document intentional fallthroughs.
Found by: Coverity scan.
2015-01-27 17:17:58 +01:00
Vladimir Serbinenko
d1130afa5f biosdisk: Add missing cast.
Found by: Coverity scan.
2015-01-24 21:50:30 +01:00
Vladimir Serbinenko
7656b72b17 disk/geli: Add missing free.
Found by: Coverity scan.
2015-01-24 21:47:51 +01:00
Vladimir Serbinenko
6f43e350ed disk/geli: Add missing seek success check.
Found by: Coverity scan.
2015-01-24 21:46:23 +01:00
Vladimir Serbinenko
f2baeb194b disk/diskfilter: Add missing lv presence check.
Found by: Coverity scan.
2015-01-24 21:44:27 +01:00
Vladimir Serbinenko
4c7337bfe9 disk/cryptodisk: Add missing error check.
Found by: Coverity scan.
2015-01-24 21:38:22 +01:00
Vladimir Serbinenko
2a8200bba8 disk/ahci: Fix device_map_range argument.
Argument is not used on x86, hence it's gone unnoticed.

Found by: Coverity scan.
2015-01-24 21:37:28 +01:00
Vladimir Serbinenko
7d97335942 disk/AFsplitter: check argument validity before doing any allocs.
This avoids possible memory leaks.

Found by: Coverity scan.
2015-01-24 21:33:30 +01:00
Vladimir Serbinenko
7d027b4d3e efidisk: Return the determined root disk even if partition is unknown. 2015-01-24 19:53:13 +01:00
Andrey Borzenkov
2f73d2733c accept also hdX as alias to native Xen disk name
To be compatible with legacy pv-grub, sort disks by increasing order of handle
value. This allows reusing legacy pv-grub menu.lst which is using hdX names.

Suggested-By: Michael Chang <mchang@suse.com>
Closes: 44026
2015-01-23 19:52:45 +03:00
Vladimir Serbinenko
750f4bacd3 * grub-core/disk/diskfilter.c: Validate volumes to avoid division by zero. 2015-01-21 17:42:13 +01:00
Vladimir Serbinenko
4200ad44fe * grub-core/disk/i386/pc/biosdisk.c: Check disk size sanity. 2015-01-21 17:42:12 +01:00
Vladimir Serbinenko
f1959b1695 * grub-core/disk/ieee1275/nand.c (grub_nand_open): Check block size
validity.
2015-01-21 17:42:11 +01:00
Vladimir Serbinenko
935863518f grub_dmraid_nv_detect: Do not divide by zero. 2015-01-21 17:42:11 +01:00
Vladimir Serbinenko
f27ccb584c grub_ata_setaddress: Check that geometry is sane when using CHS addressing. 2015-01-21 17:42:10 +01:00
Vladimir Serbinenko
1dfe3f973e * grub-core/disk/AFSplitter.c (AF_merge): Check that mdlen is not 0. 2015-01-21 17:42:10 +01:00
Kris Moore
ba3031f996 Support GELI v6 and v7 2015-01-19 21:56:41 +03:00
Andrei Borzenkov
bbbcb791ed grub-core/disk/geli.c: fix memory leaks in error paths
CID: 73813, 73710
2014-11-28 22:23:30 +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
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
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
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
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
Vladimir Serbinenko
d0949e3747 * grub-core/disk/ahci.c: Ignore NPORTS field and rely on PI
exclusively.
2014-02-20 10:11:43 +01:00
Vladimir Serbinenko
9abbaae7cd * grub-core/disk/ahci.c: Increase timeout. Some SSDs take up to
7 seconds to recover if last poweroff was bad.
2014-01-29 23:50:49 +01:00
Vladimir Serbinenko
d6b94c5eb2 * grub-core/disk/ahci.c: Properly handle transactions with no
transferred data.
2014-01-29 23:49:51 +01:00
Vladimir Serbinenko
07ea8daa86 * grub-core/disk/ahci.c: Add safety cleanups. 2014-01-29 23:46:17 +01:00
Vladimir Serbinenko
3142b2feac * grub-core/disk/ahci.c: Allocate and clean space for all possible 32
slots to avoid pointing to uninited area.
2014-01-29 23:45:18 +01:00
Vladimir Serbinenko
4686e163f2 * grub-core/disk/ahci.c: Do not enable I/O decoding and keep
enabling busmaster for the end.
2014-01-29 23:43:25 +01:00
Vladimir Serbinenko
dc3286ade4 * grub-core/disk/efi/efidisk.c (name_devices): Skip Apple ghosts. 2013-12-24 20:32:14 +01:00
Colin Watson
16f7455b04 * configure.ac: Fix spelling.
* grub-core/commands/parttool.c: Fix grammar.
* grub-core/disk/ldm.c: Use consistent capitalisation for "LDM
Embedding Partition".
2013-12-23 13:32:35 +00:00
Vladimir Serbinenko
80b29fc9b4 * grub-core/disk/raid6_recover.c (grub_raid_block_mulx): Use grub_size_t
for size.
2013-12-21 14:16:49 +01:00
Vladimir Serbinenko
6e327fcd4c * grub-core/disk/lvm.c: Use grub_size_t for sizes and grub_ssize_t
for pointer difference.
2013-12-21 14:15:04 +01:00
Aleš Nesrsta
b9f03772b5 * grub-core/disk/usbms.c: Retry on unknown errors.
Reuse the same tag on retries.
2013-12-18 19:00:45 +01:00
Vladimir Serbinenko
18e76955be Use %I64 and not %ll when using OS printf if compiling for windows. 2013-12-17 16:04:47 +01:00
Vladimir Serbinenko
cc6fb517de Remove practice of assigning random const pointers to device id.
This is not required as cache code already checks driver id as well.
2013-12-16 14:49:11 +01:00
Vladimir Serbinenko
8ae6704517 * grub-core/disk/loopback.c: Use sequential IDs rather than pointer.
In case of quick removal of loopback and adding another one it may
	get same ID, confusing the cache system.
2013-12-15 14:31:21 +01:00
Vladimir Serbinenko
6f5f3337d8 * grub-core/disk/cryptodisk.c: Rename "n" to "last_cryptodisk_id". 2013-12-15 14:21:14 +01:00
Vladimir Serbinenko
7e47e27bd8 Add gcc_struct to all packed structures when compiling with mingw.
Just "packed" doesn't always pack the way we expect.
2013-12-15 14:14:30 +01:00
Vladimir Serbinenko
6dc3337774 Fix definition of grub_efi_hard_drive_device_path. Take care that
existing code would work even if by some reason bogus definition is
	used by EFI implementations.
2013-12-14 22:04:02 +01:00