All of lore.kernel.org
 help / color / mirror / Atom feed
From: Robert Millan <rmh@aybabtu.com>
To: The development of GRUB 2 <grub-devel@gnu.org>
Cc: "Isaac M. Marcos" <isaacmarcos100010@gmail.com>
Subject: Re: grub-probe gets a segfault
Date: Wed, 28 May 2008 15:36:51 +0200	[thread overview]
Message-ID: <20080528133651.GA26495@thorin> (raw)
In-Reply-To: <1211453522.24846.3.camel@dv>

On Thu, May 22, 2008 at 06:52:02AM -0400, Pavel Roskin wrote:
> On Wed, 2008-05-21 at 20:20 -0430, Isaac M. Marcos wrote:
> > Today, I bump on this problem again on updating kernel. Because of this fault, 
> > update-initramfs reports a failure. It can't find "/".
> > 
> > grub-probe -t device /	-->	segfault!!
> 
> This patch should help.  It checks for the buffer overrun.  I still feel
> uneasy about applying it because it hides a bigger problem.

The constraints are a bit unusual here.  We don't have a handler for
exceptions, so this error could mean your machine stops booting.  And
additionally this code is in fact run in situations where LVM might not
be used (e.g. grub-probe is probing something in an unrelated partition).

In both cases IMHO it's much more desireable to avoid the problem and accept
the lesser evil that our LVM code might not be as complete, but at least it's
robust.

So I'd recommend to get this patch in.  If that makes you feel better about
this, how about adding a warning message in this fail condition?  (though,
note we have many fail conditions like this one in that function, and these
don't have any warning atm).

> diff --git a/disk/lvm.c b/disk/lvm.c
> index 1d898ff..997d15c 100644
> --- a/disk/lvm.c
> +++ b/disk/lvm.c
> @@ -302,9 +302,12 @@ grub_lvm_scan_device (const char *name)
>    rlocn = mdah->raw_locns;
>    p = q = metadatabuf + grub_le_to_cpu64 (rlocn->offset);
>  
> -  while (*q != ' ')
> +  while (*q != ' ' && q < metadatabuf + mda_size)
>      q++;
>  
> +  if (q == metadatabuf + mda_size)
> +    goto fail2;
> +
>    vgname_len = q - p;
>    vgname = grub_malloc (vgname_len + 1);
>    if (!vgname)

-- 
Robert Millan

<GPLv2> I know my rights; I want my phone call!
<DRM> What good is a phone call… if you are unable to speak?
(as seen on /.)



  parent reply	other threads:[~2008-05-28 13:37 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-08  9:24 grub-probe gets a segfault Isaac M. Marcos
2008-05-08 15:55 ` Pavel Roskin
2008-05-08 16:23   ` Isaac M. Marcos
2008-05-08 22:15     ` Pavel Roskin
2008-05-09 13:02       ` Robert Millan
2008-05-09 16:43         ` Isaac M. Marcos
2008-05-09 20:56           ` Pavel Roskin
2008-05-12 13:44             ` Isaac M. Marcos
2008-05-15 22:45               ` Pavel Roskin
2008-05-16 17:48                 ` Isaac Marcos
2008-05-16 18:02                   ` Pavel Roskin
2008-05-22  0:50                     ` Isaac M. Marcos
2008-05-22  1:06                       ` Pavel Roskin
2008-05-22 10:52                       ` Pavel Roskin
2008-05-24  0:10                         ` Isaac M. Marcos
2008-05-27 20:26                           ` Pavel Roskin
2008-05-28 13:36                         ` Robert Millan [this message]
2008-05-28 18:28                           ` Isaac M. Marcos
2008-05-30  3:59                             ` Pavel Roskin
2008-05-12 14:16       ` Isaac M. Marcos
2008-05-20 16:37         ` Jeff Chua
2008-05-20 19:53           ` Pavel Roskin
2008-05-21  2:22             ` Jeff Chua

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=20080528133651.GA26495@thorin \
    --to=rmh@aybabtu.com \
    --cc=grub-devel@gnu.org \
    --cc=isaacmarcos100010@gmail.com \
    /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.