]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
use-private-xdr-in-kernel-to-avoid-conflicts-over-memory-ownership-20020608
authorDerrick Brashear <shadow@dementia.org>
Sat, 8 Jun 2002 08:44:09 +0000 (08:44 +0000)
committerDerrick Brashear <shadow@dementia.org>
Sat, 8 Jun 2002 08:44:09 +0000 (08:44 +0000)
allocating memory from a pool and then having it be freed out from under you is unwise

12 files changed:
src/afs/afs_callback.c
src/afs/sysincludes.h
src/fsint/afsaux.c
src/fsint/afsint.xg
src/libafs/Makefile.common.in
src/rx/rx_kcommon.h
src/rx/xdr.c
src/rx/xdr.h
src/rx/xdr_rx.c
src/rxgen/rpc_main.c
src/rxkad/rxkad_client.c
src/rxkad/rxkad_common.c

index f59ef40d7d4f544c8a8fdcd78398f1d7acf528bc..01adda3d546e5606c1b39c819062ea5fb9866ac1 100644 (file)
@@ -1203,7 +1203,7 @@ int SRXAFSCB_GetCellServDB(
        afs_PutCell(tcell, READ_LOCK);
     }
 
-    t_name = (char *)rxi_Alloc(i+1);
+    t_name = (char *)afs_osi_Alloc(i+1);
     if (t_name == NULL) {
        ReleaseReadLock(&afs_xcell);
        RX_AFS_GUNLOCK();
@@ -1276,7 +1276,7 @@ int SRXAFSCB_GetLocalCell(
        plen = strlen(p_name);
     else
        plen = 0;
-    t_name = (char *)rxi_Alloc(plen+1);
+    t_name = (char *)afs_osi_Alloc(plen+1);
     if (t_name == NULL) {
        ReleaseReadLock(&afs_xcell);
        RX_AFS_GUNLOCK();
@@ -1376,7 +1376,7 @@ int SRXAFSCB_GetCacheConfig(
      * Currently only support version 1
      */
     allocsize = sizeof(cm_initparams_v1);
-    t_config = (afs_uint32 *)rxi_Alloc(allocsize);
+    t_config = (afs_uint32 *)afs_osi_Alloc(allocsize);
     if (t_config == NULL) {
        RX_AFS_GUNLOCK();
        return ENOMEM;
index 231c99e09564a4d4fffa5c4df9182cb542a2fa11..5e274321891724747f592438fa729a73589662b7 100644 (file)
@@ -271,7 +271,7 @@ MALLOC_DECLARE(M_AFS);
 #endif /* AFS_SUN5_ENV */
 
 #include "../rpc/types.h"
-#include "../rpc/xdr.h"
+#include "../rx/xdr.h"
 
 #ifdef AFS_AIX32_ENV
 #  include "net/spl.h"
@@ -366,7 +366,7 @@ MALLOC_DECLARE(M_AFS);
 #undef register
 #endif /* AFS_ALPHA_ENV */
 
-#include <rpc/xdr.h>
+#include <rx/xdr.h>
 #include <sys/proc.h>
 #include <sys/ioctl.h>
 
index 32edb08bfaf2057e7b62c953910bf96371662997..aaf14a04dfdfb9992f3b916937d2a07ab6b61dc8 100644 (file)
@@ -28,7 +28,7 @@ RCSID("$Header$");
 #else
 #include "../h/types.h"
 #include "../rpc/types.h"
-#include "../rpc/xdr.h"
+#include "../rx/xdr.h"
 #endif
 #if !defined(AFS_ALPHA_ENV)
 #ifndef        XDR_GETINT32
@@ -38,9 +38,6 @@ RCSID("$Header$");
 #define        XDR_PUTINT32    XDR_PUTLONG
 #endif
 #endif
-#ifndef AFS_LINUX22_ENV
-#include "../rpc/auth.h"
-#endif
 #endif /* defined(UKERNEL) */
 #include "../afsint/afsint.h"
 #else /* KERNEL */
index 64a7444af2358d0b01a6b291eab76cf367d6e90d..bc95caca5ca8dd82d1b8e9466f06d639f7a57b0c 100644 (file)
@@ -45,7 +45,7 @@ typedef afs_int32 ViceDataType;
 %#define SymbolicLink 3 
 
 %#ifdef       KERNEL
-%#define      xdr_array(a,b,c,d,e,f)  xdr_arrayN(a,b,c,d,e,f)
+%#define      afs_xdr_array(a,b,c,d,e,f)  afs_xdr_arrayN(a,b,c,d,e,f)
 %#endif
 
 struct BD {
index 3ee55513f1369a4f62e4583583c913ece53dd78d..4378945e7256c9b780c601bce26e62629228eee8 100644 (file)
@@ -92,6 +92,8 @@ AFSAOBJS = \
        afsaux.o                \
        Kvice.xdr.o     \
        xdr_arrayn.o    \
+       xdr_array.o     \
+       xdr_int64.o     \
        Kvice.cs.o      \
        fcrypt.o                \
        rx.o            \
@@ -119,6 +121,7 @@ AFSAOBJS = \
        rxkad_client.o  \
        rxkad_common.o  \
        xdr_afsuuid.o   \
+       xdr.o           \
        afs_uuid.o $(AFS_OS_OBJS)
 
 # These next two allow nfs and nonfs builds to occur in the same directory.
@@ -308,6 +311,12 @@ afsaux.o: $(AFSINT)/afsaux.c
        $(CRULE1)
 xdr_arrayn.o: $(RX)/xdr_arrayn.c
        $(CRULE1)
+xdr_array.o: $(RX)/xdr_array.c
+       $(CRULE1)
+xdr_int64.o: $(RX)/xdr_int64.c
+       $(CRULE1)
+xdr.o: $(RX)/xdr.c
+       $(CRULE1)
 Kvldbint.cs.o: $(AFSINT)/Kvldbint.cs.c
        $(CRULE1)
 Kvldbint.xdr.o: $(AFSINT)/Kvldbint.xdr.c
index 3d3ed69b7d28207345bbdf9f250bbdfbdf859c45..c83c88f5b1f85fa0f58afa1e17737fa5264fe826 100644 (file)
@@ -93,9 +93,7 @@ struct coda_inode_info {};
 #include "../afs/afs_osi.h"
 #include "../rx/rx_kmutex.h"
 #include "../afs/lock.h"
-#ifndef AFS_LINUX22_ENV
-#include "../rpc/xdr.h"
-#endif
+#include "../rx/xdr.h"
 #include "../rx/rx.h"
 #include "../rx/rx_globals.h"
 #include "../afs/longc_procs.h"
index 2aa70b9207593754a55669e49cbc5e3a260c60cc..8ca8a4aec794d97ce6609096140006db5e166943 100644 (file)
@@ -129,22 +129,22 @@ xdr_u_int(xdrs, up)
        return (FALSE);
 }
 
-
+#else
 /*
  * XDR afs_int32 integers
  * same as xdr_u_long - open coded to save a proc call!
  */
 bool_t
-xdr_long(xdrs, lp)
+xdr_int(xdrs, lp)
        register XDR *xdrs;
-       long *lp;
+       int *lp;
 {
 
        if (xdrs->x_op == XDR_ENCODE)
-               return (XDR_PUTINT32(xdrs, lp));
+               return (XDR_PUTINT32(xdrs, (long *)lp));
 
        if (xdrs->x_op == XDR_DECODE)
-               return (XDR_GETINT32(xdrs, lp));
+               return (XDR_GETINT32(xdrs, (long *)lp));
 
        if (xdrs->x_op == XDR_FREE)
                return (TRUE);
@@ -157,38 +157,37 @@ xdr_long(xdrs, lp)
  * same as xdr_long - open coded to save a proc call!
  */
 bool_t
-xdr_u_long(xdrs, ulp)
+xdr_u_int(xdrs, ulp)
        register XDR *xdrs;
-       u_long *ulp;
+       int *ulp;
 {
 
        if (xdrs->x_op == XDR_DECODE)
                return (XDR_GETINT32(xdrs, (long *)ulp));
-
        if (xdrs->x_op == XDR_ENCODE)
                return (XDR_PUTINT32(xdrs, (long *)ulp));
-
        if (xdrs->x_op == XDR_FREE)
                return (TRUE);
-
        return (FALSE);
 }
-#else
+#endif
+
+
 /*
  * XDR afs_int32 integers
  * same as xdr_u_long - open coded to save a proc call!
  */
 bool_t
-xdr_int(xdrs, lp)
+xdr_long(xdrs, lp)
        register XDR *xdrs;
-       int *lp;
+       long *lp;
 {
 
        if (xdrs->x_op == XDR_ENCODE)
-               return (XDR_PUTINT32(xdrs, (long *)lp));
+               return (XDR_PUTINT32(xdrs, lp));
 
        if (xdrs->x_op == XDR_DECODE)
-               return (XDR_GETINT32(xdrs, (long *)lp));
+               return (XDR_GETINT32(xdrs, lp));
 
        if (xdrs->x_op == XDR_FREE)
                return (TRUE);
@@ -201,20 +200,23 @@ xdr_int(xdrs, lp)
  * same as xdr_long - open coded to save a proc call!
  */
 bool_t
-xdr_u_int(xdrs, ulp)
+xdr_u_long(xdrs, ulp)
        register XDR *xdrs;
-       int *ulp;
+       u_long *ulp;
 {
 
        if (xdrs->x_op == XDR_DECODE)
                return (XDR_GETINT32(xdrs, (long *)ulp));
+
        if (xdrs->x_op == XDR_ENCODE)
                return (XDR_PUTINT32(xdrs, (long *)ulp));
+
        if (xdrs->x_op == XDR_FREE)
                return (TRUE);
+
        return (FALSE);
 }
-#endif
+
 /*
  * XDR chars
  */
index c74a8f0f72fb92918d0145529595f0aec539332d..68697450981e0079acf54bcbf1e1058cf5fea84e 100644 (file)
 void *afs_osi_Alloc();
 #define        osi_alloc               afs_osi_Alloc
 #define        osi_free                afs_osi_Free
+
+#ifndef UKERNEL
+#define xdr_void afs_xdr_void
+#define xdr_int afs_xdr_int
+#define xdr_u_int afs_xdr_u_int
+#define xdr_short afs_xdr_short
+#define xdr_u_short afs_xdr_u_short
+#define xdr_long afs_xdr_long
+#define xdr_u_long afs_xdr_u_long
+#define xdr_char afs_xdr_char
+#define xdr_u_char afs_xdr_u_char
+#define xdr_bool afs_xdr_bool
+#define xdr_enum afs_xdr_enum
+#define xdr_array afs_xdr_array
+#define xdr_arrayN afs_xdr_arrayN
+#define xdr_bytes afs_xdr_bytes
+#define xdr_opaque afs_xdr_opaque
+#define xdr_string afs_xdr_string
+#define xdr_union afs_xdr_union
+#define xdr_float afs_xdr_float
+#define xdr_double afs_xdr_double
+#define xdr_reference afs_xdr_reference
+#define xdr_wrapstring afs_xdr_wrapstring
+#define xdr_vector afs_xdr_vector
+#define xdr_int64 afs_xdr_int64
+#define xdr_uint64 afs_xdr_uint64
+#endif
 #endif
 #ifndef major          /* ouch! */
 #include <sys/types.h>
index d4942f747445f09ac3104bb9df339f3969f9d59a..5ef8876b5b393230a6b5335fc5a585bc0e49db7d 100644 (file)
@@ -45,7 +45,7 @@ RCSID("$Header$");
 #define u_quad_t __u_quad_t
 #endif
 #endif
-#include "../rpc/xdr.h"
+#include "../rx/xdr.h"
 #include "../netinet/in.h"
 #else /* !UKERNEL */
 #include "../afs/sysincludes.h"
index 0b003b8af313d64fc3c0e61b6ac95af5a3bc2925..d1f450c3722630fbcd6204be6b05aaf7bc4ac3c7 100644 (file)
@@ -436,14 +436,7 @@ c_output(infile, define, extend, outfile, append)
            f_print(fout, "#include \"../h/stat.h\"\n");
            f_print(fout, "#include \"../netinet/in.h\"\n");
            f_print(fout, "#include \"../h/time.h\"\n");
-           f_print(fout, "#ifndef AFS_LINUX22_ENV\n");
-           f_print(fout, "#include \"../rpc/types.h\"\n");
-           f_print(fout, "#endif /* AFS_LINUX22_ENV */\n");
-           f_print(fout, "#ifdef AFS_LINUX22_ENV\n");
            f_print(fout, "#include \"../rx/xdr.h\"\n");
-           f_print(fout, "#else /* AFS_LINUX22_ENV */\n");
-           f_print(fout, "#include \"../rpc/xdr.h\"\n");
-           f_print(fout, "#endif /* AFS_LINUX22_ENV */\n");
            f_print(fout, "#include \"../afsint/rxgen_consts.h\"\n");
        } else {
            f_print(fout, "#include <rx/xdr.h>\n");
@@ -570,13 +563,7 @@ h_output(infile, define, extend, outfile, append)
        f_print(fout, "#define u_quad_t __u_quad_t\n");
        f_print(fout, "#endif\n");
        f_print(fout, "#endif\n");
-       f_print(fout, "#ifdef AFS_LINUX22_ENV\n");
        f_print(fout, "#include \"../rx/xdr.h\"\n");
-       f_print(fout, "#else /* AFS_LINUX22_ENV */\n");
-       f_print(fout, "extern bool_t xdr_int64();\n");
-       f_print(fout, "extern bool_t xdr_uint64();\n");
-       f_print(fout, "#include \"../rpc/xdr.h\"\n");
-       f_print(fout, "#endif /* AFS_LINUX22_ENV */\n");
        f_print(fout, "#endif /* XDR_GETLONG */\n");
        f_print(fout, "#endif   /* UKERNEL */\n");
        f_print(fout, "#include \"../afsint/rxgen_consts.h\"\n");
@@ -752,11 +739,7 @@ int append;
            f_print(fout, "#include \"../netinet/in.h\"\n");
            f_print(fout, "#include \"../h/time.h\"\n");
            f_print(fout, "#include \"../rpc/types.h\"\n");
-           f_print(fout, "#ifdef AFS_LINUX22_ENV\n");
            f_print(fout, "#include \"../rx/xdr.h\"\n");
-           f_print(fout, "#else /* AFS_LINUX22_ENV */\n");
-           f_print(fout, "#include \"../rpc/xdr.h\"\n");
-           f_print(fout, "#endif /* AFS_LINUX22_ENV */\n");
            f_print(fout, "#include \"../afsint/rxgen_consts.h\"\n");
            f_print(fout, "#include \"../afs/afs_osi.h\"\n");
            f_print(fout, "#include \"../rx/rx.h\"\n");
@@ -827,11 +810,7 @@ int append;
            f_print(fout, "#include \"../netinet/in.h\"\n");
            f_print(fout, "#include \"../h/time.h\"\n");
            f_print(fout, "#include \"../rpc/types.h\"\n");
-           f_print(fout, "#ifdef AFS_LINUX22_ENV\n");
            f_print(fout, "#include \"../rx/xdr.h\"\n");
-           f_print(fout, "#else /* AFS_LINUX22_ENV */\n");
-           f_print(fout, "#include \"../rpc/xdr.h\"\n");
-           f_print(fout, "#endif /* AFS_LINUX22_ENV */\n");
            f_print(fout, "#include \"../afsint/rxgen_consts.h\"\n");
            f_print(fout, "#include \"../afs/afs_osi.h\"\n");
            f_print(fout, "#include \"../rx/rx.h\"\n");
index f12d5315c3f269fb3f2da7a1811623b477640008..637ac769f03fd8c4dace69ee4bcf2511ed3b4e53 100644 (file)
@@ -34,7 +34,7 @@ RCSID("$Header$");
 #endif /* !UKERNEL */
 #ifndef AFS_LINUX22_ENV
 #include "../rpc/types.h"
-#include "../rpc/xdr.h"
+#include "../rx/xdr.h"
 #endif
 #include "../rx/rx.h"
 #else /* ! KERNEL */
index 96f404acced2d65594f5522c45d8e53a17a33ccb..7f7aab4b8cd1a92808fdd9ee2e524d29071cb0d6 100644 (file)
@@ -29,7 +29,7 @@ RCSID("$Header$");
 #include "../h/time.h"
 #ifndef AFS_LINUX22_ENV
 #include "../rpc/types.h"
-#include "../rpc/xdr.h"
+#include "../rx/xdr.h"
 #endif /* AFS_LINUX22_ENV */
 #else /* !UKERNEL */
 #include "../afs/sysincludes.h"