* [PATCH V2 net 0/1] net/smc and the RDMA core @ 2017-05-12 17:09 Ursula Braun 2017-05-12 17:09 ` [PATCH V2 net 1/1] smc: switch to usage of IB_PD_UNSAFE_GLOBAL_RKEY Ursula Braun 0 siblings, 1 reply; 4+ messages in thread From: Ursula Braun @ 2017-05-12 17:09 UTC (permalink / raw) To: davem-fT/PcQaiUtIeIZ0/mPfg9Q Cc: hch-jcswGhMUV9g, netdev-u79uwXL29TY76Z2rM5mHXA, linux-rdma-u79uwXL29TY76Z2rM5mHXA, linux-s390-u79uwXL29TY76Z2rM5mHXA, jwi-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8, schwidefsky-tA70FqPdS9bQT0dZR+AlfA, heiko.carstens-tA70FqPdS9bQT0dZR+AlfA, raspl-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8, ubraun-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8 From: Ursula Braun <ursula.braun-tA70FqPdS9bQT0dZR+AlfA@public.gmane.org> Hi Dave, yesterday I included a patch proposal into a response to Christoph Hellwig, which is now already seen here: http://patchwork.ozlabs.org/patch/761250/ Christoph suggested an additional improvement not to use __internal_mr. Thus I come up with this improved version V2. Kind regards, Ursula Ursula Braun (1): smc: switch to usage of IB_PD_UNSAFE_GLOBAL_RKEY net/smc/smc_clc.c | 4 ++-- net/smc/smc_core.c | 16 +++------------- net/smc/smc_core.h | 2 +- net/smc/smc_ib.c | 21 ++------------------- net/smc/smc_ib.h | 2 -- 5 files changed, 8 insertions(+), 37 deletions(-) -- 2.10.2 -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH V2 net 1/1] smc: switch to usage of IB_PD_UNSAFE_GLOBAL_RKEY 2017-05-12 17:09 [PATCH V2 net 0/1] net/smc and the RDMA core Ursula Braun @ 2017-05-12 17:09 ` Ursula Braun [not found] ` <20170512170952.39863-2-ubraun-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org> 0 siblings, 1 reply; 4+ messages in thread From: Ursula Braun @ 2017-05-12 17:09 UTC (permalink / raw) To: davem Cc: hch, netdev, linux-rdma, linux-s390, jwi, schwidefsky, heiko.carstens, raspl, ubraun This patch makes users aware of the current security implications when using smc. The final fix to resolve the reported security issue is worked on; respective patches will follow as soon as possible. Signed-off-by: Ursula Braun <ubraun@linux.vnet.ibm.com> --- net/smc/smc_clc.c | 4 ++-- net/smc/smc_core.c | 16 +++------------- net/smc/smc_core.h | 2 +- net/smc/smc_ib.c | 21 ++------------------- net/smc/smc_ib.h | 2 -- 5 files changed, 8 insertions(+), 37 deletions(-) diff --git a/net/smc/smc_clc.c b/net/smc/smc_clc.c index e41f594..03ec058 100644 --- a/net/smc/smc_clc.c +++ b/net/smc/smc_clc.c @@ -204,7 +204,7 @@ int smc_clc_send_confirm(struct smc_sock *smc) memcpy(&cclc.lcl.mac, &link->smcibdev->mac[link->ibport - 1], ETH_ALEN); hton24(cclc.qpn, link->roce_qp->qp_num); cclc.rmb_rkey = - htonl(conn->rmb_desc->mr_rx[SMC_SINGLE_LINK]->rkey); + htonl(conn->rmb_desc->rkey[SMC_SINGLE_LINK]); cclc.conn_idx = 1; /* for now: 1 RMB = 1 RMBE */ cclc.rmbe_alert_token = htonl(conn->alert_token_local); cclc.qp_mtu = min(link->path_mtu, link->peer_mtu); @@ -256,7 +256,7 @@ int smc_clc_send_accept(struct smc_sock *new_smc, int srv_first_contact) memcpy(&aclc.lcl.mac, link->smcibdev->mac[link->ibport - 1], ETH_ALEN); hton24(aclc.qpn, link->roce_qp->qp_num); aclc.rmb_rkey = - htonl(conn->rmb_desc->mr_rx[SMC_SINGLE_LINK]->rkey); + htonl(conn->rmb_desc->rkey[SMC_SINGLE_LINK]); aclc.conn_idx = 1; /* as long as 1 RMB = 1 RMBE */ aclc.rmbe_alert_token = htonl(conn->alert_token_local); aclc.qp_mtu = link->path_mtu; diff --git a/net/smc/smc_core.c b/net/smc/smc_core.c index 65020e9..3ac09a6 100644 --- a/net/smc/smc_core.c +++ b/net/smc/smc_core.c @@ -613,19 +613,8 @@ int smc_rmb_create(struct smc_sock *smc) rmb_desc = NULL; continue; /* if mapping failed, try smaller one */ } - rc = smc_ib_get_memory_region(lgr->lnk[SMC_SINGLE_LINK].roce_pd, - IB_ACCESS_REMOTE_WRITE | - IB_ACCESS_LOCAL_WRITE, - &rmb_desc->mr_rx[SMC_SINGLE_LINK]); - if (rc) { - smc_ib_buf_unmap(lgr->lnk[SMC_SINGLE_LINK].smcibdev, - tmp_bufsize, rmb_desc, - DMA_FROM_DEVICE); - kfree(rmb_desc->cpu_addr); - kfree(rmb_desc); - rmb_desc = NULL; - continue; - } + rmb_desc->rkey[SMC_SINGLE_LINK] = + lgr->lnk[SMC_SINGLE_LINK].roce_pd->unsafe_global_rkey; rmb_desc->used = 1; write_lock_bh(&lgr->rmbs_lock); list_add(&rmb_desc->list, @@ -668,6 +657,7 @@ int smc_rmb_rtoken_handling(struct smc_connection *conn, for (i = 0; i < SMC_RMBS_PER_LGR_MAX; i++) { if ((lgr->rtokens[i][SMC_SINGLE_LINK].rkey == rkey) && + (lgr->rtokens[i][SMC_SINGLE_LINK].dma_addr == dma_addr) && test_bit(i, lgr->rtokens_used_mask)) { conn->rtoken_idx = i; return 0; diff --git a/net/smc/smc_core.h b/net/smc/smc_core.h index 27eb3805..b013cb4 100644 --- a/net/smc/smc_core.h +++ b/net/smc/smc_core.h @@ -93,7 +93,7 @@ struct smc_buf_desc { u64 dma_addr[SMC_LINKS_PER_LGR_MAX]; /* mapped address of buffer */ void *cpu_addr; /* virtual address of buffer */ - struct ib_mr *mr_rx[SMC_LINKS_PER_LGR_MAX]; + u32 rkey[SMC_LINKS_PER_LGR_MAX]; /* for rmb only: * rkey provided to peer */ diff --git a/net/smc/smc_ib.c b/net/smc/smc_ib.c index cb69ab9..b317155 100644 --- a/net/smc/smc_ib.c +++ b/net/smc/smc_ib.c @@ -37,24 +37,6 @@ u8 local_systemid[SMC_SYSTEMID_LEN] = SMC_LOCAL_SYSTEMID_RESET; /* unique system * identifier */ -int smc_ib_get_memory_region(struct ib_pd *pd, int access_flags, - struct ib_mr **mr) -{ - int rc; - - if (*mr) - return 0; /* already done */ - - /* obtain unique key - - * next invocation of get_dma_mr returns a different key! - */ - *mr = pd->device->get_dma_mr(pd, access_flags); - rc = PTR_ERR_OR_ZERO(*mr); - if (IS_ERR(*mr)) - *mr = NULL; - return rc; -} - static int smc_ib_modify_qp_init(struct smc_link *lnk) { struct ib_qp_attr qp_attr; @@ -210,7 +192,8 @@ int smc_ib_create_protection_domain(struct smc_link *lnk) { int rc; - lnk->roce_pd = ib_alloc_pd(lnk->smcibdev->ibdev, 0); + lnk->roce_pd = ib_alloc_pd(lnk->smcibdev->ibdev, + IB_PD_UNSAFE_GLOBAL_RKEY); rc = PTR_ERR_OR_ZERO(lnk->roce_pd); if (IS_ERR(lnk->roce_pd)) lnk->roce_pd = NULL; diff --git a/net/smc/smc_ib.h b/net/smc/smc_ib.h index 7e1f0e2..b567152 100644 --- a/net/smc/smc_ib.h +++ b/net/smc/smc_ib.h @@ -61,8 +61,6 @@ void smc_ib_dealloc_protection_domain(struct smc_link *lnk); int smc_ib_create_protection_domain(struct smc_link *lnk); void smc_ib_destroy_queue_pair(struct smc_link *lnk); int smc_ib_create_queue_pair(struct smc_link *lnk); -int smc_ib_get_memory_region(struct ib_pd *pd, int access_flags, - struct ib_mr **mr); int smc_ib_ready_link(struct smc_link *lnk); int smc_ib_modify_qp_rts(struct smc_link *lnk); int smc_ib_modify_qp_reset(struct smc_link *lnk); -- 2.10.2 ^ permalink raw reply related [flat|nested] 4+ messages in thread
[parent not found: <20170512170952.39863-2-ubraun-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org>]
* Re: [PATCH V2 net 1/1] smc: switch to usage of IB_PD_UNSAFE_GLOBAL_RKEY [not found] ` <20170512170952.39863-2-ubraun-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org> @ 2017-05-13 11:29 ` Leon Romanovsky [not found] ` <20170513112948.GK3616-U/DQcQFIOTAAJjI8aNfphQ@public.gmane.org> 0 siblings, 1 reply; 4+ messages in thread From: Leon Romanovsky @ 2017-05-13 11:29 UTC (permalink / raw) To: Ursula Braun Cc: davem-fT/PcQaiUtIeIZ0/mPfg9Q, hch-jcswGhMUV9g, netdev-u79uwXL29TY76Z2rM5mHXA, linux-rdma-u79uwXL29TY76Z2rM5mHXA, linux-s390-u79uwXL29TY76Z2rM5mHXA, jwi-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8, schwidefsky-tA70FqPdS9bQT0dZR+AlfA, heiko.carstens-tA70FqPdS9bQT0dZR+AlfA, raspl-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8 [-- Attachment #1: Type: text/plain, Size: 732 bytes --] On Fri, May 12, 2017 at 07:09:52PM +0200, Ursula Braun wrote: > This patch makes users aware of the current security implications > when using smc. > > The final fix to resolve the reported security issue is worked on; > respective patches will follow as soon as possible. > > Signed-off-by: Ursula Braun <ubraun-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org> I'm glad that you moved to use IB_PD_UNSAFE_GLOBAL_RKEY, so the users will see the warning in their dmesg log. However can you please update your commit log? There is need to add description of security issue (access to whole physical memory), clear message that doesn't fix anything and remove mentioning unpredictable future (... as soon as possible ...). Thanks [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 833 bytes --] ^ permalink raw reply [flat|nested] 4+ messages in thread
[parent not found: <20170513112948.GK3616-U/DQcQFIOTAAJjI8aNfphQ@public.gmane.org>]
* Re: [PATCH V2 net 1/1] smc: switch to usage of IB_PD_UNSAFE_GLOBAL_RKEY [not found] ` <20170513112948.GK3616-U/DQcQFIOTAAJjI8aNfphQ@public.gmane.org> @ 2017-05-14 6:01 ` Christoph Hellwig 0 siblings, 0 replies; 4+ messages in thread From: Christoph Hellwig @ 2017-05-14 6:01 UTC (permalink / raw) To: Leon Romanovsky Cc: Ursula Braun, davem-fT/PcQaiUtIeIZ0/mPfg9Q, hch-jcswGhMUV9g, netdev-u79uwXL29TY76Z2rM5mHXA, linux-rdma-u79uwXL29TY76Z2rM5mHXA, linux-s390-u79uwXL29TY76Z2rM5mHXA, jwi-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8, schwidefsky-tA70FqPdS9bQT0dZR+AlfA, heiko.carstens-tA70FqPdS9bQT0dZR+AlfA, raspl-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8 On Sat, May 13, 2017 at 02:29:48PM +0300, Leon Romanovsky wrote: > I'm glad that you moved to use IB_PD_UNSAFE_GLOBAL_RKEY, so the users > will see the warning in their dmesg log. > > However can you please update your commit log? There is need to add > description of security issue (access to whole physical memory), clear > message that doesn't fix anything and remove mentioning unpredictable > future (... as soon as possible ...). Yes, please. -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2017-05-14 6:01 UTC | newest] Thread overview: 4+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2017-05-12 17:09 [PATCH V2 net 0/1] net/smc and the RDMA core Ursula Braun 2017-05-12 17:09 ` [PATCH V2 net 1/1] smc: switch to usage of IB_PD_UNSAFE_GLOBAL_RKEY Ursula Braun [not found] ` <20170512170952.39863-2-ubraun-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org> 2017-05-13 11:29 ` Leon Romanovsky [not found] ` <20170513112948.GK3616-U/DQcQFIOTAAJjI8aNfphQ@public.gmane.org> 2017-05-14 6:01 ` Christoph Hellwig
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).