[Openib-windows] [PATCH] [HCA] Secure registered memory

Fab Tillier ftillier at silverstorm.com
Thu Oct 6 09:35:53 PDT 2005


Hi Yossi,

This patch adds calls to secure and unsecure memory regions that get registered.
This is needed so that memory registration caching in the WSD provider works
properly.  Without these calls, the memory registration cache callback is never
invoked.

Let me know if I can apply this.

Thanks,

- Fab

Signed-off-by: Fab Tillier (ftillier at silverstorm.com)

Index: hw/mt23108/vapi/mlxsys/mosal/os_dep/win/mosal_iobuf.c
===================================================================
--- hw/mt23108/vapi/mlxsys/mosal/os_dep/win/mosal_iobuf.c   (revision 101)
+++ hw/mt23108/vapi/mlxsys/mosal/os_dep/win/mosal_iobuf.c   (working copy)
@@ -202,7 +202,32 @@
    rc = MT_EPERM;
    goto err2;
   }
-   
+
+  if( mode == UserMode )
+  {
+   if (req_perm & MOSAL_PERM_WRITE)
+   {
+       new_iobuf->h_secure = MmSecureVirtualMemory(
+           (PVOID)va, (SIZE_T)size, PAGE_READWRITE );
+   }
+   else
+   {
+       new_iobuf->h_secure = MmSecureVirtualMemory(
+           (PVOID)va, (SIZE_T)size, PAGE_READONLY );
+   }
+
+   if( !new_iobuf->h_secure )
+   {
+       MmUnlockPages( mdl_p );
+       rc = MT_EPERM;
+       goto err2;
+   }
+  }
+  else
+  {
+   new_iobuf->h_secure = NULL;
+  }
+
   // fill IOBUF object
   new_iobuf->va = va;
   new_iobuf->size= size;
@@ -222,6 +247,8 @@
 
 static void deregister_segment(MOSAL_iobuf_seg_t iobuf_seg_p)
 {
+   if( iobuf_seg_p->h_secure )
+       MmUnsecureVirtualMemory( iobuf_seg_p->h_secure);
   MmUnlockPages( iobuf_seg_p->mdl_p );    // unlock the buffer 
   IoFreeMdl( iobuf_seg_p->mdl_p );        // free MDL
   FREE(iobuf_seg_p);
Index: hw/mt23108/vapi/mlxsys/mosal/os_dep/win/mosal_iobuf_imp.h
===================================================================
--- hw/mt23108/vapi/mlxsys/mosal/os_dep/win/mosal_iobuf_imp.h   (revision 101)
+++ hw/mt23108/vapi/mlxsys/mosal/os_dep/win/mosal_iobuf_imp.h   (working copy)
@@ -44,6 +44,7 @@
   MT_size_t size;     /* size in bytes of the buffer */
   u_int32_t nr_pages;
   MOSAL_prot_ctx_t prot_ctx;
+  void     *h_secure;
 };
 
 typedef struct mosal_iobuf_seg_st  * MOSAL_iobuf_seg_t;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: reg_secure.patch
Type: application/octet-stream
Size: 1652 bytes
Desc: not available
URL: <http://lists.openfabrics.org/pipermail/ofw/attachments/20051006/f94ba731/attachment.obj>


More information about the ofw mailing list