get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/1.2/patches/2230262/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 2230262,
    "url": "http://patchwork.ozlabs.org/api/1.2/patches/2230262/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/glibc/patch/4024b75e5db1853b62dcd5147151a8f3433d46b8.1777472828.git.ashamil435@gmail.com/",
    "project": {
        "id": 41,
        "url": "http://patchwork.ozlabs.org/api/1.2/projects/41/?format=api",
        "name": "GNU C Library",
        "link_name": "glibc",
        "list_id": "libc-alpha.sourceware.org",
        "list_email": "libc-alpha@sourceware.org",
        "web_url": "",
        "scm_url": "",
        "webscm_url": "",
        "list_archive_url": "",
        "list_archive_url_format": "",
        "commit_url_format": ""
    },
    "msgid": "<4024b75e5db1853b62dcd5147151a8f3433d46b8.1777472828.git.ashamil435@gmail.com>",
    "list_archive_url": null,
    "date": "2026-04-29T14:29:18",
    "name": "[v2] libio: Fix race in _IO_new_file_init_internal initialization order [BZ #33785]",
    "commit_ref": null,
    "pull_url": null,
    "state": "new",
    "archived": false,
    "hash": "c0b9e3b57fc18015a12fa19d7f2c4daaf100dd24",
    "submitter": {
        "id": 93241,
        "url": "http://patchwork.ozlabs.org/api/1.2/people/93241/?format=api",
        "name": "Shamil Abdulaev",
        "email": "ashamil435@gmail.com"
    },
    "delegate": null,
    "mbox": "http://patchwork.ozlabs.org/project/glibc/patch/4024b75e5db1853b62dcd5147151a8f3433d46b8.1777472828.git.ashamil435@gmail.com/mbox/",
    "series": [
        {
            "id": 502080,
            "url": "http://patchwork.ozlabs.org/api/1.2/series/502080/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/glibc/list/?series=502080",
            "date": "2026-04-29T14:29:18",
            "name": "[v2] libio: Fix race in _IO_new_file_init_internal initialization order [BZ #33785]",
            "version": 2,
            "mbox": "http://patchwork.ozlabs.org/series/502080/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/2230262/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/2230262/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<libc-alpha-bounces~incoming=patchwork.ozlabs.org@sourceware.org>",
        "X-Original-To": [
            "incoming@patchwork.ozlabs.org",
            "libc-alpha@sourceware.org"
        ],
        "Delivered-To": [
            "patchwork-incoming@legolas.ozlabs.org",
            "libc-alpha@sourceware.org"
        ],
        "Authentication-Results": [
            "legolas.ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256\n header.s=20251104 header.b=CdoinNEe;\n\tdkim-atps=neutral",
            "legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=sourceware.org\n (client-ip=38.145.34.32; helo=vm01.sourceware.org;\n envelope-from=libc-alpha-bounces~incoming=patchwork.ozlabs.org@sourceware.org;\n receiver=patchwork.ozlabs.org)",
            "sourceware.org;\n\tdkim=pass (2048-bit key,\n unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256\n header.s=20251104 header.b=CdoinNEe",
            "sourceware.org;\n dmarc=pass (p=none dis=none) header.from=gmail.com",
            "sourceware.org; spf=pass smtp.mailfrom=gmail.com",
            "server2.sourceware.org;\n arc=none smtp.remote-ip=2a00:1450:4864:20::233"
        ],
        "Received": [
            "from vm01.sourceware.org (vm01.sourceware.org [38.145.34.32])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519 server-signature ECDSA (secp384r1) server-digest SHA384)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4g5KSz0BQJz1yHZ\n\tfor <incoming@patchwork.ozlabs.org>; Thu, 30 Apr 2026 00:29:50 +1000 (AEST)",
            "from vm01.sourceware.org (localhost [127.0.0.1])\n\tby sourceware.org (Postfix) with ESMTP id 309404B99F49\n\tfor <incoming@patchwork.ozlabs.org>; Wed, 29 Apr 2026 14:29:48 +0000 (GMT)",
            "from mail-lj1-x233.google.com (mail-lj1-x233.google.com\n [IPv6:2a00:1450:4864:20::233])\n by sourceware.org (Postfix) with ESMTPS id 476484BB1C09\n for <libc-alpha@sourceware.org>; Wed, 29 Apr 2026 14:29:27 +0000 (GMT)",
            "by mail-lj1-x233.google.com with SMTP id\n 38308e7fff4ca-386b553c70eso103935381fa.0\n for <libc-alpha@sourceware.org>; Wed, 29 Apr 2026 07:29:27 -0700 (PDT)",
            "from oops-lab ([62.152.34.188]) by smtp.gmail.com with ESMTPSA id\n 38308e7fff4ca-3924fac6675sm5820881fa.38.2026.04.29.07.29.24\n for <libc-alpha@sourceware.org>\n (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n Wed, 29 Apr 2026 07:29:24 -0700 (PDT)"
        ],
        "DKIM-Filter": [
            "OpenDKIM Filter v2.11.0 sourceware.org 309404B99F49",
            "OpenDKIM Filter v2.11.0 sourceware.org 476484BB1C09"
        ],
        "DMARC-Filter": "OpenDMARC Filter v1.4.2 sourceware.org 476484BB1C09",
        "ARC-Filter": "OpenARC Filter v1.0.0 sourceware.org 476484BB1C09",
        "ARC-Seal": "i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1777472967; cv=none;\n b=jI0gX8ycH+Y0v467mlaoOXmI+to+h/3VMBQ8z295Sl6uYLMD0wP/h0aVr2VTILOTngoDkMpWauyx9DW0XWA99QL5O+kkDxvW5RTbkAHZkfVDIP8kd2ZGcsvLydxmvfU4ThhtbEpr5+q5BHuZwONmEXTgZE5rqpNgyUwB+U8YAZs=",
        "ARC-Message-Signature": "i=1; a=rsa-sha256; d=sourceware.org; s=key;\n t=1777472967; c=relaxed/simple;\n bh=eKD2or/hqSJ71mBCcGBh6U80JHaWDkurNUmmrXFujrc=;\n h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version;\n b=Ht4rvQVbuDmKS7b4fabMGEpeMJYJ41Kn5S66n/EQVVymeCrir0ih1uhtj/PNN2aVVQxz3af+HpCp+QxF97MJ/crW7uGE2iW/p8cveBY9LRRTZS+ctMq6QfMhwmKjpKfWJ0pNkrflizPhZDf4tLsENoRLaOb//A4v4RfJK+fYVqY=",
        "ARC-Authentication-Results": "i=1; server2.sourceware.org",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=gmail.com; s=20251104; t=1777472965; x=1778077765; darn=sourceware.org;\n h=content-transfer-encoding:mime-version:references:in-reply-to\n :message-id:date:subject:to:from:from:to:cc:subject:date:message-id\n :reply-to; bh=WyfCfznExAQmIpwsK5TL0KsccLPYb1X7aeo/94rgxyE=;\n b=CdoinNEeUKj8WB6RhZpXkb0zCCqDqOqHLI1sHzpbaeNf/oyUyIlEVFjWqMW060MPuF\n FVJrDeo+ODu8L890V+Q8ebfToitc+nf9rbRcgTtgY/iZbpHq8kM0o5GYPjkniQ083jdQ\n 3+lpott6xgiohZXE0i76gycxzv5pi8ydrgnFhk02exbqXrQx8q7pgbTyUlGDvPp0qwGE\n AxR7nFaEwxc3Geg/siqin/ccxo/z7FUeQHLdicZ7Slf//Qxtb0Hmx+pX00Kg33jOGyGX\n K0OJd2Xi4Q8UattVfWTune+GXFroQm2u4RJGn6KXJUKLXo2lZ2Ty8T3yqMGZ2XT+/pBS\n 8x4A==",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20251104; t=1777472965; x=1778077765;\n h=content-transfer-encoding:mime-version:references:in-reply-to\n :message-id:date:subject:to:from:x-gm-gg:x-gm-message-state:from:to\n :cc:subject:date:message-id:reply-to;\n bh=WyfCfznExAQmIpwsK5TL0KsccLPYb1X7aeo/94rgxyE=;\n b=d+X7RVhp+aOAxFMlcsYPwTknQqRMWyzv+X+nYyU8Fw/KbUVVfd0Pt9RErqT8JAheNG\n PmKJ0cGayB4ZZB9adDNEPkrwFQXGSsjUeb46TroUuLgBHGHCMBfgopk7V1vct9HQw7cT\n a6EOPp4L87o65gggos6FPn9b4Fddh+gt2AIMiR0qD8k9YOurcrDQL1wjDEIirCvglaf3\n gpoNJdvb0PrTeeQqucR9gQFbEF+iwon53LuYVr8K+lPHe+smbHWiZhUdIRir1LpgrjXI\n B9Fm4CHHnnHDAXzA/3RqoC2KgvS9uPWMf/Ql2sqDYhvvkMLSNw4YSwxxHx3B3HUEOgUX\n 8Xtg==",
        "X-Gm-Message-State": "AOJu0YxfIvke48yXt5C9jGcOOYt09zdujXqKycdAGIaCpAE0Ccj9OBWI\n pBrxg55+uX0eIJGK/yc45iIoCS167WVqiX66CRd80NsfK6pVJPYwD0C1YbmQS1XB",
        "X-Gm-Gg": "AeBDievgL3r9wYzhTbbz89ygPH5Vyilwfge5XeZcPlf2Wkyb7HEYSTl3uYItDJSMS/7\n zT82YMPCM05nwKpXqzmk1Yl1Ch2xYk8A7nmuH6pvGo37hs3UM/wQgbMprRbml/+zq2WO4i4G4X4\n dqZISgchdOCBHWjmttEJ7VgfKGXnNDXxX6q50fyM0jXuA3rSmzYSVh7EIyom3bNTzM4zztyATV3\n +UfzX27J0KpNsNXJT0xj9qrQxQ2RyKhBJgZ8Pck6drL+rjY6MC3aqInpJ7lnYXSiYu2Z4+n5Xrh\n hEtkzFpXwz5sD3r55FPZVl/bcjogpJKtrxByvInlGfeRDKKlaJa78VV2iGtHJfOWZt9PMbTkG2U\n vGXbxHjYs3VdzHHzzQ8SKKgoHSjPmlL3FFTvxX+ot2T/Z+86decz9bUg1YZR6vwdwBemTHxx4AV\n C+no/0QWMo6cInAlVgzwbxNQStT9DcGE/5lcIuYdgL+rBYhiZtmPvuHdbPwAl3VoHGlMac2F+9m\n efFuZMCcQw445NhNFlQImeS",
        "X-Received": "by 2002:a05:651c:41d6:b0:38b:f0f0:e3f7 with SMTP id\n 38308e7fff4ca-39240cac934mr28749361fa.7.1777472965192;\n Wed, 29 Apr 2026 07:29:25 -0700 (PDT)",
        "From": "Shamil Abdulaev <ashamil435@gmail.com>",
        "To": "libc-alpha@sourceware.org",
        "Subject": "[PATCH v2] libio: Fix race in _IO_new_file_init_internal\n initialization order [BZ #33785]",
        "Date": "Wed, 29 Apr 2026 17:29:18 +0300",
        "Message-ID": "\n <4024b75e5db1853b62dcd5147151a8f3433d46b8.1777472828.git.ashamil435@gmail.com>",
        "X-Mailer": "git-send-email 2.54.0",
        "In-Reply-To": "\n <94933ea56cf84f067c5e7bb7a67eb39f9d9384c0.1777424201.git.ashamil435@gmail.com>",
        "References": "\n <94933ea56cf84f067c5e7bb7a67eb39f9d9384c0.1777424201.git.ashamil435@gmail.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "X-BeenThere": "libc-alpha@sourceware.org",
        "X-Mailman-Version": "2.1.30",
        "Precedence": "list",
        "List-Id": "Libc-alpha mailing list <libc-alpha.sourceware.org>",
        "List-Unsubscribe": "<https://sourceware.org/mailman/options/libc-alpha>,\n <mailto:libc-alpha-request@sourceware.org?subject=unsubscribe>",
        "List-Archive": "<https://sourceware.org/pipermail/libc-alpha/>",
        "List-Post": "<mailto:libc-alpha@sourceware.org>",
        "List-Help": "<mailto:libc-alpha-request@sourceware.org?subject=help>",
        "List-Subscribe": "<https://sourceware.org/mailman/listinfo/libc-alpha>,\n <mailto:libc-alpha-request@sourceware.org?subject=subscribe>",
        "Errors-To": "libc-alpha-bounces~incoming=patchwork.ozlabs.org@sourceware.org"
    },
    "content": "_IO_new_file_init_internal linked the new stream into _IO_list_all\nbefore setting fp->_fileno to -1.  A concurrent thread that walks\n_IO_list_all (for example via fflush (NULL)) could observe the stream\nwith an uninitialized _fileno before initialization completed.\n\nSet _fileno = -1 before _IO_link_in so the stream is fully\ninitialized when it becomes visible in the global list.\n\nThis is the residual concurrency defect noted at the end of commit\nb657f72fa3 (\"libio: Fix deadlock between freopen, fflush (NULL) and\nfclose (bug 24963)\").\n\nAdd libio/tst-file-init-race exercising concurrent fopen/fclose and\nfflush (NULL) to detect regressions.\n\nSigned-off-by: Shamil Abdulaev <ashamil435@gmail.com>\n---\nChanges since v1:\n - Apply the same _fileno/_IO_link_in reordering to libio/oldfileops.c\n   (suggested by Florian Weimer).\n - tst-file-init-race: treat fopen/fclose failures as test failures via\n   FAIL_EXIT1 instead of silently ignoring them (suggested by Florian\n   Weimer).\n\n libio/Makefile             |  3 ++\n libio/fileops.c            |  2 +-\n libio/oldfileops.c         |  2 +-\n libio/tst-file-init-race.c | 69 ++++++++++++++++++++++++++++++++++++++\n 4 files changed, 74 insertions(+), 2 deletions(-)\n create mode 100644 libio/tst-file-init-race.c",
    "diff": "diff --git a/libio/Makefile b/libio/Makefile\nindex 93656466df..7e448295e3 100644\n--- a/libio/Makefile\n+++ b/libio/Makefile\n@@ -107,6 +107,7 @@ tests = \\\n   tst-fgetc-after-eof \\\n   tst-fgetwc \\\n   tst-fgetws \\\n+  tst-file-init-race \\\n   tst-fopenloc2 \\\n   tst-fputws \\\n   tst-freopen \\\n@@ -160,6 +161,8 @@ tests-static += \\\n \n $(objpfx)tst-popen-fork: $(shared-thread-library)\n \n+$(objpfx)tst-file-init-race: $(shared-thread-library)\n+\n tests-internal = tst-vtables tst-vtables-interposed\n \n ifeq (yes,$(build-shared))\ndiff --git a/libio/fileops.c b/libio/fileops.c\nindex 8067c0a9cf..9348d7c3a1 100644\n--- a/libio/fileops.c\n+++ b/libio/fileops.c\n@@ -111,8 +111,8 @@ _IO_new_file_init_internal (struct _IO_FILE_plus *fp)\n   fp->file._offset = _IO_pos_BAD;\n   fp->file._flags |= CLOSED_FILEBUF_FLAGS;\n \n-  _IO_link_in (fp);\n   fp->file._fileno = -1;\n+  _IO_link_in (fp);\n }\n \n /* External version of _IO_new_file_init_internal which switches off\ndiff --git a/libio/oldfileops.c b/libio/oldfileops.c\nindex 41b15491cb..0b92afbdb1 100644\n--- a/libio/oldfileops.c\n+++ b/libio/oldfileops.c\n@@ -108,8 +108,8 @@ _IO_old_file_init_internal (struct _IO_FILE_plus *fp)\n      _IO_vtable_offset is used to detect the old binaries.  */\n   fp->file._vtable_offset = ((int) sizeof (struct _IO_FILE)\n \t\t\t     - (int) sizeof (struct _IO_FILE_complete));\n-  _IO_link_in (fp);\n   fp->file._fileno = -1;\n+  _IO_link_in (fp);\n \n   if (&_IO_stdin_used != NULL || !_IO_legacy_file ((FILE *) fp))\n     /* The object is dynamically allocated and large enough.  Initialize\ndiff --git a/libio/tst-file-init-race.c b/libio/tst-file-init-race.c\nnew file mode 100644\nindex 0000000000..7adaba272c\n--- /dev/null\n+++ b/libio/tst-file-init-race.c\n@@ -0,0 +1,69 @@\n+/* Test for race during FILE initialization in _IO_new_file_init_internal.\n+   Copyright (C) 2026 Free Software Foundation, Inc.\n+   This file is part of the GNU C Library.\n+\n+   The GNU C Library is free software; you can redistribute it and/or\n+   modify it under the terms of the GNU Lesser General Public\n+   License as published by the Free Software Foundation; either\n+   version 2.1 of the License, or (at your option) any later version.\n+\n+   The GNU C Library is distributed in the hope that it will be useful,\n+   but WITHOUT ANY WARRANTY; without even the implied warranty of\n+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n+   Lesser General Public License for more details.\n+\n+   You should have received a copy of the GNU Lesser General Public\n+   License along with the GNU C Library; if not, see\n+   <https://www.gnu.org/licenses/>.  */\n+\n+#include <stdio.h>\n+#include <stdatomic.h>\n+#include <pthread.h>\n+#include <time.h>\n+\n+#include <support/check.h>\n+#include <support/xthread.h>\n+\n+static atomic_bool stop = ATOMIC_VAR_INIT (0);\n+\n+static void *\n+opener_thread (__attribute__ ((unused)) void *arg)\n+{\n+  while (!atomic_load_explicit (&stop, memory_order_acquire))\n+    {\n+      FILE *fp = fopen (\"/dev/null\", \"r\");\n+      if (fp == NULL)\n+        FAIL_EXIT1 (\"fopen: %m\");\n+      if (fclose (fp) != 0)\n+        FAIL_EXIT1 (\"fclose: %m\");\n+    }\n+  return NULL;\n+}\n+\n+static void *\n+flusher_thread (__attribute__ ((unused)) void *arg)\n+{\n+  while (!atomic_load_explicit (&stop, memory_order_acquire))\n+    fflush (NULL);\n+  return NULL;\n+}\n+\n+static int\n+do_test (void)\n+{\n+  pthread_t t1 = xpthread_create (NULL, opener_thread, NULL);\n+  pthread_t t2 = xpthread_create (NULL, flusher_thread, NULL);\n+\n+  struct timespec ts = { .tv_sec = 3, .tv_nsec = 0 };\n+  nanosleep (&ts, NULL);\n+\n+  atomic_store_explicit (&stop, 1, memory_order_release);\n+\n+  xpthread_join (t1);\n+  xpthread_join (t2);\n+\n+  return 0;\n+}\n+\n+#define TIMEOUT 30\n+#include <support/test-driver.c>\n",
    "prefixes": [
        "v2"
    ]
}