Grub segfaults when trying to access reiser4
Hi,
I managed to patch grub with your reiser4 patches, but it does not work. I can see the partition but I cannot access any files on it. If I try it segfaults. What am I doing wrong or is this a known issue?
grub> kernel (hd0,
Possible partitions are:
Partition num: 0, Filesystem type is reiser4, partition type 0x83 Partition num: 1, Filesystem type unknown, partition type 0x82 Partition num: 2, Filesystem type unknown, partition type 0x83 Partition num: 3, Filesystem type is ext2fs, partition type 0x83
grub> kernel (hd0,0)/Segmentation Fault
/home #
(I only pressed [tab] and had to add the / manually before)
Grub versions tested: 0.94, 0.95
Kernel Version: 2.6.8-rc2
Reiser4progs Version: 0.5.6
libaal Version: 0.5.3
Thanks in advance,
Stefan Schweizer
Quoted 16 lines · Stefan Schweizer
Hi,
I managed to patch grub with your reiser4 patches, but it does not work. I can see the partition but I cannot access any files on it. If I try it segfaults. What am I doing wrong or is this a known issue?
grub> kernel (hd0,
Possible partitions are:Partition num: 0, Filesystem type is reiser4, partition type 0x83 Partition num: 1, Filesystem type unknown, partition type 0x82 Partition num: 2, Filesystem type unknown, partition type 0x83 Partition num: 3, Filesystem type is ext2fs, partition type 0x83grub> kernel (hd0,0)/Segmentation Fault
/home #
Quoted 6 lines
(I only pressed [tab] and had to add the / manually before)
Grub versions tested: 0.94, 0.95
Kernel Version: 2.6.8-rc2
Reiser4progs Version: 0.5.6
libaal Version: 0.5.3
would you try this patch please.
Signature · 2 lines
Thanks, Vitaly Fertman
--------------------------------------------
# 04/07/29 [email protected] 1.2336
# a bug in stand alone mode was fixed: # - do not unload all nodes on tree_adjust -- there are locked ones. # -------------------------------------------- # diff -Nru a/libreiser4/tree.c b/libreiser4/tree.c --- a/libreiser4/tree.c Thu Jul 29 00:31:10 2004 +++ b/libreiser4/tree.c Thu Jul 29 00:31:10 2004 @@ -1280,13 +1280,17 @@ /* Allocating unallocated extent item at @place. */ return reiser4_tree_alloc_extent(tree, place); } +#endif
static errno_t cb_node_unload(reiser4_tree_t *tree, reiser4_node_t *node) {
+#ifndef ENABLE_STAND_ALONE
count_t free_blocks;
- /* Updating free space counter in format. */
+ /* Updating free space counter in format for the case some blocks were
+ allocated. */
free_blocks = reiser4_alloc_free(tree->fs->alloc); reiser4_format_set_free(tree->fs->format, free_blocks);
+#endif
/* If node is locked, that is not a leaf or it is used by someone, it
cannot be released, and thus, it does not make the sense to save it
@@ -1294,16 +1298,17 @@
if (reiser4_node_locked(node))
return 0;
+#ifndef ENABLE_STAND_ALONE
/* Okay, node is fully allocated now and ready to be saved to device if
it is dirty. */
if (reiser4_node_isdirty(node) && reiser4_node_sync(node)) {
aal_error("Can't write node %llu.", node->block->nr); return -EIO;
}
+#endif
/* Unloading node from tree cache. */
return reiser4_tree_unload_node(tree, node);
}
-#endif
/* Entry point for adjsuting tree routines. */
@@ -1325,7 +1330,7 @@
cb_node_unload);
#else
res = reiser4_tree_walk_node(tree, tree->root,
- reiser4_tree_unload_node);
+ cb_node_unload);
#endif
tree->adjusting = 0;
Thank you for this patch now I get a little bit nearer, I can see the content of directories but I cannot access more than one filesystem level (like list /usr/src) or access files. It always segfaults if I try to press tab.
grub> kernel (hd0,9
grub> kernel (hd0,0)/bin/
Possible files are: [ arch awk basename bash bunzip2
grub> kernel (hd0,0)/bin/bas
Possible files are: basename bash
grub> kernel (hd0,0)/bin/bas
Possible files are: basename bash
grub> kernel (hd0,0)/bin/bashSegfault
Quoted 34 lines · Vitaly Fertman
Quoted 16 lines · Stefan Schweizer
Hi,
I managed to patch grub with your reiser4 patches, but it does not work. I can see the partition but I cannot access any files on it. If I try it segfaults. What am I doing wrong or is this a known issue?
grub> kernel (hd0,
Possible partitions are:Partition num: 0, Filesystem type is reiser4, partition type 0x83 Partition num: 1, Filesystem type unknown, partition type 0x82 Partition num: 2, Filesystem type unknown, partition type 0x83 Partition num: 3, Filesystem type is ext2fs, partition type 0x83grub> kernel (hd0,0)/Segmentation Fault
/home #Quoted 6 lines
(I only pressed [tab] and had to add the / manually before)
Grub versions tested: 0.94, 0.95
Kernel Version: 2.6.8-rc2
Reiser4progs Version: 0.5.6
libaal Version: 0.5.3would you try this patch please.
--
Thanks,
Vitaly Fertman
Quoted 9 lines · Stefan Schweizer
Thank you for this patch now I get a little bit nearer, I can see the content of directories but I cannot access more than one filesystem level (like list
/usr/src) or access files. It always segfaults if I try to press tab.grub> kernel (hd0,9
grub> kernel (hd0,0)/bin/
Possible files are: [ arch awk basename bash bunzip2
Quoted 7 lines
grub> kernel (hd0,0)/bin/bas
Possible files are: basename bashgrub> kernel (hd0,0)/bin/bas
Possible files are: basename bashgrub> kernel (hd0,0)/bin/bashSegfault
thy this improved patch (it includes the previous one) and a bit modified grub patch please.
Signature · 2 lines
Thanks, Vitaly Fertman
The following is the BitKeeper ChangeSet Log
# --------------------------------------------
# 04/07/29 [email protected] 1.2336
# a bug in stand alone mode was fixed: # - do not unload all nodes on tree_adjust -- there are locked ones. # -------------------------------------------- # 04/07/29 [email protected] 1.2338 # - fixed the bug with initialization object pset on fs openning # in the stand alone mod # -------------------------------------------- # diff -Nru a/include/reiser4/filesystem.h b/include/reiser4/filesystem.h --- a/include/reiser4/filesystem.h Thu Jul 29 15:25:02 2004 +++ b/include/reiser4/filesystem.h Thu Jul 29 15:25:02 2004 @@ -12,7 +12,11 @@
extern errno_t reiser4_fs_root_key(reiser4_fs_t *fs, reiser4_key_t *key);
+#ifndef ENABLE_STAND_ALONE
extern reiser4_fs_t *reiser4_fs_open(aal_device_t *device, bool_t check);
+#else
+extern reiser4_fs_t *reiser4_fs_open(aal_device_t *device); +#endif
#ifndef ENABLE_STAND_ALONE
include/reiser4/pset.h +6 -2
@@ -12,12 +12,16 @@extern void reiser4_opset_diff (reiser4_tree_t *tree,reiser4_opset_t *opset); +extern errno_t reiser4_opset_init (reiser4_tree_t *tree,int check); + +#else + +extern errno_t reiser4_opset_init (reiser4_tree_t *tree); +#endif extern errno_t reiser4_pset_init (reiser4_tree_t *tree);extern reiser4_plug_t *reiser4_opset_plug (rid_t member,rid_t id); - -extern errno_t reiser4_opset_init (reiser4_tree_t *tree,int check);#endif
libreiser4/filesystem.c +13 -4
@@ -6,14 +6,18 @@#include <reiser4/libreiser4.h> /* Opens filesystem on specified device */ -reiser4_fs_t *reiser4_fs_open (aal_device_t *device, -bool_t check) -{ + +#ifndef ENABLE_STAND_ALONE +reiser4_fs_t *reiser4_fs_open (aal_device_t *device,bool_t check) { +#else +reiser4_fs_t *reiser4_fs_open (aal_device_t *device) { +#endif +reiser4_fs_t *fs; +#ifndef ENABLE_STAND_ALONE count_t blocks;uint32_t blksize;#endif -reiser4_fs_t *fs;aal_assert ("umka-148" , device !=NULL );
@@ -76,10 +80,15 @@ goto error_free_oid; +#ifndef ENABLE_STAND_ALONE if (check) {if (reiser4_opset_init (fs->tree, check)) goto error_free_oid; } +#else +if (reiser4_opset_init (fs->tree)) + goto error_free_oid; +#endif return fs;
libreiser4/pset.c +7 -3
@@ -343,7 +343,11 @@return 0 ; } +#ifndef ENABLE_STAND_ALONE errno_t reiser4_opset_init (reiser4_tree_t *tree,int check) { +#else +errno_t reiser4_opset_init (reiser4_tree_t *tree) { +#endif reiser4_object_t *object;uint8_t i;
@@ -359,10 +363,11 @@ sizeof(reiser4_plug_t *) * OPSET_LAST);reiser4_object_close (object); - + +#ifndef ENABLE_STAND_ALONE /* Check that all 'on-disk' plugins are obtained. */ for (i =0 ; i <OPSET_STORE_LAST ; i++) { -/* If root is should not be checked (debugreiserfs), +/* If root should not be checked (debugreiserfs), skip this loop. */ if (!check)break ;
@@ -374,7 +379,6 @@ } } -#ifndef ENABLE_STAND_ALONE /* Set others from the profile. */ for (; i <OPSET_LAST ; i++) {if (!tree->ent.opset[i] && opset_prof[i].prof !=INVAL_PID )
libreiser4/tree.c +8 -3
@@ -1280,13 +1280,17 @@/* Allocating unallocated extent item at @place. */ return reiser4_tree_alloc_extent(tree, place); } +#endif static errno_t cb_node_unload (reiser4_tree_t *tree,reiser4_node_t *node) { +#ifndef ENABLE_STAND_ALONE count_t free_blocks; -/* Updating free space counter in format. */ +/* Updating free space counter in format for the case some blocks were +allocated. */ free_blocks =reiser4_alloc_free (tree->fs->alloc);reiser4_format_set_free (tree->fs->format, free_blocks); +#endif /* If node is locked, that is not a leaf or it is used by someone, it cannot be released, and thus, it does not make the sense to save it
@@ -1294,16 +1298,17 @@if (reiser4_node_locked (node))return 0 ; +#ifndef ENABLE_STAND_ALONE /* Okay, node is fully allocated now and ready to be saved to device if it is dirty. */ if (reiser4_node_isdirty (node) &&reiser4_node_sync (node)) {aal_error ("Can't write node %llu." , node->block->nr);return -EIO ; } +#endif /* Unloading node from tree cache. */ return reiser4_tree_unload_node (tree, node); } -#endif /* Entry point for adjsuting tree routines. */
@@ -1325,7 +1330,7 @@ cb_node_unload);#else res =reiser4_tree_walk_node (tree, tree->root, - reiser4_tree_unload_node); + cb_node_unload);#endif tree->adjusting =0 ;
grub-0.94/config.h.in renamed from grub-0.94.orig/config.h.in +6 -0
@@ -50,6 +50,12 @@ /* Define to 1 if you have the <inttypes.h> header file. */ #undef HAVE_INTTYPES_H +/* Define to 1 if you have the `aal-alone' library (-laal-alone). */ +#undef HAVE_LIBAAL_ALONE + +/* Define to 1 if you have the `reiser4-alone' library (-lreiser4-alone). */ +#undef HAVE_LIBREISER4_ALONE + /* Define to 1 if you have the <memory.h> header file. */ #undef HAVE_MEMORY_H
grub-0.94/configure.ac renamed from grub-0.94.orig/configure.ac +71 -0
77 lines not on this page · raw message
grub-0.94/docs/grub.texi renamed from grub-0.94.orig/docs/grub.texi +2 -1
@@ -277,7 +277,7 @@ Support multiple filesystem types transparently, plus a useful explicit blocklist notation. The currently supported filesystem types are @dfn{BSD FFS}, @dfn{DOS FAT16 and FAT32}, @dfn{Minix fs}, @dfn{Linux -ext2fs}, @dfn{ReiserFS}, @dfn{JFS}, @dfn{XFS}, and @dfn{VSTa +ext2fs}, @dfn{ReiserFS}, @dfn{Reiser4}, @dfn{JFS}, @dfn{XFS}, and @dfn{VSTa fs}. @xref{Filesystem}, for more information. @item Support automatic decompression
@@ -1528,6 +1528,7 @@ @itemx jfs_stage1_5 @itemx minix_stage1_5 @itemx reiserfs_stage1_5 +@itemx reiser4_stage1_5 @itemx vstafs_stage1_5 @itemx xfs_stage1_5
grub-0.94/grub/Makefile.am renamed from grub-0.94.orig/grub/Makefile.am +1 -1
@@ -14,4 +14,4 @@ AM_CFLAGS = $(GRUB_CFLAGS) -fwritable-strings grub_SOURCES = main.c asmstub.c -grub_LDADD = ../stage2/libgrub.a ../lib/libcommon.a $(GRUB_LIBS) +grub_LDADD = ../stage2/libgrub.a ../lib/libcommon.a $(GRUB_LIBS) $(REISER4_LIBS)
grub-0.94/INSTALL renamed from grub-0.94.orig/INSTALL +3 -0
@@ -207,6 +207,9 @@ `--disable-reiserfs' Omit the ReiserFS support in Stage 2. +`--disable-reiser4' + Omit the Reiser4 support in Stage 2. + `--disable-vstafs' Omit the VSTa filesystem support in Stage 2.
grub-0.94/stage2/builtins.c renamed from grub-0.94.orig/stage2/builtins.c +1 -0
@@ -3751,6 +3751,7 @@ {"jfs", "/jfs_stage1_5"}, {"minix", "/minix_stage1_5"}, {"reiserfs", "/reiserfs_stage1_5"}, + {"reiser4", "/reiser4_stage1_5"}, {"vstafs", "/vstafs_stage1_5"}, {"xfs", "/xfs_stage1_5"} };
grub-0.94/stage2/disk_io.c renamed from grub-0.94.orig/stage2/disk_io.c +3 -0
@@ -63,6 +63,9 @@ # ifdef FSYS_REISERFS {"reiserfs", reiserfs_mount, reiserfs_read, reiserfs_dir, 0, reiserfs_embed}, # endif +# ifdef FSYS_REISER4 + {"reiser4", reiser4_mount, reiser4_read, reiser4_dir, 0, reiser4_embed}, +# endif # ifdef FSYS_VSTAFS {"vstafs", vstafs_mount, vstafs_read, vstafs_dir, 0, 0}, # endif
grub-0.94/stage2/filesys.h renamed from grub-0.94.orig/stage2/filesys.h +12 -2
@@ -67,6 +67,16 @@#define FSYS_REISERFS_NUM 0#endif +#ifdef FSYS_REISER4 +#define FSYS_REISER4_NUM 1 +int reiser4_mount (void ); +int reiser4_read (char *buf,int len); +int reiser4_dir (char *dirname); +int reiser4_embed (int *start_sector,int needed_sectors); +#else +#define FSYS_REISER4_NUM 0 +#endif +#ifdef FSYS_VSTAFS #define FSYS_VSTAFS_NUM 1int vstafs_mount (void );
@@ -108,8 +118,8 @@#ifndef NUM_FSYS #define NUM_FSYS \ (FSYS_FFS_NUM + FSYS_FAT_NUM + FSYS_EXT2FS_NUM + FSYS_MINIX_NUM \ - + FSYS_REISERFS_NUM + FSYS_VSTAFS_NUM + FSYS_JFS_NUM + FSYS_XFS_NUM \ - + FSYS_TFTP_NUM) + + FSYS_REISERFS_NUM + FSYS_REISER4_NUM + FSYS_VSTAFS_NUM + FSYS_JFS_NUM \ + + FSYS_XFS_NUM + FSYS_TFTP_NUM)#endif /* defines for the block filesystem info area */
grub-0.94/stage2/fsys_reiser4.c renamed from grub-0.94.orig/stage2/fsys_reiser4.c +260 -0
260 lines not on this page · raw message
grub-0.94/stage2/Makefile.am renamed from grub-0.94.orig/stage2/Makefile.am +34 -14
99 lines not on this page · raw message
grub-0.94/stage2/shared.h renamed from grub-0.94.orig/stage2/shared.h +6 -3
@@ -202,9 +202,10 @@#define STAGE2_ID_FAT_STAGE1_5 3#define STAGE2_ID_MINIX_STAGE1_5 4#define STAGE2_ID_REISERFS_STAGE1_5 5 -#define STAGE2_ID_VSTAFS_STAGE1_5 6 -#define STAGE2_ID_JFS_STAGE1_5 7 -#define STAGE2_ID_XFS_STAGE1_5 8 +#define STAGE2_ID_REISER4_STAGE1_5 6 +#define STAGE2_ID_VSTAFS_STAGE1_5 7 +#define STAGE2_ID_JFS_STAGE1_5 8 +#define STAGE2_ID_XFS_STAGE1_5 9#ifndef STAGE1_5 # define STAGE2_ID STAGE2_ID_STAGE2
@@ -219,6 +220,8 @@# define STAGE2_ID STAGE2_ID_MINIX_STAGE1_5# elif defined(FSYS_REISERFS )# define STAGE2_ID STAGE2_ID_REISERFS_STAGE1_5 +# elif defined(FSYS_REISER4 ) +# define STAGE2_ID STAGE2_ID_REISER4_STAGE1_5# elif defined(FSYS_VSTAFS )# define STAGE2_ID STAGE2_ID_VSTAFS_STAGE1_5# elif defined(FSYS_JFS )
Quoted 2 lines · Vitaly Fertman
thy this improved patch (it includes the previous one) and a bit modified grub patch please.
ok, in /bin are still only 5 files, although it segfaults less often now, it only segfaults if i try to access files like kernel (hd0,0)/bin/bash[enter] I cannot get it to segfault only with tab. It does not list the contents of /usr/doc or /usr/src and if I try (hd0,0)/usr/src/linux[enter]
Error 15: File not found
But I swear its there, same result with /usr/doc, I can navigate through my home with [tab], but I cannot get any of the files, It either segfaults or says file not found ..
Quoted 10 lines · Stefan Schweizer
Quoted 2 lines · Vitaly Fertman
thy this improved patch (it includes the previous one) and a bit modified grub patch please.
ok, in /bin are still only 5 files, although it segfaults less often now, it only segfaults if i try to access files like kernel (hd0,0)/bin/bash[enter] I cannot get it to segfault only with tab. It does not list the contents of
/usr/docor/usr/srcand if I try (hd0,0)/usr/src/linux[enter]
Quoted 5 lines
Error 15: File not found
But I swear its there, same result with
/usr/doc, I can navigate through my home with [tab], but I cannot get any of the files, It either segfaults or says file not found ..
Was it grub-0.95 that segfaulted? It is on reiser4 also, right?
I cannot reproduce these segfaults actually. grub-0.94 works and the only case 0.95 segfaults for me is '(hd2,[tab]'.
Could you make evth clean and build again from scratch?
Signature · 2 lines
Thanks, Vitaly Fertman