Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/2216469/?format=api
{ "id": 2216469, "url": "http://patchwork.ozlabs.org/api/patches/2216469/?format=api", "web_url": "http://patchwork.ozlabs.org/project/glibc/patch/20260326141310.2869281-1-lucas.chollet@free.fr/", "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": "<20260326141310.2869281-1-lucas.chollet@free.fr>", "list_archive_url": null, "date": "2026-03-26T14:13:09", "name": "[v3] posix: spawn: Make handling of invalid fds consistent", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "6d51e72e35826c3c12a415222bf585a1dd4c92fc", "submitter": { "id": 86596, "url": "http://patchwork.ozlabs.org/api/people/86596/?format=api", "name": "Lucas Chollet", "email": "lucas.chollet@free.fr" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/glibc/patch/20260326141310.2869281-1-lucas.chollet@free.fr/mbox/", "series": [ { "id": 497596, "url": "http://patchwork.ozlabs.org/api/series/497596/?format=api", "web_url": "http://patchwork.ozlabs.org/project/glibc/list/?series=497596", "date": "2026-03-26T14:13:09", "name": "[v3] posix: spawn: Make handling of invalid fds consistent", "version": 3, "mbox": "http://patchwork.ozlabs.org/series/497596/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/2216469/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/2216469/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=free.fr header.i=@free.fr header.a=rsa-sha256\n header.s=smtp-20201208 header.b=BQaNYJFT;\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=free.fr header.i=@free.fr header.a=rsa-sha256\n header.s=smtp-20201208 header.b=BQaNYJFT", "sourceware.org;\n dmarc=pass (p=quarantine dis=none) header.from=free.fr", "sourceware.org; spf=pass smtp.mailfrom=free.fr", "server2.sourceware.org;\n arc=none smtp.remote-ip=212.27.42.3" ], "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 4fhQk91qDgz1y1x\n\tfor <incoming@patchwork.ozlabs.org>; Fri, 27 Mar 2026 01:13:53 +1100 (AEDT)", "from vm01.sourceware.org (localhost [127.0.0.1])\n\tby sourceware.org (Postfix) with ESMTP id EC02E4BA23CC\n\tfor <incoming@patchwork.ozlabs.org>; Thu, 26 Mar 2026 14:13:50 +0000 (GMT)", "from smtp3-g21.free.fr (smtp3-g21.free.fr [212.27.42.3])\n by sourceware.org (Postfix) with ESMTPS id 81A794BA2E0B\n for <libc-alpha@sourceware.org>; Thu, 26 Mar 2026 14:13:28 +0000 (GMT)", "from itxub.fritz.box (unknown\n [IPv6:2001:8e0:206a:da00:a314:f10e:da26:aeb7])\n (Authenticated sender: lucas.chollet@free.fr)\n by smtp3-g21.free.fr (Postfix) with ESMTPSA id 48EBE13F86E;\n Thu, 26 Mar 2026 15:13:24 +0100 (CET)" ], "DKIM-Filter": [ "OpenDKIM Filter v2.11.0 sourceware.org EC02E4BA23CC", "OpenDKIM Filter v2.11.0 sourceware.org 81A794BA2E0B" ], "DMARC-Filter": "OpenDMARC Filter v1.4.2 sourceware.org 81A794BA2E0B", "ARC-Filter": "OpenARC Filter v1.0.0 sourceware.org 81A794BA2E0B", "ARC-Seal": "i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1774534408; cv=none;\n b=kS8cowXo7LQUflloJD7gpmX/RLzk0M8c5OfXsNC+5ur90Zq5MJ4oONTYloYRDFNLwJWAUYZkHe2isWMFr7RtGDqjnCitBOYZWEuGfLFkXG5b5ZulfZf7y2TzVLSvUqsaScrsR6x8punCfm05k4SABYdZlTb7jS6mxkNOQbCnwjU=", "ARC-Message-Signature": "i=1; a=rsa-sha256; d=sourceware.org; s=key;\n t=1774534408; c=relaxed/simple;\n bh=Fzjf3nhEGCeTP5GtUHO8DwBicMtYOXEp/Fq8V9QAAXo=;\n h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version;\n b=ufh0C5SkG9rFinjlHXjM/D5ZHyE0YVBWb81FdydzQEGfo/l/cqYymqZH3YsO2jz0DtO0xAYQv7pP60v45Mkum/kW4vU0e1NPpIDlTOGa1Iu0qBueO+YIk0ZLihYwTMBMsoqbi2lIeHgao9jwQN4TxM3s6LLvRq08x4G6OYQGfe8=", "ARC-Authentication-Results": "i=1; server2.sourceware.org", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=free.fr;\n s=smtp-20201208; t=1774534407;\n bh=Fzjf3nhEGCeTP5GtUHO8DwBicMtYOXEp/Fq8V9QAAXo=;\n h=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n b=BQaNYJFTBPTZpR5EW35Ai2UTdC67mR1kqUwZr1QxkaFRC73nGEgNO8Iubpg55fCcj\n Btt7ENR3aaBgTfTCzvdKRhXMw6TRS6lCsaLaxBm4cvl4HhnZWKdy9U4tnGL4RndeHL\n S25TeLLwX44x7Bt3SdRCOvKn3k8K5KZmLObpilfk5tNDk3zEOqb1x48E6Q8CrapX27\n otH1WppTE+zPI/IPShpB1uub/Z3N06YvBwq+QJdrf3JbAIuaozLXIvpMLRr6nl/Smc\n 1J8ULhPn1GB6vVDxj3j20J7ByGix1KrjB4LLc8z9p4ezk4V0Y8DPSa2CAZSHLjt42x\n lfdc+zf7inA1Q==", "From": "Lucas Chollet <lucas.chollet@free.fr>", "To": "libc-alpha@sourceware.org", "Cc": "Lucas Chollet <lucas.chollet@free.fr>", "Subject": "[PATCH v3] posix: spawn: Make handling of invalid fds consistent", "Date": "Thu, 26 Mar 2026 15:13:09 +0100", "Message-ID": "<20260326141310.2869281-1-lucas.chollet@free.fr>", "X-Mailer": "git-send-email 2.51.0", "In-Reply-To": "<20260325140452.1825551-2-lucas.chollet@free.fr>", "References": "<20260325140452.1825551-2-lucas.chollet@free.fr>", "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": "in `posix_spawn_file_actions_*` functions.\n\nAs mandated by POSIX, these functions should return `EBADF` on negative\nfile descriptors but let everything else fail during the call to\n`posix_spawn`.\n\nSigned-off-by: Lucas Chollet <lucas.chollet@free.fr>\n---\nv3: Make all spawn_faction routines consistent with regards to invalid\nfd handling.\n\n posix/Makefile | 1 -\n posix/spawn_faction_addclose.c | 2 +-\n posix/spawn_faction_addclosefrom.c | 2 +-\n posix/spawn_faction_adddup2.c | 2 +-\n posix/spawn_faction_addfchdir.c | 3 +++\n posix/spawn_faction_addopen.c | 2 +-\n posix/spawn_faction_addtcsetpgrp_np.c | 2 +-\n posix/spawn_int.h | 4 ----\n posix/spawn_valid_fd.c | 30 ---------------------------\n posix/tst-posix_spawn-fd.c | 2 +-\n 10 files changed, 9 insertions(+), 41 deletions(-)\n delete mode 100644 posix/spawn_valid_fd.c", "diff": "diff --git a/posix/Makefile b/posix/Makefile\nindex ec28b9e1da..bf5d5a8e23 100644\n--- a/posix/Makefile\n+++ b/posix/Makefile\n@@ -155,7 +155,6 @@ routines := \\\n spawn_faction_addtcsetpgrp_np \\\n spawn_faction_destroy \\\n spawn_faction_init \\\n- spawn_valid_fd \\\n spawnattr_destroy \\\n spawnattr_getdefault \\\n spawnattr_getflags \\\ndiff --git a/posix/spawn_faction_addclose.c b/posix/spawn_faction_addclose.c\nindex 3073c05761..5a0dc6c1cf 100644\n--- a/posix/spawn_faction_addclose.c\n+++ b/posix/spawn_faction_addclose.c\n@@ -29,7 +29,7 @@ __posix_spawn_file_actions_addclose (posix_spawn_file_actions_t *file_actions,\n {\n struct __spawn_action *rec;\n \n- if (!__spawn_valid_fd (fd))\n+ if (fd < 0)\n return EBADF;\n \n /* Allocate more memory if needed. */\ndiff --git a/posix/spawn_faction_addclosefrom.c b/posix/spawn_faction_addclosefrom.c\nindex 5c56d035c6..f55d69b2ea 100644\n--- a/posix/spawn_faction_addclosefrom.c\n+++ b/posix/spawn_faction_addclosefrom.c\n@@ -28,7 +28,7 @@ __posix_spawn_file_actions_addclosefrom (posix_spawn_file_actions_t\n #if __SPAWN_SUPPORT_CLOSEFROM\n struct __spawn_action *rec;\n \n- if (!__spawn_valid_fd (from))\n+ if (from < 0)\n return EBADF;\n \n /* Allocate more memory if needed. */\ndiff --git a/posix/spawn_faction_adddup2.c b/posix/spawn_faction_adddup2.c\nindex f9564ef4c2..9190eb2a75 100644\n--- a/posix/spawn_faction_adddup2.c\n+++ b/posix/spawn_faction_adddup2.c\n@@ -29,7 +29,7 @@ __posix_spawn_file_actions_adddup2 (posix_spawn_file_actions_t *file_actions,\n {\n struct __spawn_action *rec;\n \n- if (!__spawn_valid_fd (fd) || !__spawn_valid_fd (newfd))\n+ if (fd < 0 || newfd < 0)\n return EBADF;\n \n /* Allocate more memory if needed. */\ndiff --git a/posix/spawn_faction_addfchdir.c b/posix/spawn_faction_addfchdir.c\nindex a3df6df489..e851af1722 100644\n--- a/posix/spawn_faction_addfchdir.c\n+++ b/posix/spawn_faction_addfchdir.c\n@@ -28,6 +28,9 @@ posix_spawn_file_actions_addfchdir_np (posix_spawn_file_actions_t *actions,\n {\n struct __spawn_action *rec;\n \n+ if (fd < 0)\n+ return EBADF;\n+\n /* Allocate more memory if needed. */\n if (actions->__used == actions->__allocated\n && __posix_spawn_file_actions_realloc (actions) != 0)\ndiff --git a/posix/spawn_faction_addopen.c b/posix/spawn_faction_addopen.c\nindex bb9fc41b99..bd610e79b0 100644\n--- a/posix/spawn_faction_addopen.c\n+++ b/posix/spawn_faction_addopen.c\n@@ -31,7 +31,7 @@ __posix_spawn_file_actions_addopen (posix_spawn_file_actions_t *file_actions,\n {\n struct __spawn_action *rec;\n \n- if (!__spawn_valid_fd (fd))\n+ if (fd < 0)\n return EBADF;\n \n char *path_copy = __strdup (path);\ndiff --git a/posix/spawn_faction_addtcsetpgrp_np.c b/posix/spawn_faction_addtcsetpgrp_np.c\nindex 291b115212..6f2f0d315e 100644\n--- a/posix/spawn_faction_addtcsetpgrp_np.c\n+++ b/posix/spawn_faction_addtcsetpgrp_np.c\n@@ -27,7 +27,7 @@ __posix_spawn_file_actions_addtcsetpgrp_np (posix_spawn_file_actions_t\n {\n struct __spawn_action *rec;\n \n- if (!__spawn_valid_fd (tcfd))\n+ if (tcfd < 0)\n return EBADF;\n \n /* Allocate more memory if needed. */\ndiff --git a/posix/spawn_int.h b/posix/spawn_int.h\nindex 0291526edb..297a203c65 100644\n--- a/posix/spawn_int.h\n+++ b/posix/spawn_int.h\n@@ -87,8 +87,4 @@ extern int __spawni (int *pid, const char *path,\n \t\t const posix_spawnattr_t *attrp, char *const argv[],\n \t\t char *const envp[], int xflags) attribute_hidden;\n \n-/* Return true if FD falls into the range valid for file descriptors.\n- The check in this form is mandated by POSIX. */\n-bool __spawn_valid_fd (int fd) attribute_hidden;\n-\n #endif /* _SPAWN_INT_H */\ndiff --git a/posix/spawn_valid_fd.c b/posix/spawn_valid_fd.c\ndeleted file mode 100644\nindex 1d4cd99256..0000000000\n--- a/posix/spawn_valid_fd.c\n+++ /dev/null\n@@ -1,30 +0,0 @@\n-/* File descriptor validity check for posix_spawn file actions.\n- Copyright (C) 2000-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 \"spawn_int.h\"\n-\n-#include <unistd.h>\n-\n-bool\n-__spawn_valid_fd (int fd)\n-{\n- long maxfd = __sysconf (_SC_OPEN_MAX);\n- return __glibc_likely (fd >= 0)\n- && (__glibc_unlikely (maxfd < 0) /* No limit set. */\n-\t|| __glibc_likely (fd < maxfd));\n-}\ndiff --git a/posix/tst-posix_spawn-fd.c b/posix/tst-posix_spawn-fd.c\nindex e75d829562..72a40ff9a3 100644\n--- a/posix/tst-posix_spawn-fd.c\n+++ b/posix/tst-posix_spawn-fd.c\n@@ -72,7 +72,7 @@ all_tests (const char *name, int (*func) (int))\n one_test (name, func, -1, false);\n one_test (name, func, -2, false);\n if (maxfd >= 0)\n- one_test (name, func, maxfd, false);\n+ one_test (name, func, maxfd, true);\n }\n \n static int\n", "prefixes": [ "v3" ] }