All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] biosdisk / open_device() messing up offsets
@ 2008-06-04 23:35 Robert Millan
  2008-06-05  1:47 ` Pavel Roskin
  2008-06-06 15:56 ` Robert Millan
  0 siblings, 2 replies; 38+ messages in thread
From: Robert Millan @ 2008-06-04 23:35 UTC (permalink / raw)
  To: grub-devel

[-- Attachment #1: Type: text/plain, Size: 723 bytes --]


It seems that open_device() in biosdisk is messing up offsets when
accessing partitions.  For example if you try:

grub> hexdump (hd0,1)

in grub-emu, you'll get a message saying lseek failed.  The problem is that
it substracts to the sector offset, so all accesses get to wrong data and
accessing sector 0 results in underflow.

I would think those lines (see patch) are plainly wrong, but they appear to
be very old, and it is strange that this wasn't noticed earlier.  Maybe we
have changed behaviour around partition/disk offsets, causing this breakage
without noticing?

-- 
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 /.)

[-- Attachment #2: partition.diff --]
[-- Type: text/x-diff, Size: 549 bytes --]

diff -x ChangeLog -x configure -x config.h.in -x CVS -x '*~' -x '*.mk' -urp ../grub2/util/biosdisk.c ./util/biosdisk.c
--- ../grub2/util/biosdisk.c	2008-06-04 16:00:30.000000000 +0200
+++ ./util/biosdisk.c	2008-06-05 01:17:00.000000000 +0200
@@ -298,9 +298,6 @@ open_device (const grub_disk_t disk, gru
 
     /* Make the buffer cache consistent with the physical disk.  */
     ioctl (fd, BLKFLSBUF, 0);
-    
-    if (is_partition)
-      sector -= disk->partition->start;
   }
 #else /* ! __linux__ */
   fd = open (map[disk->id].device, flags);

^ permalink raw reply	[flat|nested] 38+ messages in thread

end of thread, other threads:[~2008-06-13  5:18 UTC | newest]

Thread overview: 38+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-06-04 23:35 [PATCH] biosdisk / open_device() messing up offsets Robert Millan
2008-06-05  1:47 ` Pavel Roskin
2008-06-05 21:12   ` Robert Millan
2008-06-06 15:56 ` Robert Millan
2008-06-06 22:53   ` Pavel Roskin
2008-06-06 23:38     ` Robert Millan
2008-06-07  2:58       ` Pavel Roskin
2008-06-08 19:29         ` Robert Millan
2008-06-07  6:33       ` Pavel Roskin
2008-06-07  7:48         ` Bean
2008-06-08  6:00           ` Pavel Roskin
2008-06-08  6:44             ` Bean
2008-06-08  6:52               ` Pavel Roskin
2008-06-08  7:11                 ` Bean
2008-06-08  7:29                   ` Pavel Roskin
2008-06-08 11:49                     ` Bean
2008-06-08 18:42                       ` Pavel Roskin
2008-06-08 18:57                         ` Bean
2008-06-09  1:43                           ` Pavel Roskin
2008-06-09 18:30                             ` Bean
2008-06-10  7:16                               ` Bean
2008-06-10 18:26                                 ` Pavel Roskin
2008-06-10 18:51                                   ` Bean
2008-06-10 20:19                                     ` Pavel Roskin
2008-06-10 22:58                                     ` Pavel Roskin
2008-06-10 23:18                                       ` [RFC PATCH] " Pavel Roskin
2008-06-11  5:25                                       ` Bean
2008-06-12  4:01                                         ` Pavel Roskin
2008-06-12  6:22                                         ` Pavel Roskin
2008-06-12  9:51                                           ` Bean
2008-06-12 16:25                                             ` Pavel Roskin
2008-06-13  3:48                                               ` Bean
2008-06-13  4:31                                                 ` Pavel Roskin
2008-06-13  4:39                                                   ` Bean
2008-06-13  5:00                                                     ` Pavel Roskin
2008-06-13  5:18                                                       ` Bean
2008-06-07  8:37     ` Bean
2008-06-08  5:41       ` Pavel Roskin

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.