From: Pavel Roskin <proski@gnu.org>
To: The development of GRUB 2 <grub-devel@gnu.org>
Subject: Re: [PATCH] fix an infinite loop with a corrupted pc partition table
Date: Fri, 24 Jul 2009 15:56:32 -0400 [thread overview]
Message-ID: <1248465392.6620.10.camel@mj> (raw)
In-Reply-To: <1248454704.3510.67.camel@fz.local>
On Fri, 2009-07-24 at 18:58 +0200, Felix Zielcke wrote:
> With this [0] partition table grub-probe currently loops forever:
>
> kern/disk.c:389: Reading `hd1'...
> partmap/pc.c:142: partition 0: flag 0x0, type 0x5, start 0x0, len
> 0x11177330
That's so evil!
> This patch fixes it, but probable there's a better fix.
We could require that all references to extended partitions are only
considered if they lead to a sector after the one currently being
processed.
Actually, no partition table should point to any partition (extended or
not) in an earlier sector, but it's enough to exclude backward links
between extended partitions to break the loop.
ChangeLog:
* partmap/pc.c (pc_partition_map_iterate): Only allow references
to subsequent sectors in extended partition entries.
---
partmap/pc.c | 8 +++++++-
1 files changed, 7 insertions(+), 1 deletions(-)
diff --git a/partmap/pc.c b/partmap/pc.c
index 6f68ecf..cd119c0 100644
--- a/partmap/pc.c
+++ b/partmap/pc.c
@@ -208,7 +208,13 @@ pc_partition_map_iterate (grub_disk_t disk,
if (grub_pc_partition_is_extended (e->type))
{
- p.offset = pcdata.ext_offset + grub_le_to_cpu32 (e->start);
+ grub_disk_addr_t new_offset;
+
+ /* Only allow references subsequent sectors */
+ new_offset = pcdata.ext_offset + grub_le_to_cpu32 (e->start);
+ if (new_offset <= p.offset)
+ continue;
+
if (! pcdata.ext_offset)
pcdata.ext_offset = p.offset;
--
Regards,
Pavel Roskin
next prev parent reply other threads:[~2009-07-24 19:56 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-07-24 16:58 [PATCH] fix an infinite loop with a corrupted pc partition table Felix Zielcke
2009-07-24 19:24 ` Felix Zielcke
2009-07-24 20:28 ` Pavel Roskin
2009-07-24 20:46 ` Vladimir 'phcoder' Serbinenko
2009-07-25 16:36 ` Robert Millan
2009-07-25 16:56 ` Vladimir 'phcoder' Serbinenko
2009-07-25 22:06 ` Pavel Roskin
2009-07-25 22:35 ` Vladimir 'phcoder' Serbinenko
2009-07-25 22:58 ` Vladimir 'phcoder' Serbinenko
2009-07-25 23:20 ` Vladimir 'phcoder' Serbinenko
2009-07-26 6:49 ` Felix Zielcke
2009-07-28 17:55 ` Robert Millan
2009-08-23 15:40 ` Vladimir 'phcoder' Serbinenko
2009-08-28 17:30 ` Vladimir 'phcoder' Serbinenko
2009-09-11 21:50 ` Pavel Roskin
2009-07-24 19:56 ` Pavel Roskin [this message]
2009-07-24 20:35 ` Vladimir 'phcoder' Serbinenko
2009-07-24 21:03 ` Pavel Roskin
2009-07-25 10:48 ` Vladimir 'phcoder' Serbinenko
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=1248465392.6620.10.camel@mj \
--to=proski@gnu.org \
--cc=grub-devel@gnu.org \
/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.