Coda File System

Re: codasrv crash on netbsd/sparc64 3.0

From: Jan Harkes <jaharkes_at_cs.cmu.edu>
Date: Tue, 25 Apr 2006 13:27:15 -0400
On Tue, Apr 25, 2006 at 01:01:44PM -0400, Sean Caron wrote:
> I do have to apologise for my clumsiness with gdb. I'm not all that familiar
> with it but I'll do my best to obtain any data that you guys might find
> interesting.
> 
> So, I do:
> 
> blossom: {55} gdb /usr/local/sbin/codasrv
> 
> (gdb) run -d 1
> Starting program: /usr/local/sbin/codasrv -d 1
> Setting debuglevel to 1
> 
> Program received signal SIGBUS, Bus error.
> readints (f=0x0, a=0xffffc568, b=0xffffc564, pos=2659) at rwcdb_pack.h:69
> 69          *a = SWAP_IN(p->a);
> Current language:  auto; currently c

Ok, that could make sense, if the pdb database is < 256KB we mmap it.
I though the code aligned things correctly (on a 32-bit boundary), but
maybe it doesn't.

My guess is that 'pdbtool list' on your server will probably crash with
the same bus error.

The following patch disables mmap and so we read the data we want into
a buffer we get from malloc (which should be properly aligned).

Jan


diff a/lib-src/rwcdb/rwcdb_file.c b/lib-src/rwcdb/rwcdb_file.c
index 57a497b..c7a40e5 100644
--- a/lib-src/rwcdb/rwcdb_file.c
+++ b/lib-src/rwcdb/rwcdb_file.c
@@ -84,7 +84,7 @@ int db_file_mread(struct db_file *f, voi
     if (pos + len > f->len)
         return -1;
 
-#ifdef HAVE_MMAP
+#if 0
     if (!f->map && f->len <= MMAP_THRESHOLD) {
         f->map = mmap(0, f->len, PROT_READ, MAP_SHARED, f->fd, 0);
         if (f->map == MAP_FAILED) f->map = NULL;
Received on 2006-04-25 13:28:04