[prev in list] [next in list] [prev in thread] [next in thread]
List: xen-cvs
Subject: [Xen-changelog] [xen stable-4.3] tools: pygrub: if partition table is empty, try treating as a whole
From: patchbot () xen ! org
Date: 2016-03-20 22:11:02
Message-ID: E1ahlYs-0006Kt-47 () xenbits ! xenproject ! org
[Download RAW message or body]
commit 404e83e055cb419efccbcb0c5c89476307a9ae46
Author: Ian Campbell <ian.campbell@citrix.com>
AuthorDate: Thu Nov 5 14:46:12 2015 +0000
Commit: Ian Jackson <Ian.Jackson@eu.citrix.com>
CommitDate: Mon Feb 29 15:48:14 2016 +0000
tools: pygrub: if partition table is empty, try treating as a whole disk
pygrub (in identify_disk_image()) detects a DOS style partition table
via the presence of the 0xaa55 signature at the end of the first
sector of the disk.
However this signature is also present in whole-disk configurations
when there is an MBR on the disk. Many filesystems (e.g. ext[234])
include leading padding in their on disk format specifically to enable
this.
So if we think we have a DOS partition table but do not find any
actual partition table entries we may as well try looking at it as a
whole disk image. Worst case is we probe and find there isn't anything
there.
This was reported by Sjors Gielen in Debian bug #745419. The fix was
inspired by a patch by Adi Kriegisch in
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=745419#27
Tested by genext2fs'ing my /boot into a new raw image (works) and
then:
dd if=/usr/lib/grub/i386-pc/g2ldr.mbr of=img conv=notrunc bs=512 count=1
to add an MBR (with 0xaa55 signature) to it, which after this patch
also works.
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Cc: 745419-forwarded@bugs.debian.org
(cherry picked from commit fb31b1475f1bf179f033b8de3f0e173006fd77e9)
(cherry picked from commit 6c9b1bcce4fcc872edddd44f88390a67d5954069)
(cherry picked from commit 812406cf2b6731d07f0f840d799fcfa5917dbaf4)
(cherry picked from commit 83c5e46c5d6af7adc4bc46cf41e415e34846c719)
---
tools/pygrub/src/pygrub | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/tools/pygrub/src/pygrub b/tools/pygrub/src/pygrub
index fe01118..dd0fe59 100755
--- a/tools/pygrub/src/pygrub
+++ b/tools/pygrub/src/pygrub
@@ -148,6 +148,11 @@ def get_partition_offsets(file):
else:
part_offs.append(offset)
+ # We thought we had a DOS partition table, but didn't find any
+ # actual valid partition entries. This can happen because an MBR
+ # (e.g. grubs) may contain the same signature.
+ if not part_offs: part_offs = [0]
+
return part_offs
class GrubLineEditor(curses.textpad.Textbox):
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.3
_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.xen.org
http://lists.xensource.com/xen-changelog
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic