Skip to content

SFAM-2777 fixes - #60

Open
mxsrc wants to merge 3 commits into
nvmf-blocking-from-basefrom
fix-sfam-2777
Open

SFAM-2777 fixes#60
mxsrc wants to merge 3 commits into
nvmf-blocking-from-basefrom
fix-sfam-2777

Conversation

@mxsrc

@mxsrc mxsrc commented Aug 6, 2026

Copy link
Copy Markdown

This adds fixes regarding https://simplyblock.atlassian.net/browse/SFAM-2777. In one failure case, a UAF is avoided by deferring freeing transfer structures until all inflight IO has been resolved. The main fix is the introduction of selective retries of IO requests on S3 devices. The root cause of the bug is the AWS SDK swallowing individual requests very rarely, this allows to gracefully handle the problem

@mxsrc
mxsrc requested a review from sadeghsav August 6, 2026 12:19
mxsrc added 2 commits August 7, 2026 12:50
spdk_delete_rmt_lvol_pg/destroy_xfer_task_tmo freed rmt_lvol, reqs, pdus,
and rings on xfer-task timeout with no check of outstanding_io, unlike the
device-remove path (spdk_wait_for_pg_io_cleanup), which correctly defers
free behind an outstanding_io==0 poller. A late S3 GET or local blob-write
completion then wrote through freed memory in set_req_status_and_queued
(rmt->outstanding_io--, req->status, free_ring enqueue) - a heap UAF that
surfaced as a stalled S3 restore ("outstanding io N, state 13") and, when
completions did arrive late, as glibc heap corruption crashing later on an
unrelated allocation.

- add XFER_REQ_STATUS_IN_FLIGHT, set when helper_xfer_poller claims a req
- spdk_delete_rmt_lvol_pg: if rmt_lvol->outstanding_io > 0, best-effort
  abort in-flight reqs via spdk_bdev_abort (matches by existing req cb_arg,
  no new bookkeeping) and defer put_io_channel/free behind a new
  outstanding_io-gated poller (spdk_wait_for_xfer_pg_io_cleanup_poller),
  mirroring the device-remove path instead of freeing synchronously
- xfer->pg[lpg->id] is now only cleared once the rmt_lvol is actually
  drained and freed, so destroy_xfer_task_tmo's gate is meaningful
- close a race where device-remove teardown wins for the same rmt_lvol:
  its poller now also clears xfer_task->pg[lpg->id], otherwise that flag
  would hang forever instead of draining
- set_req_status_and_queued: return early on the (compiled-out-under-
  NDEBUG) assert(false) paths instead of falling through and scribbling
  further on already-inconsistent state

No behavior change to destroy_xfer_task_tmo itself or to timeouts/retries.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant