]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
msg/async/rdma: check memory region size before tx buffer allocation
authorChangcheng Liu <changcheng.liu@aliyun.com>
Fri, 31 May 2019 10:32:04 +0000 (18:32 +0800)
committerChangcheng Liu <changcheng.liu@aliyun.com>
Fri, 23 Aug 2019 02:45:05 +0000 (10:45 +0800)
It'll trigger out-of-bound access problem in kernel if the required
memory region size is bigger than ibv_device_attr.max_mr_size

Signed-off-by: Changcheng Liu <changcheng.liu@aliyun.com>
src/msg/async/rdma/Infiniband.cc

index e920d300ae39bd20d2bbfd84d677b39b20ac1e73..4f7b344367a351fe7c6d4b834c4b0be179d90371 100644 (file)
@@ -943,6 +943,12 @@ void Infiniband::init()
     ldout(cct, 0) << __func__ << " using the max allowed send buffers: " << tx_queue_len << dendl;
   }
 
+  //check for the memory region size misconfiguration
+  if ((uint64_t)cct->_conf->ms_async_rdma_buffer_size * tx_queue_len > device->device_attr.max_mr_size) {
+    lderr(cct) << __func__ << " Out of max memory region size " << dendl;
+    ceph_abort();
+  }
+
   ldout(cct, 1) << __func__ << " device allow " << device->device_attr.max_cqe
                 << " completion entries" << dendl;