Bug#593652: grub-common: grub-probe still segfaults with 1.98+20100804-6

2010-11-04 Thread Robert Millan
tags 593652 pending
thanks

2010/11/2 Martin Schitter m...@mur.at:
 --- disk/mdraid_linux.c-old     2010-11-02 02:10:23.0 +0100
 +++ disk/mdraid_linux.c 2010-11-02 02:13:51.0 +0100
 @@ -255,5 +255,5 @@
     return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET,
                       unsupported RAID level: %d, sb-level);
 -  if (sb.this_disk.number == 0x || sb.this_disk.number == 0xfffe)
 +  if (sb-this_disk.number == 0x || sb-this_disk.number == 0xfffe)
     return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET,
                       spares aren't implemented);


 the resulting binaries seem to work fine:

Thank you, it will be included with next upload.

-- 
Robert Millan



--
To UNSUBSCRIBE, email to debian-bugs-rc-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Bug#593652: grub-common: grub-probe still segfaults with 1.98+20100804-6

2010-11-01 Thread Robert Millan
2010/10/31 Martin Schitter m...@mur.at:
 just for testing purposes i set up a 0.9 array on my machine:

Thank you.

 btw. -- i did all this tests using patched versions from upstream. it's
 perhaps not so trival to backport everything to 1.98+20100804 faultlessly.

I backported the patch, please can you test this?
=== modified file 'disk/mdraid_linux.c'
--- disk/mdraid_linux.c	2010-07-20 10:10:49 +
+++ disk/mdraid_linux.c	2010-11-01 22:05:39 +
@@ -254,6 +254,9 @@ grub_mdraid_detect_09 (grub_disk_addr_t
   sb-level != 5  sb-level != 6  sb-level != 10)
 return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET,
 		   unsupported RAID level: %d, sb-level);
+  if (sb.this_disk.number == 0x || sb.this_disk.number == 0xfffe)
+return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET,
+		   spares aren't implemented);
 
   array-name = NULL;
   array-number = sb-md_minor;
