Skip to content

PyList_SetItem missing atomic store #129643

Closed

Description

@kumaraditya303

Bug report

PyList_SetItem currently uses Py_XSETREF to set the item and decref the old one, however the store is not atomic as such it can race with a concurrent read. The fix is to use a atomic store with release order to correctly set the new item and then decref the old object.

cc @colesbury @Yhg1s

Linked PRs

Activity

  1. colesbury commented on Feb 4, 2025

    @colesbury
    Contributor

    There is a similar issue in the function ins1:

    items = self->ob_item;
    for (i = n; --i >= where; )
    items[i+1] = items[i];
    items[where] = Py_NewRef(v);

  2. added 3 commits that reference this issue on Feb 5, 2025
  3. added 4 commits that reference this issue on Feb 5, 2025
  4. added 2 commits that reference this issue on Feb 7, 2025
  5. added 2 commits that reference this issue on Feb 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions