[{"id":3676840,"web_url":"http://patchwork.ozlabs.org/comment/3676840/","msgid":"<20260413145649.4050-1-linuxtestproject.agent@gmail.com>","list_archive_url":null,"date":"2026-04-13T14:56:49","subject":"Re: [LTP] futex: Add error coverage tests for wait,\n wake and cmp_requeue","submitter":{"id":93132,"url":"http://patchwork.ozlabs.org/api/people/93132/","name":null,"email":"linuxtestproject.agent@gmail.com"},"content":"Hi Michael,\n\nour agent completed the review of the patch.\n\nOn Mon, 13 Apr 2026, Michael Menasherov via ltp wrote:\n> [PATCH] futex: Add error coverage tests for wait, wake and cmp_requeue\n\n[...]\n\n> futex_cmp_requeue03 verifies EFAULT is returned when uaddr or\n> uaddr2 points to unmapped memory, and EACCES or EFAULT when uaddr\n> points to memory without read permission (PROT_NONE). The EACCES\n> behavior was introduced in kernel 5.9.\n\nThe commit message is missing the Signed-off-by tag. Please add:\n\n  Signed-off-by: Michael Menasherov <your@email.com>\n\nRegards,\nLTP AI Reviewer","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=c6F8JZav;\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 server-signature ECDSA (secp384r1) server-digest SHA384)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4fvX5y3s0dz1y2d\n\tfor <incoming@patchwork.ozlabs.org>; Tue, 14 Apr 2026 01:54:29 +1000 (AEST)","from picard.linux.it (localhost [IPv6:::1])\n\tby picard.linux.it (Postfix) with ESMTP id A89CC3E4B3B\n\tfor <incoming@patchwork.ozlabs.org>; Mon, 13 Apr 2026 17:54:26 +0200 (CEST)","from in-5.smtp.seeweb.it (in-5.smtp.seeweb.it [217.194.8.5])\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 108153E1DD5\n for <ltp@lists.linux.it>; Mon, 13 Apr 2026 17:51:53 +0200 (CEST)","from mail-ot1-x344.google.com (mail-ot1-x344.google.com\n [IPv6:2607:f8b0:4864:20::344])\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-5.smtp.seeweb.it (Postfix) with ESMTPS id 9497560082B\n for <ltp@lists.linux.it>; Mon, 13 Apr 2026 17:51:53 +0200 (CEST)","by mail-ot1-x344.google.com with SMTP id\n 46e09a7af769-7d7ebe11bffso3903062a34.0\n for <ltp@lists.linux.it>; Mon, 13 Apr 2026 08:51:53 -0700 (PDT)","from\n runnervm35a4x.yizgoo0wxrde1freo0ereqkpvd.dx.internal.cloudapp.net\n ([52.238.26.248]) by smtp.gmail.com with ESMTPSA id\n a92af1059eb24-12c347fa2c9sm14053711c88.15.2026.04.13.07.56.50\n (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n Mon, 13 Apr 2026 07:56:50 -0700 (PDT)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=gmail.com; s=20251104; t=1776095512; x=1776700312; 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=uPVBnOciOymkt8TTTofjGGh4d7P4/7BB+m7V+e04UhQ=;\n b=c6F8JZavC7iw/+hFBW6xHS+k75m8LSGEy2dTyuHk5QfuKiGZsT0asq9t+MIOpmqVCO\n V4KA5zYZizS8GhThE8GesJJBxF7Va1CCTICKW2MFxc+LKG02x9qr8mQoJDkjP7Oi32R0\n H+P7YeMjpIskvk3RsbETtcTR6JjIIRXKc8RZRIDzgO8zVOAkZNtX/RPfcV2DfXuagXzO\n cawP6fxTllq4vbvW6c65nLXpKh/YFOtZWvn32vvlwkp8evSD7rYJrju3FLZeGvS+DK84\n kkxBAPcRMeYxgelvcdmIZaSXWKeECpsiVpK4enBkTUn7GXtG1RfI/R94mlOnD7sxumiQ\n hlZQ==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20251104; t=1776095512; x=1776700312;\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=uPVBnOciOymkt8TTTofjGGh4d7P4/7BB+m7V+e04UhQ=;\n b=qGfWsauDupMHYRW9Grz1aI4ujRXda888VdGk/ZIIcEdW9Lp6XwbsmyCiXn9Z77+Hkk\n KB3cNWKpXItC1rd4tGveI9LLKCakQNHl1SLTuuiaWmFp+Sbxaz2m1j2RRW6VQmnqxnK1\n HhhkJo9tsB6iqkZ7CO7NFMCaXyMkkfUJ2VvbdU0f9zc/6aqudh9xaISbQeo7kobjwjQU\n mQLXpyEV7sLgF2mTgJkxb7DSltQGw0eIP31EhkmY5KX+vzHHwdYteQ/JAY4pse/H5l8J\n YtOzHwYAGQW0rpQmBsBMyoroLwfDT5uziUEXXK7DPVXmj75OkjzE6X7XFnL3GJFKlGEQ\n wMvw==","X-Gm-Message-State":"AOJu0YwRqJto41rM1+EBryMhn7+vgofMWUkIm3hvcLVRlUSa11aMWiHd\n 9YOlFWGQLyGJ7ylY+/lDSl+IlUuEgFJ26Pxi5RQtb1zQer4v9AAo5uP1EArgHds7Hb1c+qwmsl0\n =","X-Gm-Gg":"AeBDievMu81IMLOWj0f5bvM9gACzlY6kciJvN6gsRYZaHyrGE77AEjDWrR5y+XdmKtu\n 0cQijsntcDtLO/5quxllb5Lso2/V4qdx3MkCZZwrYZ2naI94+KPt1ekPT5aNuzMvWNodLTi3ZCL\n def7LrfgejG5RaM4f9bb+liYFiwrcTUm1rwU/VuYAQgTarhb87U1HGTP8KJIzhQLcciOZJA984x\n 4SY0x9SLgV2o89uI7vjjN+v6qvqHsvs2/YNvFFBk9PtTJkk6amQ39lgyIWecUMHlJUMhPDuzOG+\n utM3Ca2WZB6/osQ5DSawUqQRPgnPH2777S+/BNg7zBtrBB+bKNIrE6q0pwmrQpQtFL3Rv3xDi6J\n 8Fa/Lmu4Iu7kYhGF6zhzukcrHeW2Ew5gTljoT2Gxe5Cw3MC3M94RrAc/YnmdFyI67tN31mf1ooN\n aUY/BpUONe9yY7F+rdHsFC/bBg8Ed7aclk3nxh4y/Q2yIQ2zxfkVUq4krC4lzQGU6ceLcQ5FJgV\n E1eEWWr7tQuB9NQd5fo/UOl3h6+Rd2PBFA=","X-Received":"by 2002:a05:7022:ec07:b0:11a:4016:44a5 with SMTP id\n a92af1059eb24-12c34efc9d9mr8007675c88.24.1776092211144;\n Mon, 13 Apr 2026 07:56:51 -0700 (PDT)","From":"linuxtestproject.agent@gmail.com","To":"Michael Menasherov <mmenashe@redhat.com>","Date":"Mon, 13 Apr 2026 14:56:49 +0000","Message-ID":"<20260413145649.4050-1-linuxtestproject.agent@gmail.com>","X-Mailer":"git-send-email 2.53.0","In-Reply-To":"<20260413134029.43754-1-mmenashe@redhat.com>","References":"<20260413134029.43754-1-mmenashe@redhat.com>","MIME-Version":"1.0","X-Spam-Status":"No, score=0.1 required=7.0 tests=DKIM_SIGNED,DKIM_VALID,\n DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,SPF_HELO_NONE,SPF_PASS\n shortcircuit=no autolearn=disabled version=4.0.1","X-Spam-Checker-Version":"SpamAssassin 4.0.1 (2024-03-25) on in-5.smtp.seeweb.it","X-Virus-Scanned":"clamav-milter 1.0.9 at in-5.smtp.seeweb.it","X-Virus-Status":"Clean","X-Mailman-Approved-At":"Mon, 13 Apr 2026 17:54:23 +0200","Subject":"Re: [LTP] futex: Add error coverage tests for wait,\n wake and cmp_requeue","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>"}},{"id":3677739,"web_url":"http://patchwork.ozlabs.org/comment/3677739/","msgid":"<ad-wLMzLBVVIvUDA@yuki.lan>","list_archive_url":null,"date":"2026-04-15T15:35:08","subject":"Re: [LTP] [PATCH v2] futex: Add error coverage tests for wait,\n wake and cmp_requeue","submitter":{"id":8530,"url":"http://patchwork.ozlabs.org/api/people/8530/","name":"Cyril Hrubis","email":"chrubis@suse.cz"},"content":"Hi!\n> Improve error handling coverage for futex syscalls by adding tests\n> for missing error conditions that were previously untested.\n> \n> futex_wait06 verifies EFAULT is returned when uaddr or timeout\n> points to unmapped memory.\n> \n> futex_wait07 verifies EINTR is returned when futex_wait() is\n> interrupted by a signal.\n> \n> futex_wake05 verifies EFAULT is returned when uaddr points to\n> unmapped or PROT_NONE memory.\n> \n> futex_cmp_requeue03 verifies EFAULT is returned when uaddr or\n> uaddr2 points to unmapped memory, and EACCES or EFAULT when uaddr\n> points to memory without read permission (PROT_NONE). The EACCES\n> behavior was introduced in kernel 5.9.\n\nGenerally it would be probably easier to review and applly if you split\nthis into a series with one test per per patch.\n\n> ---\n> v2: Use TST_EXP_FAIL macro as requested.\n>     Store address directly in testcase structs and not using flags.\n>     Use SAFE_MMAP and not raw as requested, also added a sign off.\n>  runtest/syscalls                              |   4 +\n>  testcases/kernel/syscalls/futex/.gitignore    |   4 +\n>  .../syscalls/futex/futex_cmp_requeue03.c      |  96 ++++++++++++++\n>  .../kernel/syscalls/futex/futex_wait06.c      |  73 +++++++++++\n>  .../kernel/syscalls/futex/futex_wait07.c      | 117 ++++++++++++++++++\n>  .../kernel/syscalls/futex/futex_wake05.c      |  86 +++++++++++++\n>  6 files changed, 380 insertions(+)\n>  create mode 100644 testcases/kernel/syscalls/futex/futex_cmp_requeue03.c\n>  create mode 100644 testcases/kernel/syscalls/futex/futex_wait06.c\n>  create mode 100644 testcases/kernel/syscalls/futex/futex_wait07.c\n>  create mode 100644 testcases/kernel/syscalls/futex/futex_wake05.c\n> \n> diff --git a/runtest/syscalls b/runtest/syscalls\n> index 6ba0227a8..6c12dc225 100644\n> --- a/runtest/syscalls\n> +++ b/runtest/syscalls\n> @@ -1859,11 +1859,14 @@ perf_event_open02 perf_event_open02\n>  \n>  futex_cmp_requeue01 futex_cmp_requeue01\n>  futex_cmp_requeue02 futex_cmp_requeue02\n> +futex_cmp_requeue03 futex_cmp_requeue03\n>  futex_wait01 futex_wait01\n>  futex_wait02 futex_wait02\n>  futex_wait03 futex_wait03\n>  futex_wait04 futex_wait04\n>  futex_wait05 futex_wait05\n> +futex_wait06 futex_wait06\n> +futex_wait07 futex_wait07\n>  futex_waitv01 futex_waitv01\n>  futex_waitv02 futex_waitv02\n>  futex_waitv03 futex_waitv03\n> @@ -1871,6 +1874,7 @@ futex_wake01 futex_wake01\n>  futex_wake02 futex_wake02\n>  futex_wake03 futex_wake03\n>  futex_wake04 futex_wake04\n> +futex_wake05 futex_wake05\n>  futex_wait_bitset01 futex_wait_bitset01\n>  \n>  memfd_create01 memfd_create01\n> diff --git a/testcases/kernel/syscalls/futex/.gitignore b/testcases/kernel/syscalls/futex/.gitignore\n> index 9d08ba7d3..c47d39b5b 100644\n> --- a/testcases/kernel/syscalls/futex/.gitignore\n> +++ b/testcases/kernel/syscalls/futex/.gitignore\n> @@ -1,15 +1,19 @@\n>  /futex_cmp_requeue01\n>  /futex_cmp_requeue02\n> +/futex_cmp_requeue03\n>  /futex_wait01\n>  /futex_wait02\n>  /futex_wait03\n>  /futex_wait04\n>  /futex_wait05\n> +/futex_wait06\n> +/futex_wait07\n>  /futex_wait_bitset01\n>  /futex_wake01\n>  /futex_wake02\n>  /futex_wake03\n>  /futex_wake04\n> +/futex_wake05\n>  /futex_waitv01\n>  /futex_waitv02\n>  /futex_waitv03\n> diff --git a/testcases/kernel/syscalls/futex/futex_cmp_requeue03.c b/testcases/kernel/syscalls/futex/futex_cmp_requeue03.c\n> new file mode 100644\n> index 000000000..099d5e35c\n> --- /dev/null\n> +++ b/testcases/kernel/syscalls/futex/futex_cmp_requeue03.c\n> @@ -0,0 +1,96 @@\n> +// SPDX-License-Identifier: GPL-2.0-or-later\n> +/*\n> + * Copyright (C) 2026 Red Hat, Inc.\n> + */\n> +\n> +/*\\\n> + * Check that futex(FUTEX_CMP_REQUEUE) returns EFAULT when uaddr or\n> + * uaddr2 points to unmapped memory, and EACCES (or EFAULT on older kernels)\n> + * when uaddr points to memory without read permission (PROT_NONE).\n> + *\n> + * The EACCES behavior for PROT_NONE was introduced in kernel 5.9.\n> + */\n> +\n> +#include <errno.h>\n> +#include <sys/mman.h>\n> +\n> +#include \"futextest.h\"\n> +\n> +static futex_t futex_var = FUTEX_INITIALIZER;\n> +static futex_t *prot_none_addr;\n> +\n> +static struct futex_test_variants variants[] = {\n> +#if (__NR_futex != __LTP__NR_INVALID_SYSCALL)\n> +\t{ .fntype = FUTEX_FN_FUTEX, .desc = \"syscall with old kernel spec\"},\n> +#endif\n> +\n> +#if (__NR_futex_time64 != __LTP__NR_INVALID_SYSCALL)\n> +\t{ .fntype = FUTEX_FN_FUTEX64, .desc = \"syscall time64 with kernel spec\"},\n> +#endif\n> +};\n> +\n> +static struct testcase {\n> +\tconst char *desc;\n> +\tfutex_t *uaddr;\n> +\tfutex_t *uaddr2;\n> +\tint exp_errno;\n> +} testcases[3];\n> +\n> +static void run(unsigned int n)\n> +{\n> +\tstruct futex_test_variants *tv = &variants[tst_variant];\n> +\tstruct testcase *tc = &testcases[n];\n> +\n> +\tTST_EXP_FAIL(futex_cmp_requeue(tv->fntype, tc->uaddr, futex_var,\n> +\t\ttc->uaddr2, 1, 1, 0), tc->exp_errno, \"%s\", tc->desc);\n> +}\n> +\n> +static void setup(void)\n> +{\n> +\tstruct futex_test_variants *tv = &variants[tst_variant];\n> +\tsize_t pagesize = getpagesize();\n> +\tfutex_t *unmapped;\n> +\n> +\ttst_res(TINFO, \"Testing variant: %s\", tv->desc);\n> +\tfutex_supported_by_kernel(tv->fntype);\n> +\n> +\tunmapped = SAFE_MMAP(NULL, pagesize, PROT_READ | PROT_WRITE,\n> +\t\tMAP_PRIVATE | MAP_ANONYMOUS, -1, 0);\n> +\tSAFE_MUNMAP(unmapped, pagesize);\n> +\n> +\tprot_none_addr = SAFE_MMAP(NULL, pagesize, PROT_NONE,\n> +\t\tMAP_PRIVATE | MAP_ANONYMOUS, -1, 0);\n> +\n> +\ttestcases[0] = (struct testcase){\n> +\t\t.desc = \"uaddr unmapped\",\n> +\t\t.uaddr = unmapped,\n> +\t\t.uaddr2 = &futex_var,\n> +\t\t.exp_errno = EFAULT,\n> +\t};\n> +\ttestcases[1] = (struct testcase){\n> +\t\t.desc = \"uaddr2 unmapped\",\n> +\t\t.uaddr = &futex_var,\n> +\t\t.uaddr2 = unmapped,\n> +\t\t.exp_errno = EFAULT,\n> +\t};\n> +\ttestcases[2] = (struct testcase){\n> +\t\t.desc = \"uaddr PROT_NONE\",\n> +\t\t.uaddr = prot_none_addr,\n> +\t\t.uaddr2 = &futex_var,\n> +\t\t.exp_errno = tst_kvercmp(5, 9, 0) >= 0 ? EACCES : EFAULT,\n> +\t};\n> +}\n> +\n> +static void cleanup(void)\n> +{\n> +\tif (prot_none_addr)\n> +\t\tSAFE_MUNMAP(prot_none_addr, getpagesize());\n> +}\n> +\n> +static struct tst_test test = {\n> +\t.setup = setup,\n> +\t.cleanup = cleanup,\n> +\t.test = run,\n> +\t.tcnt = ARRAY_SIZE(testcases),\n> +\t.test_variants = ARRAY_SIZE(variants),\n> +};\n> diff --git a/testcases/kernel/syscalls/futex/futex_wait06.c b/testcases/kernel/syscalls/futex/futex_wait06.c\n> new file mode 100644\n> index 000000000..8bb563fb2\n> --- /dev/null\n> +++ b/testcases/kernel/syscalls/futex/futex_wait06.c\n> @@ -0,0 +1,73 @@\n> +// SPDX-License-Identifier: GPL-2.0-or-later\n> +/*\n> + * Copyright (C) 2026 Red Hat, Inc.\n> + */\n> +\n> +/*\\\n> + * Check that futex(FUTEX_WAIT) returns EFAULT when:\n> + *\n> + * 1) uaddr points to unmapped memory\n> + * 2) timeout points to unmapped memory\n> + */\n> +#include <errno.h>\n> +#include <sys/mman.h>\n> +\n> +#include \"futextest.h\"\n> +\n> +static futex_t futex = FUTEX_INITIALIZER;\n> +\n> +static struct futex_test_variants variants[] = {\n> +#if (__NR_futex != __LTP__NR_INVALID_SYSCALL)\n> +\t{ .fntype = FUTEX_FN_FUTEX, .tstype = TST_KERN_OLD_TIMESPEC, .desc = \"syscall with old kernel spec\"},\n> +#endif\n> +\n> +#if (__NR_futex_time64 != __LTP__NR_INVALID_SYSCALL)\n> +\t{ .fntype = FUTEX_FN_FUTEX64, .tstype = TST_KERN_TIMESPEC, .desc = \"syscall time64 with kernel spec\"},\n> +#endif\n> +};\n> +\n> +static struct testcase {\n> +\tconst char *desc;\n> +\tfutex_t *uaddr;\n> +\tvoid *timeout;\n> +} testcases[2];\n> +\n> +static void run(unsigned int n)\n> +{\n> +\tstruct futex_test_variants *tv = &variants[tst_variant];\n> +\tstruct testcase *tc = &testcases[n];\n> +\n> +\tTST_EXP_FAIL(futex_syscall(tv->fntype, tc->uaddr, FUTEX_WAIT, futex,\n> +\t\ttc->timeout, NULL, 0, 0), EFAULT, \"%s\", tc->desc);\n> +}\n> +\n> +static void setup(void)\n> +{\n> +\tstruct futex_test_variants *tv = &variants[tst_variant];\n> +\tvoid *bad;\n> +\n> +\ttst_res(TINFO, \"Testing variant: %s\", tv->desc);\n> +\tfutex_supported_by_kernel(tv->fntype);\n> +\n> +\tbad = SAFE_MMAP(NULL, getpagesize(), PROT_READ | PROT_WRITE,\n> +\t\tMAP_PRIVATE | MAP_ANONYMOUS, -1, 0);\n> +\tSAFE_MUNMAP(bad, getpagesize());\n> +\n> +\ttestcases[0] = (struct testcase){\n> +\t\t.desc = \"uaddr points to unmapped memory\",\n> +\t\t.uaddr = bad,\n> +\t\t.timeout = NULL,\n> +\t};\n> +\ttestcases[1] = (struct testcase){\n> +\t\t.desc = \"timeout points to unmapped memory\",\n> +\t\t.uaddr = &futex,\n> +\t\t.timeout = bad,\n> +\t};\n> +}\n> +\n> +static struct tst_test test = {\n> +\t.setup = setup,\n> +\t.test = run,\n> +\t.tcnt = ARRAY_SIZE(testcases),\n> +\t.test_variants = ARRAY_SIZE(variants),\n> +};\n> diff --git a/testcases/kernel/syscalls/futex/futex_wait07.c b/testcases/kernel/syscalls/futex/futex_wait07.c\n> new file mode 100644\n> index 000000000..a3c1c153d\n> --- /dev/null\n> +++ b/testcases/kernel/syscalls/futex/futex_wait07.c\n> @@ -0,0 +1,117 @@\n> +// SPDX-License-Identifier: GPL-2.0-or-later\n> +/*\n> + * Copyright (C) 2026 Red Hat, Inc.\n> + */\n> +\n> +/*\\\n> + * Check that futex(FUTEX_WAIT) returns EINTR when interrupted by a signal.\n> + * A child process blocks on futex_wait() with a long timeout. The parent\n> + * waits for the child to enter sleep state, then sends SIGUSR1 to it.\n> + * The child verifies it received EINTR and exits accordingly.\n> + */\n> +\n> +#include <errno.h>\n> +#include <signal.h>\n> +#include <sys/wait.h>\n> +\n> +#include \"futextest.h\"\n> +\n> +static futex_t *futex;\n> +\n> +static struct futex_test_variants variants[] = {\n> +#if (__NR_futex != __LTP__NR_INVALID_SYSCALL)\n> +\t{ .fntype = FUTEX_FN_FUTEX, .tstype = TST_KERN_OLD_TIMESPEC, .desc = \"syscall with old kernel spec\"},\n> +#endif\n> +\n> +#if (__NR_futex_time64 != __LTP__NR_INVALID_SYSCALL)\n> +\t{ .fntype = FUTEX_FN_FUTEX64, .tstype = TST_KERN_TIMESPEC, .desc = \"syscall time64 with kernel spec\"},\n> +#endif\n> +};\n> +\n> +/* We need a handler so SIGUSR1 is caught instead of killing the process.\n> + * The empty body is needed, just receiving the signal is enough to\n> + * interrupt futex_wait() and make it return into EINTR -1 status.\n> + */\n> +static void sigusr1_handler(int sig LTP_ATTRIBUTE_UNUSED)\n> +{\n> +}\n\nWe have SIG_IGN for this purpose.\n\n> +static void do_child(void)\n> +{\n> +\tstruct futex_test_variants *tv = &variants[tst_variant];\n> +\tstruct sigaction sa;\n> +\tstruct tst_ts timeout;\n> +\tint res;\n> +\n> +\t/* Set up the signal handler for SIGUSR1 */\n\nPlease avoid commenting obvious such as this comment. There is plenty of\nobvious comments that does not help at all.\n\n> +\tsa.sa_handler = sigusr1_handler;\n> +\tsa.sa_flags = 0;\n> +\tSAFE_SIGEMPTYSET(&sa.sa_mask);\n> +\tSAFE_SIGACTION(SIGUSR1, &sa, NULL);\n> +\n> +\t/* Create a timeout for 5 sec for this variant.\n> +\t * if no one wakes the child before 5 sec, futex_wait() will return\n> +\t * on its own with ETIMEDOUT and will not wait any longer\n> +\t */\n> +\ttimeout = tst_ts_from_ms(tv->tstype, 5000);\n> +\tres = futex_wait(tv->fntype, futex, *futex, &timeout, 0);\n> +\n> +\tif (res != -1) {\n> +\t\ttst_res(TFAIL, \"futex_wait() should have failed with EINTR but returned success instead\");\n> +\t\texit(1);\n> +\t}\n> +\tif (errno != EINTR) {\n> +\t\ttst_res(TFAIL | TERRNO, \"futex_wait() expected EINTR but got something else, errno\");\n> +\t\texit(1);\n> +\t}\n> +\ttst_res(TPASS | TERRNO, \"futex_wait() returned EINTR as expected\");\n\nThis could be another TST_EXP_FAIL macro, right?\n\n> +\texit(0);\n> +}\n> +\n> +static void run(void)\n> +{\n> +\tpid_t child;\n> +\tint status;\n> +\n> +\tchild = SAFE_FORK();\n> +\n> +\tif (child == 0) {\n> +\t\tdo_child();\n> +\t}\n\nLKML does prefer not having curly braces around single line statements.\n\n> +\t/* Wait until child is sleeping before sending signal */\n> +\tTST_PROCESS_STATE_WAIT(child, 'S', 0);\n> +\t/* Wake up the child so it will return EINTR -1 status */\n> +\tSAFE_KILL(child, SIGUSR1);\n> +\tSAFE_WAITPID(child, &status, 0);\n> +\t/* Check if the child finished everything as it should */\n> +\tif (!WIFEXITED(status) || WEXITSTATUS(status) != 0) {\n> +\t\ttst_res(TFAIL, \"child exited abnormally\");\n> +\t}\n\nYou can let the test library collect the child, no need to do that\nmanually here.\n\n> +}\n> +\n> +static void setup(void)\n> +{\n> +\tstruct futex_test_variants *tv = &variants[tst_variant];\n> +\n> +\ttst_res(TINFO, \"Testing variant: %s\", tv->desc);\n> +\tfutex_supported_by_kernel(tv->fntype);\n> +\n> +\t/* Futex needs to be in a shared memory so the parent and the child can access into it */\n> +\tfutex = SAFE_MMAP(NULL, sizeof(*futex), PROT_READ | PROT_WRITE, MAP_ANONYMOUS | MAP_SHARED, -1, 0);\n> +\t*futex = FUTEX_INITIALIZER;\n> +}\n> +\n> +static void cleanup(void)\n> +{\n> +\tif (futex) {\n> +\t\tSAFE_MUNMAP((void *)futex, sizeof(*futex));\n> +\t}\n> +}\n> +\n> +static struct tst_test test = {\n> +\t.setup = setup,\n> +\t.cleanup = cleanup,\n> +\t.test_all = run,\n> +\t.test_variants = ARRAY_SIZE(variants),\n> +\t.forks_child = 1,\n> +};","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\" (1024-bit key;\n unprotected) header.d=suse.cz header.i=@suse.cz header.a=rsa-sha256\n header.s=susede2_rsa header.b=eGLmLDHl;\n\tdkim=fail reason=\"signature verification failed\" header.d=suse.cz\n header.i=@suse.cz header.a=ed25519-sha256 header.s=susede2_ed25519\n header.b=IhDkmb16;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key)\n header.d=suse.cz header.i=@suse.cz header.a=rsa-sha256 header.s=susede2_rsa\n header.b=eGLmLDHl;\n\tdkim=neutral header.d=suse.cz header.i=@suse.cz header.a=ed25519-sha256\n header.s=susede2_ed25519 header.b=IhDkmb16;\n\tdkim-atps=neutral","legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=lists.linux.it\n (client-ip=213.254.12.146; helo=picard.linux.it;\n envelope-from=ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it;\n receiver=patchwork.ozlabs.org)","smtp-out1.suse.de;\n dkim=pass header.d=suse.cz header.s=susede2_rsa header.b=eGLmLDHl;\n dkim=pass header.d=suse.cz header.s=susede2_ed25519 header.b=IhDkmb16"],"Received":["from picard.linux.it (picard.linux.it [213.254.12.146])\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 4fwlZb3Hcfz1yCv\n\tfor <incoming@patchwork.ozlabs.org>; Thu, 16 Apr 2026 01:35:03 +1000 (AEST)","from picard.linux.it (localhost [IPv6:::1])\n\tby picard.linux.it (Postfix) with ESMTP id CDDA23C6FD7\n\tfor <incoming@patchwork.ozlabs.org>; Wed, 15 Apr 2026 17:35:00 +0200 (CEST)","from in-5.smtp.seeweb.it (in-5.smtp.seeweb.it\n [IPv6:2001:4b78:1:20::5])\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 508C63C52FE\n for <ltp@lists.linux.it>; Wed, 15 Apr 2026 17:34:57 +0200 (CEST)","from smtp-out1.suse.de (smtp-out1.suse.de\n [IPv6:2a07:de40:b251:101:10:150:64:1])\n (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest\n SHA256)\n (No client certificate requested)\n by in-5.smtp.seeweb.it (Postfix) with ESMTPS id 30F8860082D\n for <ltp@lists.linux.it>; Wed, 15 Apr 2026 17:34:55 +0200 (CEST)","from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org\n [IPv6:2a07:de40:b281:104:10:150:64:97])\n (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest\n SHA256)\n (No client certificate requested)\n by smtp-out1.suse.de (Postfix) with ESMTPS id 94D9B6A7F0;\n Wed, 15 Apr 2026 15:34:54 +0000 (UTC)","from imap1.dmz-prg2.suse.org (localhost [127.0.0.1])\n (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest\n SHA256)\n (No client certificate requested)\n by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 76E8C4BAA0;\n Wed, 15 Apr 2026 15:34:54 +0000 (UTC)","from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167])\n by imap1.dmz-prg2.suse.org with ESMTPSA id xH8KHB6w32mKYgAAD6G6ig\n (envelope-from <chrubis@suse.cz>); Wed, 15 Apr 2026 15:34:54 +0000"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz;\n s=susede2_rsa;\n t=1776267294;\n h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc:\n mime-version:mime-version:content-type:content-type:\n in-reply-to:in-reply-to:references:references;\n bh=obikUQTPwU9fz4/MWU3admDQ/0CMk/eO2zq854vxbi4=;\n b=eGLmLDHlO49deV7t95zmjRMbVYWDfmUMFQyE2WNiNn4Vt0gF5uAEYR2qIesaSbqUiv906u\n XlmC59JTK8YgRSMbKPGPyH7Yj7eDJWWr1J1AtxIBT3XOEiH8mQ7AVy7rTNBNL9Ob3njKcU\n lY4+Y05bIrIgxvefWmCyoU/oLewSj7E=","v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz;\n s=susede2_ed25519; t=1776267294;\n h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc:\n mime-version:mime-version:content-type:content-type:\n in-reply-to:in-reply-to:references:references;\n bh=obikUQTPwU9fz4/MWU3admDQ/0CMk/eO2zq854vxbi4=;\n b=IhDkmb162qnqVOI8jksYmTXr8g4k4arJSCzTiqPIGhECxZIj3Vxi3D/rYuUSimPGPMWJud\n t8nW6l2bAgSBG/CQ==","v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz;\n s=susede2_rsa;\n t=1776267294;\n h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc:\n mime-version:mime-version:content-type:content-type:\n in-reply-to:in-reply-to:references:references;\n bh=obikUQTPwU9fz4/MWU3admDQ/0CMk/eO2zq854vxbi4=;\n b=eGLmLDHlO49deV7t95zmjRMbVYWDfmUMFQyE2WNiNn4Vt0gF5uAEYR2qIesaSbqUiv906u\n XlmC59JTK8YgRSMbKPGPyH7Yj7eDJWWr1J1AtxIBT3XOEiH8mQ7AVy7rTNBNL9Ob3njKcU\n lY4+Y05bIrIgxvefWmCyoU/oLewSj7E=","v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz;\n s=susede2_ed25519; t=1776267294;\n h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc:\n mime-version:mime-version:content-type:content-type:\n in-reply-to:in-reply-to:references:references;\n bh=obikUQTPwU9fz4/MWU3admDQ/0CMk/eO2zq854vxbi4=;\n b=IhDkmb162qnqVOI8jksYmTXr8g4k4arJSCzTiqPIGhECxZIj3Vxi3D/rYuUSimPGPMWJud\n t8nW6l2bAgSBG/CQ=="],"Date":"Wed, 15 Apr 2026 17:35:08 +0200","From":"Cyril Hrubis <chrubis@suse.cz>","To":"Michael Menasherov <mmenashe@redhat.com>","Message-ID":"<ad-wLMzLBVVIvUDA@yuki.lan>","References":"<20260413134029.43754-1-mmenashe@redhat.com>","MIME-Version":"1.0","Content-Disposition":"inline","In-Reply-To":"<20260413134029.43754-1-mmenashe@redhat.com>","X-Spamd-Result":"default: False [-4.51 / 50.00]; BAYES_HAM(-3.00)[100.00%];\n NEURAL_HAM_LONG(-1.00)[-1.000];\n R_DKIM_ALLOW(-0.20)[suse.cz:s=susede2_rsa,suse.cz:s=susede2_ed25519];\n NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain];\n MX_GOOD(-0.01)[]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[];\n RCVD_TLS_ALL(0.00)[]; MISSING_XM_UA(0.00)[];\n TO_DN_SOME(0.00)[]; MIME_TRACE(0.00)[0:+];\n SPAMHAUS_XBL(0.00)[2a07:de40:b281:104:10:150:64:97:from];\n FUZZY_RATELIMITED(0.00)[rspamd.com]; RCPT_COUNT_TWO(0.00)[2];\n RBL_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:104:10:150:64:97:from];\n FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[];\n RECEIVED_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:106:10:150:64:167:received];\n RCVD_COUNT_TWO(0.00)[2]; TO_MATCH_ENVRCPT_ALL(0.00)[];\n DBL_BLOCKED_OPENRESOLVER(0.00)[imap1.dmz-prg2.suse.org:helo,imap1.dmz-prg2.suse.org:rdns];\n DKIM_SIGNED(0.00)[suse.cz:s=susede2_rsa,suse.cz:s=susede2_ed25519];\n DKIM_TRACE(0.00)[suse.cz:+]","X-Rspamd-Action":"no action","X-Spam-Score":"-4.51","X-Spam-Level":"","X-Rspamd-Server":"rspamd1.dmz-prg2.suse.org","X-Rspamd-Queue-Id":"94D9B6A7F0","X-Spam-Status":"No, score=0.1 required=7.0 tests=DKIM_SIGNED,DKIM_VALID,\n DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS shortcircuit=no\n autolearn=disabled version=4.0.1","X-Spam-Checker-Version":"SpamAssassin 4.0.1 (2024-03-25) on in-5.smtp.seeweb.it","X-Virus-Scanned":"clamav-milter 1.0.9 at in-5.smtp.seeweb.it","X-Virus-Status":"Clean","Subject":"Re: [LTP] [PATCH v2] futex: Add error coverage tests for wait,\n wake and cmp_requeue","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>"}}]