Skip to content

memcached: apply patch: fix crash in binary protocol - #18459

Open
Chris Gunn (cwize1) wants to merge 2 commits into
3.0-devfrom
user/chrisgun/memcachedPatch
Open

memcached: apply patch: fix crash in binary protocol#18459
Chris Gunn (cwize1) wants to merge 2 commits into
3.0-devfrom
user/chrisgun/memcachedPatch

Conversation

@cwize1

Copy link
Copy Markdown

No description provided.

Comment thread SPECS/memcached/memcached.spec Outdated
@Kanishk-Bansal

Copy link
Copy Markdown

/azurepipelines run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).
1 pipeline(s) were filtered out due to trigger conditions.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Patch Analysis (Matches Upstream)

  • Buddy Build 
  • patch applied during the build (check rpm.log)
  • patch include an upstream reference
  • PR has security tag

@Kanishk-Bansal Kanishk Bansal (Kanishk-Bansal) added the ready-for-stable-review PR has passed initial review and is now ready for a second-level stable maintainer review label Aug 17, 2026
LOGGER_LOG(c->thread->l, LOG_MUTATIONS, LOGGER_ITEM_STORE,
NULL, status, 0, key, nkey, req->message.body.expiration,
- ITEM_clsid(it), c->sfd);
+ 0, c->sfd);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue (blocking): supply the missing nbytes argument before making this logger path reachable

LOGGER_ITEM_STORE consumes eight variadic fields after entry:

status, comm, key, nkey, nbytes, ttl, clsid, sfd

This call supplies only seven:

status, 0, key, nkey, expiration, 0, c->sfd

Before this patch, evaluating ITEM_clsid(it) crashes because it is NULL. After replacing it with 0, the logger runs and reads one argument past the supplied list. The fields are shifted (expiration becomes nbytes, 0 becomes ttl, and c->sfd becomes clsid), while sfd is read from undefined variadic state. That can corrupt the mutation record and potentially expose stale process data to a watch mutations client.

Please include all eight fields. Based on the successful-store call contract, the failure path should resemble:

Suggested change
+ 0, c->sfd);
NULL, status, 0, key, nkey, vlen + 2,
realtime(req->message.body.expiration), 0, c->sfd);

The same seven-argument mismatch is still present on upstream master, so this should also be reported upstream.

Upstream evidence:

@christopherco Christopher Co (christopherco) Aug 17, 2026

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewing this closer, given that this issue is present in upstream and is a cosmetic logging defect (key and nkey are still correct. nbytes is a log line element, and not part of any memcpy operations), I will change this to non-blocking. It is more important to get this initial crash fixed, and the logging defect is cosmetic.

We should also report this logging issue upstream, and if fixed upstream, backport that fix to our version.

@kgodara912

Copy link
Copy Markdown

Could you please check if this PR: #18504 supersedes this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

3.0-dev PRs Destined for AzureLinux 3.0 Packaging ready-for-stable-review PR has passed initial review and is now ready for a second-level stable maintainer review security

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants