Subject: kern/33176: coda filehandles are too big on 64 bit archs
To: None <kern-bug-people@netbsd.org, gnats-admin@netbsd.org,>
From: Martin Husemann <martin@duskware.de>
List: netbsd-bugs
Date: 03/31/2006 18:35:00
>Number:         33176
>Category:       kern
>Synopsis:       coda filehandles are too big on 64 bit archs
>Confidential:   no
>Severity:       critical
>Priority:       high
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Mar 31 18:35:00 +0000 2006
>Originator:     Martin Husemann
>Release:        NetBSD 3.99.16
>Organization:
>Environment:
System: NetBSD night-owl.duskware.de 3.99.16 NetBSD 3.99.16 (NIGHT-OWL) #1: Sun Mar 5 19:48:52 CET 2006 martin@night-owl.duskware.de:/usr/src/sys/arch/i386/compile/NIGHT-OWL i386
Architecture: i386
Machine: i386
>Description:

Coda uses a struct for filehandles that will be larger than 16 byte
(our current value for _VFS_MAXFIDSZ) on 64 bit archs.

>How-To-Repeat:
Code inspection.

>Fix:
I don't run coda, so I can't easily test this (and actually did not even 
compile test it), but maybe this is enough:

Index: coda.h
===================================================================
RCS file: /cvsroot/src/sys/coda/coda.h,v
retrieving revision 1.13
diff -u -r1.13 coda.h
--- coda.h	2 Mar 2006 14:24:57 -0000	1.13
+++ coda.h	31 Mar 2006 18:30:46 -0000
@@ -197,9 +197,9 @@
 #ifdef CODA_COMPAT_5
 
 typedef struct {
-    u_long Volume;
-    u_long Vnode;
-    u_long Unique;
+    uint32_t Volume;
+    uint32_t Vnode;
+    uint32_t Unique;
 } CodaFid;
 
 static inline ino_t coda_f2i(CodaFid *fid)
@@ -211,7 +211,7 @@
 static inline char * coda_f2s(CodaFid *fid)
 {
   static char fid_str [35];
-  snprintf (fid_str, 35, "[%lx.%lx.%lx]", fid->Volume,
+  snprintf (fid_str, 35, "[%" PRIx32 ".%" PRIx32 ".%" PRIx32 "]", fid->Volume,
 	    fid->Vnode, fid->Unique);
   return fid_str;
 }