From: Marco Gerards <mgerards@xs4all.nl>
To: The development of GRUB 2 <grub-devel@gnu.org>
Cc: Felix Zielcke <fzielcke@z-51.de>,
Jan Derk Gerlings <jan.derk.gerlings@newtec.eu>
Subject: Re: grub 1.96 svn 20080813 and circular lvm2 metadata
Date: Fri, 29 Aug 2008 18:08:52 +0200 [thread overview]
Message-ID: <87wshzhkh7.fsf@xs4all.nl> (raw)
In-Reply-To: <20080829090019.GA6721@gagh.ehv.newtec.eu> (Hans Lambermont's message of "Fri, 29 Aug 2008 11:00:19 +0200")
Hi Hans,
hans.lambermont@newtec.eu (Hans Lambermont) writes:
> Felix Zielcke wrote on 20080828:
>
>> Am Donnerstag, den 28.08.2008, 13:14 +0200 schrieb Hans Lambermont:
>>> My colleague Jan Derk Gerlings found a bug in the way grub 1.96, svn
>>> version 20080813 (and earlier) reads the circular lvm2 metadata
>>> buffer.
>>
>> Great, on Debian BTS we have 2 bugs [0] related to LVM and I wasn't
>> able yet to trace them down, but that could be the reason for them.
>>
>>> Shall we attempt to fix this and send a patch ?
>>
>> Yes please do :)
>
> Please find the patch attached, this was tested with circular metadata
> and the segfault in grub-setup is gone and the system boots fine.
Great! It is really nice to have this fixed :-)
>> Because GRUB is a GNU project, you have to obey the GNU Coding Standards [1]
>
> Ok, I hope I got it right. If not please let me know.
Okay.
> diff -uwr grub-1.96_svn20080813-org/ChangeLog grub-1.96_svn20080813-new/ChangeLog
> --- grub-1.96_svn20080813-org/ChangeLog 2008-08-13 17:24:36.000000000 +0200
> +++ grub-1.96_svn20080813-new/ChangeLog 2008-08-29 10:33:03.000000000 +0200
> @@ -1,3 +1,8 @@
> +2008-08-28 Hans Lambermont <hans.lambermont@newtec.eu> (tiny change)
> + Jan Derk Gerlings <jan.derk.gerlings@newtec.eu> (tiny change)
> +
> + * disk/lvm.c: Add capability to read circular metadata
Please describe changes in the changelog entry, not the effect.
For example:
* disk/lvm.c (grub_lvm_scan_device): Allocate buffer space for the
worst case scenario.
(grub_lvm_scan_device): ...
Where ... has to be filled in, I have no idea what this code actually
does or what you changed ;-)
The tiny change syntax does not seem familiar to me, AFAIK it is not
from the GCS. Can you please change that? Furthermore, if you both
worked on there two parts of the patch, please send in separate
patches. It will make my life a lot easier... :-)
If only one person worked on this, for example Jan Derk, which Hans
only forwards this patch, please only list Jan Derk as the
contributor.
> 2008-08-12 Robert Millan <rmh@aybabtu.com>
>
> * loader/i386/pc/multiboot.c (grub_multiboot_load_elf32): Move part
> diff -uwr grub-1.96_svn20080813-org/disk/lvm.c grub-1.96_svn20080813-new/disk/lvm.c
> --- grub-1.96_svn20080813-org/disk/lvm.c 2008-08-28 14:32:53.000000000 +0200
> +++ grub-1.96_svn20080813-new/disk/lvm.c 2008-08-28 18:31:19.000000000 +0200
> @@ -281,7 +281,8 @@
> goto fail;
> }
>
> - metadatabuf = grub_malloc (mda_size);
> + /* alloc for circular worst-case scenario */
Nitpick: Please start a sentence with a capital letter and end with a
`.'. So this will become:
/* Assume circular buffer in a worst case scenario. */
> + metadatabuf = grub_malloc (2*mda_size);
Please use spaces around operators:
2 * md_size
> if (! metadatabuf)
> goto fail;
>
> @@ -300,6 +301,12 @@
> }
>
> rlocn = mdah->raw_locns;
> + if (rlocn->offset + rlocn->size > mdah->size)
Here rlcon->offset seems to be little endian (64 bits), so please use
grub_le_to_cpu64. Same for rlocn->size, please check the size of this
member before you use a macro (I couldn't find it immediately...).
> + {
> + /* metadata is circular */
Same as above.
> + grub_memcpy(metadatabuf + mda_size, metadatabuf + mdah->start,
> + ((rlocn->offset + rlocn->size) - mdah->size));
> + }
Please check and correct the endianess. you use a lot of
parenthesises. Actually, I think none are requires.
Thanks,
Marco
next prev parent reply other threads:[~2008-08-29 16:03 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-08-28 11:14 grub 1.96 svn 20080813 and circular lvm2 metadata Hans Lambermont
2008-08-28 11:25 ` Felix Zielcke
2008-08-29 9:00 ` Hans Lambermont
2008-08-29 9:31 ` Felix Zielcke
2008-08-29 15:00 ` Vesa Jääskeläinen
2008-08-29 15:22 ` Felix Zielcke
2008-08-29 15:37 ` Marco Gerards
2008-08-29 16:08 ` Marco Gerards [this message]
2008-09-03 6:49 ` Felix Zielcke
2008-09-03 21:15 ` Felix Zielcke
2008-09-08 10:28 ` Hans Lambermont
2008-09-09 13:03 ` Hans Lambermont
2008-09-23 8:29 ` Hans Lambermont
2008-09-23 8:58 ` Felix Zielcke
2008-09-24 9:45 ` Robert Millan
2008-09-30 12:34 ` Hans Lambermont
2008-10-05 10:50 ` Robert Millan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87wshzhkh7.fsf@xs4all.nl \
--to=mgerards@xs4all.nl \
--cc=fzielcke@z-51.de \
--cc=grub-devel@gnu.org \
--cc=jan.derk.gerlings@newtec.eu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.