public inbox for linux-rdma@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH for-next v3 0/3] Fix memory ordering errors in queues
@ 2021-05-27 19:47 Bob Pearson
  2021-05-27 19:47 ` [PATCH for-next v3 1/3] RDMA/rxe: Add a type flag to rxe_queue structs Bob Pearson
                   ` (4 more replies)
  0 siblings, 5 replies; 9+ messages in thread
From: Bob Pearson @ 2021-05-27 19:47 UTC (permalink / raw)
  To: jgg, zyjzyj2000, linux-rdma; +Cc: Bob Pearson

These patches optimize the memory ordering in rxe_queue.h so
that user space and not kernel space indices are protected for loads
with smp_load_acquire() and stores with smp_store_release(). The
original implementation of this did not apply to all index references
which has recently caused test case errors traced to stale memory loads.
These patches fix those errors and also protect kernel indices from
malicious modification by user space.

Reported-by: Zhu Yanjun <zyjzyj2000@gmail.com>
Fixes: d21a1240f516 ("RDMA/rxe: Use acquire/release for memory ordering")
Signed-off-by: Bob Pearson <rpearsonhpe@gmail.com>
---
v3:
  Protected kernel index in shared queues from modification by user space.
  Pass queue type to allow compiler to optimize queue methods.
v2:
  Add a way to distinguish between user and kernel indices.
v1:
  Add missing smp_load_acquire() calls.
---
Bob Pearson (3):
  RDMA/rxe: Add a type flag to rxe_queue structs
  RDMA/rxe: Protect user space index loads/stores
  RDMA/rxe: Protext kernel index from user space

 drivers/infiniband/sw/rxe/rxe_comp.c  |  31 ++-
 drivers/infiniband/sw/rxe/rxe_cq.c    |  32 ++-
 drivers/infiniband/sw/rxe/rxe_qp.c    |  22 ++-
 drivers/infiniband/sw/rxe/rxe_queue.c |  21 +-
 drivers/infiniband/sw/rxe/rxe_queue.h | 272 ++++++++++++++++++++------
 drivers/infiniband/sw/rxe/rxe_req.c   |  46 +++--
 drivers/infiniband/sw/rxe/rxe_resp.c  |  44 ++++-
 drivers/infiniband/sw/rxe/rxe_srq.c   |   5 +-
 drivers/infiniband/sw/rxe/rxe_verbs.c |  80 ++++++--
 drivers/infiniband/sw/rxe/rxe_verbs.h |   5 +-
 10 files changed, 423 insertions(+), 135 deletions(-)

-- 
2.30.2


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2021-06-03 18:56 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-05-27 19:47 [PATCH for-next v3 0/3] Fix memory ordering errors in queues Bob Pearson
2021-05-27 19:47 ` [PATCH for-next v3 1/3] RDMA/rxe: Add a type flag to rxe_queue structs Bob Pearson
2021-05-28  8:31   ` Zhu Yanjun
2021-05-28 14:48     ` Pearson, Robert B
2021-05-27 19:47 ` [PATCH for-next v3 2/3] RDMA/rxe: Protect user space index loads/stores Bob Pearson
2021-05-27 19:47 ` [PATCH for-next v3 3/3] RDMA/rxe: Protext kernel index from user space Bob Pearson
2021-05-28 20:29 ` [PATCH for-next v3 0/3] Fix memory ordering errors in queues Jason Gunthorpe
2021-05-31  7:25   ` Zhu Yanjun
2021-06-03 18:56 ` Jason Gunthorpe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox