Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/2196516/?format=api
{ "id": 2196516, "url": "http://patchwork.ozlabs.org/api/patches/2196516/?format=api", "web_url": "http://patchwork.ozlabs.org/project/glibc/patch/20260214134013.1421875-1-samuel.thibault@ens-lyon.org/", "project": { "id": 41, "url": "http://patchwork.ozlabs.org/api/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": "<20260214134013.1421875-1-samuel.thibault@ens-lyon.org>", "list_archive_url": null, "date": "2026-02-14T13:40:12", "name": "[hurd,commited] hurd: calling alarm() whilst handling SIGALRM can deadlock.", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "85feeba8c089f9fe61ac85c534e30027d5e67693", "submitter": { "id": 418, "url": "http://patchwork.ozlabs.org/api/people/418/?format=api", "name": "Samuel Thibault", "email": "samuel.thibault@ens-lyon.org" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/glibc/patch/20260214134013.1421875-1-samuel.thibault@ens-lyon.org/mbox/", "series": [ { "id": 492173, "url": "http://patchwork.ozlabs.org/api/series/492173/?format=api", "web_url": "http://patchwork.ozlabs.org/project/glibc/list/?series=492173", "date": "2026-02-14T13:40:12", "name": "[hurd,commited] hurd: calling alarm() whilst handling SIGALRM can deadlock.", "version": 1, "mbox": "http://patchwork.ozlabs.org/series/492173/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/2196516/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/2196516/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 spf=pass (sender SPF authorized) smtp.mailfrom=sourceware.org\n (client-ip=2620:52:6:3111::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 dmarc=none (p=none dis=none) header.from=ens-lyon.org", "sourceware.org;\n spf=pass smtp.mailfrom=bounce.ens-lyon.org", "server2.sourceware.org;\n arc=none smtp.remote-ip=140.77.166.138" ], "Received": [ "from vm01.sourceware.org (vm01.sourceware.org\n [IPv6:2620:52:6:3111::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 4fCqtP4B6Yz1xpl\n\tfor <incoming@patchwork.ozlabs.org>; Sun, 15 Feb 2026 00:40:41 +1100 (AEDT)", "from vm01.sourceware.org (localhost [127.0.0.1])\n\tby sourceware.org (Postfix) with ESMTP id 364EC4BAD148\n\tfor <incoming@patchwork.ozlabs.org>; Sat, 14 Feb 2026 13:40:38 +0000 (GMT)", "from sonata.ens-lyon.org (domu-toccata.ens-lyon.fr [140.77.166.138])\n by sourceware.org (Postfix) with ESMTPS id 8BC274BAD144\n for <libc-alpha@sourceware.org>; Sat, 14 Feb 2026 13:40:18 +0000 (GMT)", "from localhost (localhost [127.0.0.1])\n by sonata.ens-lyon.org (Postfix) with ESMTP id 43688A03F3;\n Sat, 14 Feb 2026 14:40:17 +0100 (CET)", "from sonata.ens-lyon.org ([127.0.0.1])\n by localhost (sonata.ens-lyon.org [127.0.0.1]) (amavisd-new, port 10024)\n with ESMTP id uygHnz8T6FRk; Sat, 14 Feb 2026 14:40:17 +0100 (CET)", "from end (unknown [212.133.41.37])\n (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest\n SHA256) (No client certificate requested)\n by sonata.ens-lyon.org (Postfix) with ESMTPSA id 916A8A023D;\n Sat, 14 Feb 2026 14:40:16 +0100 (CET)", "from samy by end with local (Exim 4.99.1)\n (envelope-from <samuel.thibault@ens-lyon.org>)\n id 1vrFsb-00000005xu3-3TDZ; Sat, 14 Feb 2026 14:40:13 +0100" ], "DKIM-Filter": [ "OpenDKIM Filter v2.11.0 sourceware.org 364EC4BAD148", "OpenDKIM Filter v2.11.0 sourceware.org 8BC274BAD144" ], "DMARC-Filter": "OpenDMARC Filter v1.4.2 sourceware.org 8BC274BAD144", "ARC-Filter": "OpenARC Filter v1.0.0 sourceware.org 8BC274BAD144", "ARC-Seal": "i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1771076418; cv=none;\n b=TDmzoMHZXczwfrDrdb4m2WTFShnL+41a3lf+ozaU/a0JpA2xBmr6YMIL3HExalTOv0gANbKWwJrfst9unbSHV76IQM0JSV09Fu64Oq57rvvlpcgAIX4PQ3IN5Sj/dcCEFlskJBNfyV4llLXsD4oIlLDW3hcQkx5mupkDwRdaoOk=", "ARC-Message-Signature": "i=1; a=rsa-sha256; d=sourceware.org; s=key;\n t=1771076418; c=relaxed/simple;\n bh=7prA98AfvR01rnDiWX52+JO9dmJvc/K/j3bT+V9BVAc=;\n h=From:To:Subject:Date:Message-ID:MIME-Version;\n b=PTJ1n29pciIU3kdiRy/SBh2A/stcSqlmL1LXlyFq/pgjxqM8mqMeoJ0k0AorVvSI/Joph1EEtjXLqOagXj5iea+f1flBE+TEm5+TFHx0HAdT0BLtVWy8TJ6v4qdqzLPNCzGvGwjI8NHGPptGxryL3xxG9821DyndGei1P/ilFmo=", "ARC-Authentication-Results": "i=1; server2.sourceware.org", "From": "Samuel Thibault <samuel.thibault@ens-lyon.org>", "To": "libc-alpha@sourceware.org", "Cc": "Mike Kelly <mike@weatherwax.co.uk>, commit-hurd@gnu.org,\n Samuel Thibault <samuel.thibault@ens-lyon.org>", "Subject": "[hurd,\n commited] hurd: calling alarm() whilst handling SIGALRM can deadlock.", "Date": "Sat, 14 Feb 2026 14:40:12 +0100", "Message-ID": "<20260214134013.1421875-1-samuel.thibault@ens-lyon.org>", "X-Mailer": "git-send-email 2.51.0", "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": "From: Mike Kelly <mike@weatherwax.co.uk>\n\nalarm() and restart_itimer() can attempt to acquire _hurd_siglock and\n_hurd_itimer_lock in opposite sequence resulting in occasional\ndeadlock. Rearranged to always acquire the locks in the same sequence\nwith a new pre-condition that setitimer_locked() must be called with\nboth locks already acquired.\nMessage-ID: <20260214091715.157471-2-mike@weatherwax.co.uk>\n\nReviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>\n---\n sysdeps/mach/hurd/setitimer.c | 42 +++++++++++++++++------------------\n 1 file changed, 20 insertions(+), 22 deletions(-)", "diff": "diff --git a/sysdeps/mach/hurd/setitimer.c b/sysdeps/mach/hurd/setitimer.c\nindex 5a57280e2c..265576e00e 100644\n--- a/sysdeps/mach/hurd/setitimer.c\n+++ b/sysdeps/mach/hurd/setitimer.c\n@@ -131,8 +131,7 @@ timer_thread (void)\n \n /* Forward declaration. */\n static int setitimer_locked (const struct itimerval *new,\n-\t\t\t struct itimerval *old, void *crit,\n-\t\t\t int hurd_siglocked);\n+\t\t\t struct itimerval *old);\n \n static sighandler_t\n restart_itimer (struct hurd_signal_preemptor *preemptor,\n@@ -144,21 +143,25 @@ restart_itimer (struct hurd_signal_preemptor *preemptor,\n struct itimerval it;\n \n /* Either reload or disable the itimer. */\n+ /* _hurd_siglock is already locked by the caller. */\n __spin_lock (&_hurd_itimer_lock);\n it.it_value = it.it_interval = _hurd_itimerval.it_interval;\n- setitimer_locked (&it, NULL, NULL, 1);\n+ setitimer_locked (&it, NULL);\n+ __spin_unlock (&_hurd_itimer_lock);\n \n /* Continue with normal delivery (or hold, etc.) of SIGALRM. */\n return SIG_ERR;\n }\n \n \n-/* Called before any normal SIGALRM signal is delivered.\n- Reload the itimer, or disable the itimer. */\n+/* Called before any normal SIGALRM signal is delivered. Reload the\n+ itimer, or disable the itimer. _hurd_siglock and _hurd_itimer_lock\n+ must be locked before entry noting that it is important to acquire\n+ the _hurd_siglock before the _hurd_itimer_lock. Both of these\n+ remain locked on exit. */\n \n static int\n-setitimer_locked (const struct itimerval *new, struct itimerval *old,\n-\t\t void *crit, int hurd_siglocked)\n+setitimer_locked (const struct itimerval *new, struct itimerval *old)\n {\n struct itimerval newval;\n struct timeval now, remaining, elapsed;\n@@ -180,8 +183,6 @@ setitimer_locked (const struct itimerval *new, struct itimerval *old,\n \t This is what BSD does, even though it's not documented. */\n if (old)\n \t*old = _hurd_itimerval;\n- spin_unlock (&_hurd_itimer_lock);\n- _hurd_critical_section_unlock (crit);\n return 0;\n }\n \n@@ -199,16 +200,12 @@ setitimer_locked (const struct itimerval *new, struct itimerval *old,\n \t __sigmask (SIGALRM), SI_TIMER, SI_TIMER,\n \t &restart_itimer,\n \t};\n- if (!hurd_siglocked)\n-\t__mutex_lock (&_hurd_siglock);\n if (! preemptor.next && _hurdsig_preemptors != &preemptor)\n \t{\n \t preemptor.next = _hurdsig_preemptors;\n \t _hurdsig_preemptors = &preemptor;\n \t _hurdsig_preempted_set |= preemptor.signals;\n \t}\n- if (!hurd_siglocked)\n-\t__mutex_unlock (&_hurd_siglock);\n \n if (_hurd_itimer_port == MACH_PORT_NULL)\n \t{\n@@ -316,9 +313,6 @@ setitimer_locked (const struct itimerval *new, struct itimerval *old,\n _hurd_itimer_thread_suspended = 0;\n }\n \n- __spin_unlock (&_hurd_itimer_lock);\n- _hurd_critical_section_unlock (crit);\n-\n if (old != NULL)\n {\n old->it_value = remaining;\n@@ -327,8 +321,6 @@ setitimer_locked (const struct itimerval *new, struct itimerval *old,\n return 0;\n \n out:\n- __spin_unlock (&_hurd_itimer_lock);\n- _hurd_critical_section_unlock (crit);\n return __hurd_fail (err);\n }\n \n@@ -339,7 +331,6 @@ int\n __setitimer (enum __itimer_which which, const struct itimerval *new,\n \t struct itimerval *old)\n {\n- void *crit;\n int ret;\n \n switch (which)\n@@ -356,9 +347,13 @@ __setitimer (enum __itimer_which which, const struct itimerval *new,\n }\n \n retry:\n- crit = _hurd_critical_section_lock ();\n+ HURD_CRITICAL_BEGIN;\n+ __mutex_lock (&_hurd_siglock);\n __spin_lock (&_hurd_itimer_lock);\n- ret = setitimer_locked (new, old, crit, 0);\n+ ret = setitimer_locked (new, old);\n+ __spin_unlock (&_hurd_itimer_lock);\n+ __mutex_unlock (&_hurd_siglock);\n+ HURD_CRITICAL_END;\n if (ret == -1 && errno == EINTR)\n /* Got a signal while inside an RPC of the critical section, retry again */\n goto retry;\n@@ -373,12 +368,15 @@ fork_itimer (void)\n \n struct itimerval it;\n \n+ __mutex_lock (&_hurd_siglock);\n __spin_lock (&_hurd_itimer_lock);\n _hurd_itimer_thread = MACH_PORT_NULL;\n it = _hurd_itimerval;\n it.it_value = it.it_interval;\n \n- setitimer_locked (&it, NULL, NULL, 0);\n+ setitimer_locked (&it, NULL);\n+ __spin_unlock (&_hurd_itimer_lock);\n+ __mutex_unlock (&_hurd_siglock);\n \n (void) &fork_itimer;\t\t/* Avoid gcc optimizing out the function. */\n }\n", "prefixes": [ "hurd", "commited" ] }