@@ -328,12 +331,13 @@ grub_mdraid_detect_1x (grub_disk_t disk,
   array-total_devs = grub_le_to_cpu32 (real_sb-raid_disks);
   array-disk_size = grub_le_to_cpu64 (real_sb-size);
   array-chunk_size = grub_le_to_cpu32 (real_sb-chunksize);
-  if (grub_le_to_cpu32 (real_sb-dev_number) 
+  if (grub_le_to_cpu32 (real_sb-dev_number) =
   grub_le_to_cpu32 (real_sb-max_dev))
-array-index = grub_le_to_cpu16
-  (real_sb-dev_roles[grub_le_to_cpu32 (real_sb-dev_number)]);
-  else
-array-index = 0x;  /* disk will be later not used! */
+return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET,
+		   spares aren't implemented);
+
+  array-index = grub_le_to_cpu16
+(real_sb-dev_roles[grub_le_to_cpu32 (real_sb-dev_number)]);
   array-uuid_len = 16;
   array-uuid = grub_malloc (16);
   if (!array-uuid)

=== modified file 'disk/raid.c'
--- disk/raid.c	2010-08-02 14:51:23 +
+++ disk/raid.c	2010-11-01 22:09:21 +
@@ -97,10 +97,10 @@ grub_raid_memberlist (grub_disk_t disk)
   unsigned int i;
 
   for (i = 0; i  array-total_devs; i++)
-if (array-device[i])
+if (array-members[i].device)
   {
 tmp = grub_malloc (sizeof (*tmp));
-tmp-disk = array-device[i];
+tmp-disk = array-members[i].device;
 tmp-next = list;
 list = tmp;
   }
@@ -248,13 +248,13 @@ grub_raid_read (grub_disk_t disk, grub_d
 k = disknr;
 for (j = 0; j  far; j++)
   {
-if (array-device[k])
+if (array-members[k].device)
   {
 if (grub_errno == GRUB_ERR_READ_ERROR)
   grub_errno = GRUB_ERR_NONE;
 
-err = grub_disk_read (array-device[k],
-  array-start_sector[k] +
+err = grub_disk_read (array-members[k].device,
+  array-members[k].start_sector +
 read_sector + j * far_ofs + b,
   0,
   read_size  GRUB_DISK_SECTOR_BITS,
@@ -360,14 +360,14 @@ grub_raid_read (grub_disk_t disk, grub_d
   read_size = size;
 
 e = 0;
-if (array-device[disknr])
+if (array-members[disknr].device)
   {
 /* Reset read error.  */
 if (grub_errno == GRUB_ERR_READ_ERROR)
   grub_errno = GRUB_ERR_NONE;
 
-err = grub_disk_read (array-device[disknr],
-  array-start_sector[disknr] +
+err = grub_disk_read (array-members[disknr].device,
+  array-members[disknr].start_sector +
 read_sector + b, 0,
   read_size  GRUB_DISK_SECTOR_BITS,
   buf);
@@ -492,6 +492,21 @@ insert_array (grub_disk_t disk, struct g
 
 /* Do some checks before adding the device to the array.  */
 
+	if (new_array-index = array-allocated_devs)
+	  {
+	void *tmp;
+	unsigned int newnum = 2 * (new_array-index + 1);
+	tmp = grub_realloc (array-members, newnum
+* sizeof (array-members[0]));
+	if (!tmp)
+	  return grub_errno;
+	array-members = tmp;
+	grub_memset (array-members + array-allocated_devs,
+			 0, (newnum - array-allocated_devs)
+			 * sizeof (array-members[0]));
+	array-allocated_devs = newnum;
+	  }
+
 /* FIXME: Check whether the update time of the superblocks are
the same.  */
 
@@ -502,7 +517,7 @@ insert_array (grub_disk_t disk, struct g
   grub_dprintf (raid, array-nr_devs  array-total_devs (%d)?!?,
 			array-total_devs);
 
-if (array-device[new_array-index] != NULL)
+if (array-members[new_array-index].device != NULL)
   /* We found multiple devices with the same number. Again,
  this shouldn't happen.  */
   

Bug#593652: grub-common: grub-probe still segfaults with 1.98+20100804-6

2010-11-01 Thread Martin Schitter

Am 2010-11-01 23:11, schrieb Robert Millan:

I backported the patch, please can you test this?


i had some simple compilation errors:

../../disk/mdraid_linux.c:257: error: request for member ‘this_disk’ in 
something not a structure or union



fixed it:

--- disk/mdraid_linux.c-old 2010-11-02 02:10:23.0 +0100
+++ disk/mdraid_linux.c 2010-11-02 02:13:51.0 +0100
@@ -255,5 +255,5 @@
 return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET,
   unsupported RAID level: %d, sb-level);
-  if (sb.this_disk.number == 0x || sb.this_disk.number == 0xfffe)
+  if (sb-this_disk.number == 0x || sb-this_disk.number == 0xfffe)
 return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET,
   spares aren't implemented);


the resulting binaries seem to work fine:

r...@sow:~# for array in /boot / /mnt; do echo -e \n   testing: 
$array; for target in fs drive device abstraction; do 
/usr/sbin/grub-probe -t $target $array; done ; done


   testing: /boot
ext2
(md/boot)
/dev/md127
raid mdraid

   testing: /
ext2
(md/root)
/dev/md125
raid mdraid

   testing: /mnt
ext2
(md0)
/dev/md0
raid mdraid


thanks for this effort!

martin
--- disk/mdraid_linux.c-old	2010-11-02 02:10:23.0 +0100
+++ disk/mdraid_linux.c	2010-11-02 02:13:51.0 +0100
@@ -255,5 +255,5 @@
 return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET,
 		   unsupported RAID level: %d, sb-level);
-  if (sb.this_disk.number == 0x || sb.this_disk.number == 0xfffe)
+  if (sb-this_disk.number == 0x || sb-this_disk.number == 0xfffe)
 return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET,
 		   spares aren't implemented);


Bug#593652: grub-common: grub-probe still segfaults with 1.98+20100804-6

2010-10-31 Thread Robert Millan
2010/10/30 Vincent Danjean vdanj...@debian.org:
 You should apply it to the grub2 package and upload it to unstable.
  It is sure that some regression will be fixed. And, perhaps, other
 regressions will occur. But there is currently no current indication of
 that and, as with this regression, they would have to be fixed if they
 occur.

So you want me to cherry-pick this non-trivial patch but nobody has
tested it with mdraid 0.9, which I presume is the most widely deployed
version?

I don't agree with your approach, but I don't want to stop you from
going ahead with it.

Here's what we can do:  1.98+20100804-7 is about to migrate to
squeeze (6 of 10 days).  Once it has, you have my permission to
NMU.  In doing that, you'll have to take responsibility in case
something breaks badly with 0.9 mdraid.

Or otherwise, someone confirm me it's been tested with 0.9, and
I'll add the patch myself.



--
To UNSUBSCRIBE, email to debian-bugs-rc-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Bug#593652: grub-common: grub-probe still segfaults with 1.98+20100804-6

2010-10-31 Thread Martin Schitter

Am 2010-10-31 13:56, schrieb Robert Millan:

So you want me to cherry-pick this non-trivial patch but nobody has
tested it with mdraid 0.9, which I presume is the most widely deployed
version?


just for testing purposes i set up a 0.9 array on my machine:

r...@sow:~# cat /proc/mdstat
Personalities : [raid1]
md0 : active raid1 sdb4[2](S) sdb3[3](S) sdb2[1] sdb1[0]
  10490304 blocks [2/2] [UU]
  []  resync =  3.6% (383104/10490304) 
finish=15.8min speed=10641K/sec


md125 : active raid1 sda3[0] sdc3[2] sdd3[3](S)
  64324188 blocks super 1.0 [2/2] [UU]

md126 : active raid1 sda2[0] sdc2[2] sdd2[3](S)
  6297468 blocks super 1.0 [2/2] [UU]

md127 : active raid1 sda1[0] sdc1[2] sdd1[3](S)
  1060244 blocks super 1.0 [2/2] [UU]

grub-probe seems to work fine on this device:

r...@sow:~# mount /dev/md0 /mnt
r...@sow:~# /tmp/grub-probe /mnt/
ext2
r...@sow:~# /tmp/grub-probe -t device /mnt
/dev/md0

i coudn't figure out any way to let it crash like the actual debian 
binaries...



Or otherwise, someone confirm me it's been tested with 0.9, and
I'll add the patch myself.


btw. -- i did all this tests using patched versions from upstream. it's 
perhaps not so trival to backport everything to 1.98+20100804 faultlessly.


if you need any further testing i'll do my best...

but in general i would like to see the upstream development and their 
fixes as the most responsible source of improvement.


martin



--
To UNSUBSCRIBE, email to debian-bugs-rc-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Bug#593652: grub-common: grub-probe still segfaults with 1.98+20100804-6

2010-10-30 Thread Vincent Danjean
On 28/10/2010 15:44, Robert Millan wrote:
 2010/10/27, Martin Schitter m...@mur.at:
 structure 'grub_raid_member') it respects the differences between dmraid
 format 0.9 and 1.x (the later becomes the default in debian squeeze) and
 all the related memory management. (see:
 http://lists.gnu.org/archive/html/grub-devel/2010-10/msg00044.html )
 
 Have you tested this with the version in Debian? Is it known to
 work with 1.x and not cause regression with 0.9?
 
 Please let me know, I'll try to get it in squeeze when this is
 confirmed.

I'm sure that the current grub2 in Debian is a regression in comparison
with some previous versions. Robert, I really think that a patch for this
bug should be included in squeeze. A raid setup with spare disks was
working before. Since a few versions of grub2, it is broken. There is a
patch that seems to fix this bug and the patch comes from upstream.
You should apply it to the grub2 package and upload it to unstable.
  It is sure that some regression will be fixed. And, perhaps, other
regressions will occur. But there is currently no current indication of
that and, as with this regression, they would have to be fixed if they
occur.
  If you really want more testing before uploading to unstable, then
upload to experimental and ask for testing in debian-devel.

  Regards,
Vincent



-- 
To UNSUBSCRIBE, email to debian-bugs-rc-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Bug#593652: grub-common: grub-probe still segfaults with 1.98+20100804-6

2010-10-30 Thread Martin Schitter

Am 2010-10-30 22:00, schrieb Vincent Danjean:

On 28/10/2010 15:44, Robert Millan wrote:

Have you tested this with the version in Debian? Is it known to
work with 1.x and not cause regression with 0.9?


it works fine in my (version 1.0) setup but it couldn't test it in all 
the the other possible configurations...



Please let me know, I'll try to get it in squeeze when this is
confirmed.



I'm sure that the current grub2 in Debian is a regression in comparison
with some previous versions. Robert, I really think that a patch for this
bug should be included in squeeze.A raid setup with spare disks was

 working before. Since a few versions of grub2, it is broken. There is
 a patch that seems to fix this bug and the patch comes from upstream.
 You should apply it to the grub2 package and upload it to unstable.

i think, robert was just asking for some confirmation an practical 
testing in the context of affected machines.


but you right -- we should use the given solution simply as one step 
forward to make grub-probe work again.


martin



--
To UNSUBSCRIBE, email to debian-bugs-rc-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Bug#593652: grub-common: grub-probe still segfaults with 1.98+20100804-6

2010-10-28 Thread Robert Millan
2010/10/27, Martin Schitter m...@mur.at:
 structure 'grub_raid_member') it respects the differences between dmraid
 format 0.9 and 1.x (the later becomes the default in debian squeeze) and
 all the related memory management. (see:
 http://lists.gnu.org/archive/html/grub-devel/2010-10/msg00044.html )

Have you tested this with the version in Debian? Is it known to
work with 1.x and not cause regression with 0.9?

Please let me know, I'll try to get it in squeeze when this is
confirmed.

-- 
Robert Millan



-- 
To UNSUBSCRIBE, email to debian-bugs-rc-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Bug#593652: grub-common: grub-probe still segfaults with 1.98+20100804-6

2010-10-27 Thread Martin Schitter

Am 2010-10-26 00:16, schrieb Robert Millan:

Has this patch been sent upstream? Was it reviewed there?


there is now a much more complete patch by vladimir serbinenko
for upstream available. beside some minor cleanup (change 'index' from 
signed to unsigned) and refactoring (folding some fields to the 
structure 'grub_raid_member') it respects the differences between dmraid 
format 0.9 and 1.x (the later becomes the default in debian squeeze) and 
all the related memory management. (see: 
http://lists.gnu.org/archive/html/grub-devel/2010-10/msg00044.html )


please include this changes in the debian packages. otherwise it will be 
nearly impossible to update or finish an installation using spare disks.


martin



--
To UNSUBSCRIBE, email to debian-bugs-rc-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Bug#593652: grub-common: grub-probe still segfaults with 1.98+20100804-6

2010-10-25 Thread Robert Millan
2010/10/24, Vincent Danjean vdanj...@debian.org:
   Hi,

   1.98+20100804-6 still suffer from this bug and the changelog of
 1.98+20100804-7 does not show that the patch attached to this bug
 has been applied. Is there any reason ?

Hi Vincent,

I'm afraid I'm not familiar enough with this part of the code to ACK
this kind of patch during freeze.

Has this patch been sent upstream? Was it reviewed there?

If it hasn't, please do.  If it's committed or at least ACKed in upstream,
I see no problem with adding it.

Thanks!

-- 
Robert Millan



-- 
To UNSUBSCRIBE, email to debian-bugs-rc-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Bug#593652: grub-common: grub-probe still segfaults with 1.98+20100804-6

2010-10-25 Thread Martin Schitter

Am 2010-10-26 00:16, schrieb Robert Millan:

I'm afraid I'm not familiar enough with this part of the code to ACK
this kind of patch during freeze.

Has this patch been sent upstream? Was it reviewed there?

If it hasn't, please do.  If it's committed or at least ACKed in upstream,
I see no problem with adding it.


the upstream developers are informed about this problem, even though 
they didn't accept this bug fix. 
(http://lists.gnu.org/archive/html/grub-devel/2010-09/msg00259.html)


in a quick response to my reminder concerning this outstanding problem 
vladimir serbinenko wrote today on the grub-devel list that he will seek 
for a better solution very soon. 
(http://lists.gnu.org/archive/html/grub-devel/2010-10/msg00043.html)


martin



--
To UNSUBSCRIBE, email to debian-bugs-rc-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Bug#593652: grub-common: grub-probe still segfaults with 1.98+20100804-6

2010-10-24 Thread Vincent Danjean
  Hi,

  1.98+20100804-6 still suffer from this bug and the changelog of
1.98+20100804-7 does not show that the patch attached to this bug
has been applied. Is there any reason ?

  Regards,
Vincent

On 10/10/2010 14:29, Vincent Danjean wrote:
 tags 593652 +patch
 thanks
 
 On 10/10/2010 13:12, Vincent Danjean wrote:
 Package: grub-common
 Version: 1.98+20100804-5
 Severity: normal

   Just to report that the bug still exists. What can I provide in addition to
 the backtrace already reported ?
 
   Hi,
 
   I just tried to rebuild and install grub-pc and grub-common with the
 patch provided in http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=593652#46
 I can confirm that the patch fixes the bug on my system (and indeed, I
 have a spare disk in a software raid on this system)
 
   Regards,
 Vincent
 

-- 
Vincent Danjean   GPG key ID 0x9D025E87 vdanj...@debian.org
GPG key fingerprint: FC95 08A6 854D DB48 4B9A  8A94 0BF7 7867 9D02 5E87
Unofficial packages: http://moais.imag.fr/membres/vincent.danjean/deb.html
APT repo:  deb http://people.debian.org/~vdanjean/debian unstable main




-- 
To UNSUBSCRIBE, email to debian-bugs-rc-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org