Project

General

Profile

Actions

Bug #80464

closed
KC KC

rgw/amqp: out of bounds read when an ack covers every pending callback

Bug #80464: rgw/amqp: out of bounds read when an ack covers every pending callback

Added by Kefu Chai 3 months ago. Updated 18 days ago.

Status:
Resolved
Priority:
Normal
Assignee:
Target version:
-
Due date:
% Done:

0%

Source:
Backport:
umbrella,tentacle,squid
Regression:
No
Severity:
3 - minor
Reviewed:
Affected Versions:
ceph-qa-suite:
Pull request ID:
Tags (freeform):
Fixed In:
v21.3.0-3185-g5d671cefc0
Released In:
Upkeep Timestamp:
2026-11-15T01:07:36+00:00

Description

A broker can confirm several messages at once with the "multiple" flag on basic.ack or basic.nack, which acks every delivery tag up to and including the one in the frame. The loop that fires those callbacks in Manager::run(), src/rgw/rgw_amqp.cc, dereferences the iterator before checking it:

auto it = conn->callbacks.begin();
while (it->tag <= tag && it != conn->callbacks.end()) {
  it->cb(result);
  it = conn->callbacks.erase(it);
}

erase() returns end() once the last callback is gone, so the next round reads past the end. Getting there takes an ack that covers every callback pending on the connection, since a std::find for the exact tag guards the loop.

It has not crashed, and the loop still stops where it should. CallbackList is a std::vector and erase() does not shrink the buffer, so end() points at a slot that is still part of the allocation and holds the moved-from copy of the element just shifted out. tag is a uint64_t that move assignment copies, so it->tag reads the old last tag, the first condition is true, and the it != end() check ends the loop.


Related issues 3 (0 open — 3 closed)

Copied to rgw - Backport #80471: squid: rgw/amqp: out of bounds read when an ack covers every pending callbackResolvedKefu Chai

Actions
Copied to rgw - Backport #80472: tentacle: rgw/amqp: out of bounds read when an ack covers every pending callbackResolvedKefu Chai

Actions
Copied to rgw - Backport #80473: umbrella: rgw/amqp: out of bounds read when an ack covers every pending callbackResolvedKefu Chai

Actions

KC Updated by Kefu Chai 3 months ago Actions #1

  • Backport changed from umbrella,tentacle to umbrella,tentacle,squid

UB Updated by Upkeep Bot 3 months ago Actions #2

  • Status changed from Fix Under Review to Pending Backport
  • Merge Commit set to 5d671cefc028606aabae3027542436b7eaf55b39
  • Fixed In set to v21.3.0-3185-g5d671cefc0
  • Upkeep Timestamp set to 2026-09-11T09:44:46+00:00

UB Updated by Upkeep Bot 3 months ago Actions #3

  • Copied to Backport #80471: squid: rgw/amqp: out of bounds read when an ack covers every pending callback added

UB Updated by Upkeep Bot 3 months ago Actions #4

  • Copied to Backport #80472: tentacle: rgw/amqp: out of bounds read when an ack covers every pending callback added

UB Updated by Upkeep Bot 3 months ago Actions #5

  • Copied to Backport #80473: umbrella: rgw/amqp: out of bounds read when an ack covers every pending callback added

UB Updated by Upkeep Bot 3 months ago Actions #6

  • Status changed from Pending Backport to Backporting
  • Upkeep Timestamp changed from 2026-09-11T09:44:46+00:00 to 2026-09-11T12:26:00+00:00

UB Updated by Upkeep Bot 18 days ago Actions #7

  • Status changed from Backporting to Resolved
  • Upkeep Timestamp changed from 2026-09-11T12:26:00+00:00 to 2026-11-15T01:07:36+00:00
Actions

Also available in: PDF Atom