{"id":2225759,"url":"http://patchwork.ozlabs.org/api/1.2/patches/2225759/?format=json","web_url":"http://patchwork.ozlabs.org/project/ltp/patch/20260421144246.2046-1-always.starving0@gmail.com/","project":{"id":59,"url":"http://patchwork.ozlabs.org/api/1.2/projects/59/?format=json","name":"Linux Test Project development","link_name":"ltp","list_id":"ltp.lists.linux.it","list_email":"ltp@lists.linux.it","web_url":"","scm_url":"","webscm_url":"","list_archive_url":"","list_archive_url_format":"","commit_url_format":""},"msgid":"<20260421144246.2046-1-always.starving0@gmail.com>","list_archive_url":null,"date":"2026-04-21T14:42:44","name":"[v5] close02: add test for double close EBADF","commit_ref":null,"pull_url":null,"state":"changes-requested","archived":false,"hash":"62f828cd7fe42b8174f9b14656c861f85663f0b6","submitter":{"id":92589,"url":"http://patchwork.ozlabs.org/api/1.2/people/92589/?format=json","name":"Jinseok Kim","email":"always.starving0@gmail.com"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/ltp/patch/20260421144246.2046-1-always.starving0@gmail.com/mbox/","series":[{"id":500826,"url":"http://patchwork.ozlabs.org/api/1.2/series/500826/?format=json","web_url":"http://patchwork.ozlabs.org/project/ltp/list/?series=500826","date":"2026-04-21T14:42:44","name":"[v5] close02: add test for double close EBADF","version":5,"mbox":"http://patchwork.ozlabs.org/series/500826/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/2225759/comments/","check":"success","checks":"http://patchwork.ozlabs.org/api/patches/2225759/checks/","tags":{},"related":[],"headers":{"Return-Path":"<ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it>","X-Original-To":["incoming@patchwork.ozlabs.org","ltp@lists.linux.it"],"Delivered-To":["patchwork-incoming@legolas.ozlabs.org","ltp@picard.linux.it"],"Authentication-Results":["legolas.ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256\n header.s=20251104 header.b=g0/zfSXp;\n\tdkim-atps=neutral","legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=lists.linux.it\n (client-ip=2001:1418:10:5::2; helo=picard.linux.it;\n envelope-from=ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it;\n receiver=patchwork.ozlabs.org)"],"Received":["from picard.linux.it (picard.linux.it [IPv6:2001:1418:10:5::2])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4g0Q862DWdz1yCv\n\tfor <incoming@patchwork.ozlabs.org>; Wed, 22 Apr 2026 00:43:18 +1000 (AEST)","from picard.linux.it (localhost [IPv6:::1])\n\tby picard.linux.it (Postfix) with ESMTP id 19D053E4A88\n\tfor <incoming@patchwork.ozlabs.org>; Tue, 21 Apr 2026 16:43:16 +0200 (CEST)","from in-6.smtp.seeweb.it (in-6.smtp.seeweb.it [217.194.8.6])\n (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n key-exchange X25519 server-signature ECDSA (secp384r1))\n (No client certificate requested)\n by picard.linux.it (Postfix) with ESMTPS id 377733E1B27\n for <ltp@lists.linux.it>; Tue, 21 Apr 2026 16:43:12 +0200 (CEST)","from mail-pj1-x1043.google.com (mail-pj1-x1043.google.com\n [IPv6:2607:f8b0:4864:20::1043])\n (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)\n key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest\n SHA256)\n (No client certificate requested)\n by in-6.smtp.seeweb.it (Postfix) with ESMTPS id 97720140053B\n for <ltp@lists.linux.it>; Tue, 21 Apr 2026 16:43:11 +0200 (CEST)","by mail-pj1-x1043.google.com with SMTP id\n 98e67ed59e1d1-35d94f4ee36so2594887a91.3\n for <ltp@lists.linux.it>; Tue, 21 Apr 2026 07:43:11 -0700 (PDT)","from localhost.localdomain ([211.196.223.197])\n by smtp.gmail.com with ESMTPSA id\n 98e67ed59e1d1-361410a7ab7sm17703387a91.10.2026.04.21.07.43.08\n (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n Tue, 21 Apr 2026 07:43:09 -0700 (PDT)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=gmail.com; s=20251104; t=1776782590; x=1777387390; darn=lists.linux.it;\n h=content-transfer-encoding:mime-version:references:in-reply-to\n :message-id:date:subject:cc:to:from:from:to:cc:subject:date\n :message-id:reply-to;\n bh=yj6XZTiYQOuhsxv6ITQTS+TTJBWVdw1ba70GugVhvm0=;\n b=g0/zfSXpZ5CEEJzxqVjxhLnemirY+gjntBuI1wM6vdmjJnXccEYvM4WbQ8x02Nb0g8\n utOXk1ogSKsHhv1E2CoZNdqu2qx8owWvo7KqkfJnvFZz3eMWkMCKi/LHFeZL/XJ5u3NU\n NmfIjAh90Adl+2VBmEzWFuI3KL5afEvIumeWhrA8YaWXiK0RT8hx/ags8VxTcQZNz2T/\n ZRf6EgrjhFCR2rgo1J0am5loUCNznLP5AoDU8NkD2/+jnaNXPcvuK7lNiP9GD5HWyMaU\n IKMS9+OnaEZ2SEZmHEA3Ep7ow1sQQfKe481ZX7EAgNTihdXQzkJPYPpjPl4zaEQHvjlq\n ruhg==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20251104; t=1776782590; x=1777387390;\n h=content-transfer-encoding:mime-version:references:in-reply-to\n :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from\n :to:cc:subject:date:message-id:reply-to;\n bh=yj6XZTiYQOuhsxv6ITQTS+TTJBWVdw1ba70GugVhvm0=;\n b=LV5Esqvi+eqm8uFiuhGbnzRO3ideuVgigLCHZI8/q2SGBoASCadz9XOHB3au3gIzIv\n m1nwrPXI16Cj7G5VO+0vn6VptJYY1Y+T9/omlu5D304anmovuYqSu4uJiUzxkfunoLX5\n wSfN4O9QScUo6a2P7t3pjukEKkplnkgCbLTEq/cXRaHAoBX/pgjj8Oawc3HAzFaxewok\n 3UZnqHP/sX3h6hScGI0FAeoibeaNDDqlUoXlFFCg/aD+zCCLohsaTABvj0Funs8vLqRg\n XLIX9MeYJwMkZYtGIKxA6E9br55+Aef5nuGCcF7SOh+p88mSM8Rx3Oqd6Dipm83c+Bwe\n dCzQ==","X-Gm-Message-State":"AOJu0YwtYP6PImExluz0bZ0WWXN4LjLjx3x+cWT1OoD9bpZxKqKWKGk2\n Wtzmx9apuC8Pb4kLbU+5L/OWUGKWlTnCSAT9r7o++l9lj6BykUsafa4=","X-Gm-Gg":"AeBDieuN9GMj+RLLPvoskZgN4I6FlKqo37/lrnkP+3lU9PeDQH88/JrgYTup/TKeoQC\n 7TWMlfAqZ2RAwlnEt/oLDdYS5XFu8MPxix/URqiUH9A/zXSE4dcAJMW2e/veAFhxBdwgg8HFw9q\n 5Kxc2Qk9NyUziYAD2rtlfBD7h4tABgYRf3CZgpu+XXVDz3r5pKzL7sxfToMYthEVaoHHSzEcGfQ\n Uqkf9xrIrX9hAuEdkaLid1xmTXiVMf05PBfl+SX9ShYrb1X/GVLhW69rcEqNH5um3UVSEQCud6v\n 0wi6OlXlDV1AIPnCD7YVXWE3i/saVFWIeFdACgZbiEfpYZtCRTgfmlwKltNvdN6Xe0edrrl5qfE\n 18VDDbGjt9A5mhmuIH+IFVxAgM8kkZY0PiUsQV+EdEGeYmOBC0aVaqA16Z4MK5JfWAZXOR2uQY4\n hUbQIb60ovc+Y3XtTzRZuZh3Tuc5LgMi59JwHAzqqeDbU5aBfK1QD4U6E=","X-Received":"by 2002:a17:90b:164a:b0:35f:b572:ece3 with SMTP id\n 98e67ed59e1d1-361403bd001mr19032346a91.6.1776782589751;\n Tue, 21 Apr 2026 07:43:09 -0700 (PDT)","From":"Jinseok Kim <always.starving0@gmail.com>","To":"pvorel@suse.cz","Date":"Tue, 21 Apr 2026 23:42:44 +0900","Message-ID":"<20260421144246.2046-1-always.starving0@gmail.com>","X-Mailer":"git-send-email 2.43.0","In-Reply-To":"<20260417115648.GC409289@pevik>","References":"<20260417115648.GC409289@pevik>","MIME-Version":"1.0","X-Spam-Status":"No, score=0.3 required=7.0 tests=DKIM_SIGNED,DKIM_VALID,\n DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM,\n SPF_HELO_NONE,SPF_PASS shortcircuit=no autolearn=disabled version=4.0.1","X-Spam-Checker-Version":"SpamAssassin 4.0.1 (2024-03-25) on in-6.smtp.seeweb.it","X-Virus-Scanned":"clamav-milter 1.0.9 at in-6.smtp.seeweb.it","X-Virus-Status":"Clean","Subject":"[LTP] [PATCH v5] close02: add test for double close EBADF","X-BeenThere":"ltp@lists.linux.it","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"Linux Test Project <ltp.lists.linux.it>","List-Unsubscribe":"<https://lists.linux.it/options/ltp>,\n <mailto:ltp-request@lists.linux.it?subject=unsubscribe>","List-Archive":"<http://lists.linux.it/pipermail/ltp/>","List-Post":"<mailto:ltp@lists.linux.it>","List-Help":"<mailto:ltp-request@lists.linux.it?subject=help>","List-Subscribe":"<https://lists.linux.it/listinfo/ltp>,\n <mailto:ltp-request@lists.linux.it?subject=subscribe>","Cc":"ltp@lists.linux.it","Content-Type":"text/plain; charset=\"us-ascii\"","Content-Transfer-Encoding":"7bit","Errors-To":"ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it","Sender":"\"ltp\" <ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it>"},"content":"Verify that calling close() on an already closed file descriptor fails\nwith EBADF.\n\nThis test adds coverage for a common state transition case where a\npreviously valid file descriptor becomes invalid after close().\n\nSigned-off-by: Jinseok Kim <always.starving0@gmail.com>\n---\nChanges in v5:\n- Change file descriptor as static\n- Link to v4 : https://lore.kernel.org/ltp/20260416125554.2920-1-always.starving0@gmail.com\n\nChanges in v4:\n- Remove enum, add fd/expected errno in tcases, and move preparation\n  to setup().\n- Link to v3: https://lore.kernel.org/ltp/20260413165457.1349-1-always.starving0@gmail.com\n\nChanges in v3:\n- Add O_RDWR flag to SAFE_OPEN\n- Link to v2: https://lore.kernel.org/ltp/20260411110405.7330-1-always.starving0@gmail.com\n\nChanges in v2:\n- Add additional test coverage to close02 instead of creating a separate\n  close03 test.\n- Link to v1: https://lore.kernel.org/ltp/20260406133134.17238-2-always.starving0@gmail.com\n---\n testcases/kernel/syscalls/close/close02.c | 37 ++++++++++++++++++++---\n 1 file changed, 33 insertions(+), 4 deletions(-)\n\n--\n2.43.0","diff":"diff --git a/testcases/kernel/syscalls/close/close02.c b/testcases/kernel/syscalls/close/close02.c\nindex 617c48237..a48570d12 100644\n--- a/testcases/kernel/syscalls/close/close02.c\n+++ b/testcases/kernel/syscalls/close/close02.c\n@@ -5,17 +5,46 @@\n  */\n\n /*\\\n- * Call close(-1) and expects it to return EBADF.\n+ * Verify :manpage:`close(2)` failure cases:\n+ *\n+ * 1) close(-1) returns EBADF.\n+ * 2) closing the same fd twice returns EBADF on the second call.\n  */\n\n #include <errno.h>\n+#include <fcntl.h>\n+\n #include \"tst_test.h\"\n\n-static void run(void)\n+static int fd_closed = -1;\n+\n+static struct tcase {\n+\tconst char *desc;\n+\tint fd;\n+\tint exp_errno;\n+} tcases[] = {\n+\t{ \"close(-1)\", -1, EBADF },\n+\t{ \"close same fd twice\", -1, EBADF },\n+};\n+\n+static void verify_close(unsigned int i)\n {\n-\tTST_EXP_FAIL(close(-1), EBADF);\n+\tstruct tcase *tc = &tcases[i];\n+\n+\tTST_EXP_FAIL(close(tc->fd), tc->exp_errno, \"%s\", tc->desc);\n+}\n+\n+static void setup(void)\n+{\n+\tfd_closed = SAFE_OPEN(\"close02\", O_CREAT | O_RDWR, 0600);\n+\n+\tSAFE_CLOSE(fd_closed);\n+\ttcases[1].fd = fd_closed;\n }\n\n static struct tst_test test = {\n-\t.test_all = run,\n+\t.needs_tmpdir = 1,\n+\t.setup = setup,\n+\t.tcnt = ARRAY_SIZE(tcases),\n+\t.test = verify_close,\n };\n","prefixes":["v5"]}