From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1K1QOa-0006f8-Ai for mharc-grub-devel@gnu.org; Wed, 28 May 2008 14:29:08 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1K1QOY-0006ez-Kr for grub-devel@gnu.org; Wed, 28 May 2008 14:29:06 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1K1QOW-0006en-7D for grub-devel@gnu.org; Wed, 28 May 2008 14:29:05 -0400 Received: from [199.232.76.173] (port=44634 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1K1QOW-0006ek-2k for grub-devel@gnu.org; Wed, 28 May 2008 14:29:04 -0400 Received: from an-out-0708.google.com ([209.85.132.242]:6212) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1K1QOV-0005Qg-Mc for grub-devel@gnu.org; Wed, 28 May 2008 14:29:03 -0400 Received: by an-out-0708.google.com with SMTP id c38so645540ana.84 for ; Wed, 28 May 2008 11:29:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:from:to:subject:date:user-agent:cc:references:in-reply-to:x-face:mime-version:content-type:content-transfer-encoding:content-disposition:message-id; bh=sS87QQC8HvSe9es46cHE0cOnMKqRkigJXWLjJ8p11RQ=; b=BXNuhk+EHY8jCKmErU9h6xNdasJIfZxcbpwA0n5Zl02/4cL70s7Y3qkZviycN8NGYlr0pQuXlr1xpDv/gzxtO/zf10SlMjjd0qZ4vKi9i6XyIVHlTgQ+ATh+LrEV65TqfFZ2ac+BM1OXPogWByra/jZs4Wy8sNQcnBZGOTogC80= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:subject:date:user-agent:cc:references:in-reply-to:x-face:mime-version:content-type:content-transfer-encoding:content-disposition:message-id; b=d8l3hk/Vm852Y8TSY+wwevnU9fEM+zou9GSh44hF03ppmqHyzib8DlVQ5mFsrKIN8N+EUjq16GL8EqFV1WPFV3owtBtOWksPYL0+ZlQm2d2MQjF3T+qPUTVmh4vW5mZo7RK4ncz0ks10BDwWq6ES/5k4rH9KV9Pe2ai6vQcs7Ko= Received: by 10.100.166.9 with SMTP id o9mr4421977ane.91.1211999341908; Wed, 28 May 2008 11:29:01 -0700 (PDT) Received: from dsktop01.iafcg.loc ( [190.75.165.30]) by mx.google.com with ESMTPS id c37sm17438092ana.11.2008.05.28.11.28.58 (version=TLSv1/SSLv3 cipher=RC4-MD5); Wed, 28 May 2008 11:29:00 -0700 (PDT) From: "Isaac M. Marcos" To: Robert Millan Date: Wed, 28 May 2008 13:58:53 -0430 User-Agent: KMail/1.9.9 References: <200805080454.54578.isaacmarcos100010@gmail.com> <1211453522.24846.3.camel@dv> <20080528133651.GA26495@thorin> In-Reply-To: <20080528133651.GA26495@thorin> X-Face: x-y\t15800Zgk#"~:Drp1}fo=N%pB*F8(J'>p}vH!s^cOfk.OkJcPPD#tY{V}N3:"-2Y>=?utf-8?q?B=0A=09RudWYi=5BV?=(q[woD:$pX],WnaV2Pp"&mBYiTK3g}RJsiBFy3IGy'H+&N,g0%lZ5; $Ows7Zyv1D2r8s=]C=]6QHY=YyEr\; 1=F4C76~*(=?utf-8?q?2l=7B9=23=0A=09Z=5Db1dNIHPtCCvypAZi-0=5D=25kTcGn=27x8A=5C=5F-/?= =?utf-8?q?7PW8=60?= X-detected-kernel: by monty-python.gnu.org: Linux 2.6 (newer, 2) Cc: The development of GRUB 2 Subject: Re: grub-probe gets a segfault X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: The development of GRUB 2 List-Id: The development of GRUB 2 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 May 2008 18:29:06 -0000 El Wednesday 28 May 2008 09:06:51 Robert Millan escribi=C3=B3: > 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 th= is > > > 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 abo= ut > 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 the= se > don't have any warning atm). I also believe It should be included. How is that done? > > 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 =3D mdah->raw_locns; > > p =3D q =3D metadatabuf + grub_le_to_cpu64 (rlocn->offset); > > > > - while (*q !=3D ' ') > > + while (*q !=3D ' ' && q < metadatabuf + mda_size) > > q++; > > > > + if (q =3D=3D metadatabuf + mda_size) > > + goto fail2; > > + > > vgname_len =3D q - p; > > vgname =3D grub_malloc (vgname_len + 1); > > if (!vgname) =2D-=20 Isaac M. Marcos GPG key 0xC9045C1B 5633 ECAF 44B1 8A5D 9371 DCDA 4620 A016 C904 5C1B The only place success comes before work is in the dictionary. VINCE LOMBARDI