[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#520286: ext2 module fails to recognize ext4 files with extents on big endian



Package: grub2
Version: 1.96+20090317-1
Severity: important
Tags: patch

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1


The function grub_ext2_read_block() doesn't take endianness into account
when checking the inode flags for EXT4_EXTENTS_FLAG, so the check doesn't
work properly on big endian. The attached patch fixes this, it was necessary
for loading and booting a Linux kernel from an ext4 filesystem on my PowerBook.


- -- Package-specific info:

*********************** BEGIN /proc/mounts
/dev/root / ext4 rw,relatime,errors=remount-ro,barrier=1,data=ordered 0 0
/dev/hda2 /boot/grub hfs rw,uid=0,gid=0 0 0
*********************** END /proc/mounts

*********************** BEGIN /boot/grub/device.map
(hd)	/dev/hda
*********************** END /boot/grub/device.map

*********************** BEGIN /boot/grub/grub.cfg
#
# DO NOT EDIT THIS FILE
#
# It is automatically generated by /usr/sbin/grub-mkconfig using templates
# from  and settings from /etc/default/grub
#

### BEGIN /etc/grub.d/00_header ###
set default=0
set timeout=5
### END /etc/grub.d/00_header ###

### BEGIN /etc/grub.d/05_debian_theme ###
set menu_color_normal=cyan/blue
set menu_color_highlight=white/blue
### END /etc/grub.d/05_debian_theme ###

### BEGIN /etc/grub.d/10_freebsd ###
### END /etc/grub.d/10_freebsd ###

### BEGIN /etc/grub.d/10_hurd ###
### END /etc/grub.d/10_hurd ###

### BEGIN /etc/grub.d/10_linux ###
menuentry "Debian GNU/Linux, linux 2.6.28.8" {
	set root=(hd,5)
	search --fs-uuid --set 12ed0685-682c-4cf9-8cdf-2a3e0012bb8c
	linux	/boot/vmlinux-2.6.28.8 root=/dev/hda5 ro  splash
}
menuentry "Debian GNU/Linux, linux 2.6.28.8 (recovery mode)" {
	set root=(hd,5)
	search --fs-uuid --set 12ed0685-682c-4cf9-8cdf-2a3e0012bb8c
	linux	/boot/vmlinux-2.6.28.8 root=/dev/hda5 ro single 
}
menuentry "Debian GNU/Linux, linux 2.6.28.7" {
	set root=(hd,5)
	search --fs-uuid --set 12ed0685-682c-4cf9-8cdf-2a3e0012bb8c
	linux	/boot/vmlinux-2.6.28.7 root=/dev/hda5 ro  splash
}
menuentry "Debian GNU/Linux, linux 2.6.28.7 (recovery mode)" {
	set root=(hd,5)
	search --fs-uuid --set 12ed0685-682c-4cf9-8cdf-2a3e0012bb8c
	linux	/boot/vmlinux-2.6.28.7 root=/dev/hda5 ro single 
}
menuentry "Debian GNU/Linux, linux 2.6.28.6" {
	set root=(hd,5)
	search --fs-uuid --set 12ed0685-682c-4cf9-8cdf-2a3e0012bb8c
	linux	/boot/vmlinux-2.6.28.6 root=/dev/hda5 ro  splash
}
menuentry "Debian GNU/Linux, linux 2.6.28.6 (recovery mode)" {
	set root=(hd,5)
	search --fs-uuid --set 12ed0685-682c-4cf9-8cdf-2a3e0012bb8c
	linux	/boot/vmlinux-2.6.28.6 root=/dev/hda5 ro single 
}
menuentry "Debian GNU/Linux, linux 2.6.28.4" {
	set root=(hd,5)
	search --fs-uuid --set 12ed0685-682c-4cf9-8cdf-2a3e0012bb8c
	linux	/boot/vmlinux-2.6.28.4 root=/dev/hda5 ro  splash
}
menuentry "Debian GNU/Linux, linux 2.6.28.4 (recovery mode)" {
	set root=(hd,5)
	search --fs-uuid --set 12ed0685-682c-4cf9-8cdf-2a3e0012bb8c
	linux	/boot/vmlinux-2.6.28.4 root=/dev/hda5 ro single 
}
menuentry "Debian GNU/Linux, linux 2.6.28-1-powerpc" {
	set root=(hd,5)
	search --fs-uuid --set 12ed0685-682c-4cf9-8cdf-2a3e0012bb8c
	linux	/boot/vmlinux-2.6.28-1-powerpc root=UUID=12ed0685-682c-4cf9-8cdf-2a3e0012bb8c ro  splash
	initrd	/boot/initrd.img-2.6.28-1-powerpc
}
menuentry "Debian GNU/Linux, linux 2.6.28-1-powerpc (recovery mode)" {
	set root=(hd,5)
	search --fs-uuid --set 12ed0685-682c-4cf9-8cdf-2a3e0012bb8c
	linux	/boot/vmlinux-2.6.28-1-powerpc root=UUID=12ed0685-682c-4cf9-8cdf-2a3e0012bb8c ro single 
	initrd	/boot/initrd.img-2.6.28-1-powerpc
}
menuentry "Debian GNU/Linux, linux 2.6.26-1-powerpc" {
	set root=(hd,5)
	search --fs-uuid --set 12ed0685-682c-4cf9-8cdf-2a3e0012bb8c
	linux	/boot/vmlinux-2.6.26-1-powerpc root=UUID=12ed0685-682c-4cf9-8cdf-2a3e0012bb8c ro  splash
	initrd	/boot/initrd.img-2.6.26-1-powerpc
}
menuentry "Debian GNU/Linux, linux 2.6.26-1-powerpc (recovery mode)" {
	set root=(hd,5)
	search --fs-uuid --set 12ed0685-682c-4cf9-8cdf-2a3e0012bb8c
	linux	/boot/vmlinux-2.6.26-1-powerpc root=UUID=12ed0685-682c-4cf9-8cdf-2a3e0012bb8c ro single 
	initrd	/boot/initrd.img-2.6.26-1-powerpc
}
### END /etc/grub.d/10_linux ###

### BEGIN /etc/grub.d/30_os-prober ###
### END /etc/grub.d/30_os-prober ###

### BEGIN /etc/grub.d/40_custom ###
# This file is an example on how to add custom entries
### END /etc/grub.d/40_custom ###
*********************** END /boot/grub/grub.cfg

- -- System Information:
Debian Release: squeeze/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (500, 'stable'), (102, 'experimental')
Architecture: powerpc (ppc)

Kernel: Linux 2.6.28.7
Locale: LANG=de_CH.UTF-8, LC_CTYPE=de_CH.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages grub2 depends on:
ii  grub-ieee1275            1.96+20090317-1 GRand Unified Bootloader, version 

grub2 recommends no packages.

grub2 suggests no packages.

- -- debconf information excluded

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)

iD8DBQFJwSioWoGvjmrbsgARApFfAKCOBjABgfYcBkMiCZLO36zOcLH8VACfd1Nf
w8bfKEAjQJXaz/2xJP1iIhc=
=LKlB
-----END PGP SIGNATURE-----
--- grub2-1.96+20090317.orig/fs/ext2.c	2009-02-08 01:28:09.000000000 +0100
+++ grub2-1.96+20090317/fs/ext2.c	2009-03-18 17:29:03.000000000 +0100
@@ -385,7 +385,7 @@ grub_ext2_read_block (grub_fshelp_node_t
   unsigned int blksz = EXT2_BLOCK_SIZE (data);
   int log2_blksz = LOG2_EXT2_BLOCK_SIZE (data);
   
-  if (inode->flags & EXT4_EXTENTS_FLAG)
+  if (grub_le_to_cpu32(inode->flags) & EXT4_EXTENTS_FLAG)
     {
       char buf[EXT2_BLOCK_SIZE(data)];
       struct grub_ext4_extent_header *leaf;

Reply to: