[Pvfs2-cvs] commit by mtmoore in pvfs2/src/proto: pvfs2-req-proto.h

CVS commit program cvs at parl.clemson.edu
Fri Feb 25 17:20:48 EST 2011


Update of /projects/cvsroot/pvfs2/src/proto
In directory parlweb1:/tmp/cvs-serv30157/src/proto

Modified Files:
      Tag: Orange-Branch
	pvfs2-req-proto.h 
Log Message:
fix to segfault in list-eattr if client provides too large of buffer, found by Mike Marshall. Also includes other changes to enforce attribute name, value and list lengths for eattr operations on the server side and list-eattr on the client side.


Index: pvfs2-req-proto.h
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/proto/pvfs2-req-proto.h,v
diff -p -u -r1.159.8.8 -r1.159.8.9
--- pvfs2-req-proto.h	30 Apr 2010 20:00:54 -0000	1.159.8.8
+++ pvfs2-req-proto.h	25 Feb 2011 22:20:48 -0000	1.159.8.9
@@ -153,6 +153,13 @@ enum PVFS_server_op
 #define PVFS_REQ_LIMIT_KEYVAL_LIST 32
 /* max number of handles for which we return attributes */
 #define PVFS_REQ_LIMIT_LISTATTR 60
+/* max number of bytes in an extended attribute key including null term */
+#define PVFS_REQ_LIMIT_EATTR_KEY_LEN    PVFS_MAX_XATTR_NAMELEN
+/* max number of bytes in an extended attribute value including null term */
+#define PVFS_REQ_LIMIT_EATTR_VAL_LEN    PVFS_MAX_XATTR_VALUELEN
+/* max number of keys or key/value pairs to set or get in an operation */
+#define PVFS_REQ_LIMIT_EATTR_LIST       PVFS_MAX_XATTR_LISTLEN 
+
 
 /* create *********************************************************/
 /* - used to create an object.  This creates a metadata handle,
@@ -1726,7 +1733,8 @@ endecode_fields_2aa_struct(
     PVFS_ds_keyval, key,
     PVFS_size, valsz);
 #define extra_size_PVFS_servreq_geteattr \
-    (PVFS_REQ_LIMIT_KEY_LEN * PVFS_REQ_LIMIT_KEYVAL_LIST)
+    ((PVFS_REQ_LIMIT_EATTR_KEY_LEN + sizeof(PVFS_size) \
+     * PVFS_REQ_LIMIT_EATTR_LIST))
 
 #define PINT_SERVREQ_GETEATTR_FILL(__req,   \
                                   __creds, \
@@ -1761,8 +1769,8 @@ endecode_fields_1aa_struct(
     PVFS_ds_keyval, val,
     PVFS_error, err);
 #define extra_size_PVFS_servresp_geteattr \
-    (PVFS_REQ_LIMIT_VAL_LEN * PVFS_REQ_LIMIT_KEYVAL_LIST + \
-    PVFS_REQ_LIMIT_KEYVAL_LIST * sizeof(PVFS_error))
+    ((PVFS_REQ_LIMIT_EATTR_VAL_LEN + sizeof(PVFS_error)) \
+     * PVFS_REQ_LIMIT_EATTR_LIST)
 
 /* seteattr ****************************************************/
 /* - sets list of extended attributes */
@@ -1786,8 +1794,8 @@ endecode_fields_4aa_struct(
     PVFS_ds_keyval, key,
     PVFS_ds_keyval, val);
 #define extra_size_PVFS_servreq_seteattr \
-    ((PVFS_REQ_LIMIT_KEY_LEN + PVFS_REQ_LIMIT_VAL_LEN) \
-        * PVFS_REQ_LIMIT_KEYVAL_LIST)
+    ((PVFS_REQ_LIMIT_EATTR_KEY_LEN  + PVFS_REQ_LIMIT_EATTR_VAL_LEN) \
+        * PVFS_REQ_LIMIT_EATTR_LIST)
 
 #define PINT_SERVREQ_SETEATTR_FILL(__req,   \
                                   __creds,       \
@@ -1826,7 +1834,7 @@ endecode_fields_3_struct(
     PVFS_fs_id, fs_id,
     PVFS_ds_keyval, key);
 #define extra_size_PVFS_servreq_deleattr \
-    PVFS_REQ_LIMIT_KEY_LEN
+    PVFS_REQ_LIMIT_EATTR_KEY_LEN 
 
 #define PINT_SERVREQ_DELEATTR_FILL(__req,   \
                                   __creds, \
@@ -1865,7 +1873,7 @@ endecode_fields_4a_struct(
     uint32_t, nkey,
     PVFS_size, keysz);
 #define extra_size_PVFS_servreq_listeattr \
-    (PVFS_REQ_LIMIT_KEYVAL_LIST * sizeof(PVFS_size))
+    (PVFS_REQ_LIMIT_EATTR_LIST * sizeof(PVFS_size))
 
 #define PINT_SERVREQ_LISTEATTR_FILL(__req,            \
                                   __creds,            \
@@ -1900,7 +1908,7 @@ endecode_fields_2a_struct(
     uint32_t, nkey,
     PVFS_ds_keyval, key);
 #define extra_size_PVFS_servresp_listeattr \
-    (PVFS_REQ_LIMIT_KEY_LEN * PVFS_REQ_LIMIT_KEYVAL_LIST)
+    (PVFS_REQ_LIMIT_EATTR_KEY_LEN * PVFS_REQ_LIMIT_EATTR_LIST)
 
 
 /* server request *********************************************/



More information about the Pvfs2-cvs mailing list