OBS User unknown 2008-11-08 19:22:48 +00:00 committed by Git OBS Bridge
parent 5fda340a32
commit 0e0549b6c1
4 changed files with 82 additions and 3 deletions

View File

@ -0,0 +1,27 @@
# fixes (bnc#439910)
# parted used to crash on corrupted gpt label - now warning is printed instead
diff --git a/libparted/labels/gpt.c b/libparted/labels/gpt.c
index 13d2e88..c20d729 100644
--- a/libparted/labels/gpt.c
+++ b/libparted/labels/gpt.c
@@ -824,8 +824,18 @@ gpt_read (PedDisk * disk)
goto error;
if (_read_header (disk->dev, &gpt, 1)) {
- PED_ASSERT ((PedSector) PED_LE64_TO_CPU (gpt->AlternateLBA)
- <= disk->dev->length - 1, goto error_free_gpt);
+ if ((PedSector) PED_LE64_TO_CPU (gpt->AlternateLBA)
+ > disk->dev->length - 1) {
+ if (ped_exception_throw (
+ PED_EXCEPTION_WARNING,
+ PED_EXCEPTION_IGNORE_CANCEL,
+ _("The primary GPT table states that the backup GPT table is "
+ "located at the position that is beyond the end of the disk. "
+ "This means that the GPT structure is corrupted."))
+ == PED_EXCEPTION_CANCEL)
+ goto error_free_gpt;
+ }
+
if ((PedSector) PED_LE64_TO_CPU (gpt->AlternateLBA)
< disk->dev->length - 1) {
char* zeros = ped_malloc (pth_get_size (disk->dev));

41
fix-dvh-update.patch Normal file
View File

@ -0,0 +1,41 @@
# fixes (bnc#397210)
# see comment in the patch for explanation
diff --git a/libparted/arch/linux.c b/libparted/arch/linux.c
index 0107dd2..041208a 100644
--- a/libparted/arch/linux.c
+++ b/libparted/arch/linux.c
@@ -2248,7 +2248,15 @@ static int
_disk_sync_part_table (PedDisk* disk)
{
int i;
- int last = PED_MAX (ped_disk_get_last_partition_num (disk), 16);
+ int last;
+
+ /* parted treats DVH directory entries as logical partitions with number > 16;
+ * we don't want to inform kernel about directory entries
+ */
+ if (strcmp (disk->type->name, "dvh") == 0)
+ last = 16;
+ else
+ last = PED_MAX (ped_disk_get_last_partition_num (disk), 16);
int* rets = ped_malloc(sizeof(int) * last);
int* errnums = ped_malloc(sizeof(int) * last);
int ret = 1;
@@ -2470,8 +2478,16 @@ static int
_dm_reread_part_table (PedDisk* disk)
{
int rc = 1;
- int last = PED_MAX (ped_disk_get_last_partition_num (disk), 16);
int i;
+ int last;
+
+ /* parted treats DVH directory entries as partitions logical with number > 16;
+ * we don't want to inform kernel about directory entries
+ */
+ if (strcmp (disk->type->name, "dvh") == 0)
+ last = 16;
+ else
+ last = PED_MAX (ped_disk_get_last_partition_num (disk), 16);
sync();
if (!_dm_remove_parts(disk->dev))

View File

@ -1,3 +1,9 @@
-------------------------------------------------------------------
Fri Nov 7 21:58:52 CET 2008 - puzel@suse.cz
- fix-corrupted-gpt-crash.patch (bnc#439910)
- fix-dvh-update.patch (bnc#397210)
-------------------------------------------------------------------
Wed Nov 5 12:42:57 CET 2008 - puzel@suse.cz

View File

@ -26,7 +26,7 @@ License: GPL v2 or later
Group: System/Filesystems
Summary: GNU partitioner
Version: 1.8.8
Release: 89
Release: 90
Source0: %{name}-%{version}.tar.bz2
Patch: always-resize-part.dif
Patch1: parted-type.patch
@ -42,11 +42,12 @@ Patch11: fix-function-def.patch
Patch12: gnulib.diff
Patch51: parted.tty.patch
Patch52: parted.no-O_DIRECT.patch
#Patch53: largest_partition_number.patch
Patch54: parted-gpt-mbr-sync.patch
Patch55: parted-fdasd-compile-fixes
Patch56: parted-no-inttypes-include
Patch57: fix-improper-data-conversion.patch
Patch58: fix-corrupted-gpt-crash.patch
Patch59: fix-dvh-update.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-build
Url: http://www.gnu.org/software/parted/
PreReq: %install_info_prereq
@ -98,11 +99,12 @@ Authors:
%patch12
%patch51 -p1
%patch52 -p1
#%#patch53
%patch54
%patch55 -p1
%patch56 -p1
%patch57 -p1
%patch58 -p1
%patch59 -p1
%build
AUTOPOINT=true autoreconf --force --install
@ -147,6 +149,9 @@ rm -rf "$RPM_BUILD_ROOT"
%{_libdir}/*.so
%changelog
* Fri Nov 07 2008 puzel@suse.cz
- fix-corrupted-gpt-crash.patch (bnc#439910)
- fix-dvh-update.patch (bnc#397210)
* Wed Nov 05 2008 puzel@suse.cz
- disabled largest_partition_number.patch (bnc#440141)
* Mon Oct 20 2008 puzel@suse.cz