get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 2225795,
    "url": "http://patchwork.ozlabs.org/api/1.2/patches/2225795/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/ltp/patch/20260421152349.1673057-1-mcermak@redhat.com/",
    "project": {
        "id": 59,
        "url": "http://patchwork.ozlabs.org/api/1.2/projects/59/?format=api",
        "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": "<20260421152349.1673057-1-mcermak@redhat.com>",
    "list_archive_url": null,
    "date": "2026-04-21T15:23:49",
    "name": "Make userfaultfd0{1, 3, 4} LTP tests valgrind compatible",
    "commit_ref": null,
    "pull_url": null,
    "state": "needs-review-ack",
    "archived": false,
    "hash": "5d93af8f07f63d0b96a8e558589b799ef3f97a4d",
    "submitter": {
        "id": 88822,
        "url": "http://patchwork.ozlabs.org/api/1.2/people/88822/?format=api",
        "name": "Martin Cermak",
        "email": "mcermak@redhat.com"
    },
    "delegate": null,
    "mbox": "http://patchwork.ozlabs.org/project/ltp/patch/20260421152349.1673057-1-mcermak@redhat.com/mbox/",
    "series": [
        {
            "id": 500839,
            "url": "http://patchwork.ozlabs.org/api/1.2/series/500839/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/ltp/list/?series=500839",
            "date": "2026-04-21T15:23:49",
            "name": "Make userfaultfd0{1, 3, 4} LTP tests valgrind compatible",
            "version": 1,
            "mbox": "http://patchwork.ozlabs.org/series/500839/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/2225795/comments/",
    "check": "warning",
    "checks": "http://patchwork.ozlabs.org/api/patches/2225795/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=pass (1024-bit key;\n unprotected) header.d=lists.linux.it header.i=@lists.linux.it\n header.a=rsa-sha256 header.s=picard header.b=jTorpjfE;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256\n header.s=mimecast20190719 header.b=Vlrt/Tfh;\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 4g0R3q1krsz1yGs\n\tfor <incoming@patchwork.ozlabs.org>; Wed, 22 Apr 2026 01:24:39 +1000 (AEST)",
            "from picard.linux.it (localhost [IPv6:::1])\n\tby picard.linux.it (Postfix) with ESMTP id F1BEC3E4A8A\n\tfor <incoming@patchwork.ozlabs.org>; Tue, 21 Apr 2026 17:24:36 +0200 (CEST)",
            "from in-7.smtp.seeweb.it (in-7.smtp.seeweb.it\n [IPv6:2001:4b78:1:20::7])\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 DA1313C5376\n for <ltp@lists.linux.it>; Tue, 21 Apr 2026 17:24:33 +0200 (CEST)",
            "from us-smtp-delivery-124.mimecast.com\n (us-smtp-delivery-124.mimecast.com [170.10.129.124])\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-7.smtp.seeweb.it (Postfix) with ESMTPS id 3253F200B60\n for <ltp@lists.linux.it>; Tue, 21 Apr 2026 17:24:32 +0200 (CEST)",
            "from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com\n (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by\n relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3,\n cipher=TLS_AES_256_GCM_SHA384) id us-mta-663-qKpv5TBEMcWLyzEwGSc77w-1; Tue,\n 21 Apr 2026 11:24:29 -0400",
            "from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com\n (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17])\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 mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS\n id A64E119560B7; Tue, 21 Apr 2026 15:24:28 +0000 (UTC)",
            "from workstation.redhat.com (unknown [10.44.48.31])\n by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP\n id 3EC401956095; Tue, 21 Apr 2026 15:24:26 +0000 (UTC)"
        ],
        "DKIM-Signature": [
            "v=1; a=rsa-sha256; c=relaxed/simple; d=lists.linux.it;\n i=@lists.linux.it; q=dns/txt; s=picard; t=1776785077; h=to : date :\n message-id : mime-version : subject : list-id : list-unsubscribe :\n list-archive : list-post : list-help : list-subscribe : from :\n reply-to : cc : content-type : content-transfer-encoding : sender :\n from; bh=hI+2R97vKbLVbz5bKNgV4Qn6SAsApvW/UFT+7zP/Mg4=;\n b=jTorpjfEfWWughxWFOEsn1ysk6zJv63DHUWmVJGqkxO2+QT5wmOhajt8eg4HiJ+mgxPD8\n w7BEwNCa9rRgiGKd19UEb5wZm00/N96bhbCg2jG4cG9g3Cb45/BPcHurUYK7GX9HJ+kE63g\n WgFDh+hGJMAdMBOiydVwohQx8i6t/GA=",
            "v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;\n s=mimecast20190719; t=1776785071;\n h=from:from:reply-to:subject:subject:date:date:message-id:message-id:\n to:to:cc:cc:mime-version:mime-version:content-type:content-type:\n content-transfer-encoding:content-transfer-encoding;\n bh=dtkxcBkZY4zFR1j1MvEGK2uN/6eEnCfNoC5HyE95XF8=;\n b=Vlrt/Tfh6kga25g9aurmY/U04IBhnG3hSXEk1xH+pA0TV1Q1GfaM3kgbKcv9DOVrfy7nZ6\n iJL5Nar0Hq1bawHYtnvcNf7qnzymeJFnoRlljD9DC7kf1CMO0iwvnvCL7LcM4OuH0RkJc8\n cd0LEgsYR+p2agO9bRZ2WpIs8M+2IiI="
        ],
        "X-MC-Unique": "qKpv5TBEMcWLyzEwGSc77w-1",
        "X-Mimecast-MFC-AGG-ID": "qKpv5TBEMcWLyzEwGSc77w_1776785069",
        "To": "ltp@lists.linux.it",
        "Date": "Tue, 21 Apr 2026 17:23:49 +0200",
        "Message-ID": "<20260421152349.1673057-1-mcermak@redhat.com>",
        "MIME-Version": "1.0",
        "X-Scanned-By": "MIMEDefang 3.0 on 10.30.177.17",
        "X-Mimecast-Spam-Score": "0",
        "X-Mimecast-MFC-PROC-ID": "n_VkGjPEdNRvfbAqFOsaL1fgWZRvlzSWj2hS0pt-EXs_1776785069",
        "X-Mimecast-Originator": "redhat.com",
        "X-Spam-Status": "No, score=0.1 required=7.0 tests=DKIM_SIGNED,DKIM_VALID,\n DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_PASS,SPF_PASS shortcircuit=no\n autolearn=disabled version=4.0.1",
        "X-Spam-Checker-Version": "SpamAssassin 4.0.1 (2024-03-25) on in-7.smtp.seeweb.it",
        "X-Virus-Scanned": "clamav-milter 1.0.9 at in-7.smtp.seeweb.it",
        "X-Virus-Status": "Clean",
        "Subject": "[LTP] [PATCH] Make userfaultfd0{1, 3,\n 4} LTP tests valgrind compatible",
        "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>",
        "From": "Martin Cermak via ltp <ltp@lists.linux.it>",
        "Reply-To": "Martin Cermak <mcermak@redhat.com>",
        "Cc": "valgrind-developers@lists.sourceforge.net, mcermak@redhat.com",
        "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": "Historically a page fault is handled in the linux kernel. The\nuserfaultfd mechanism [1] was introduced in Linux 4.3 (2015) to allow\ncustom handling page faults in userspace. It allows for custom page\nfault handling strategies such as lazy loading, live migration of qemu\nVMs, etc.  With userfaultfd, kernel communicates with userspace via a\nfile descriptor (userfaultfd).  Userfaultfd LTP tests cover this.\n\nThese tests set up a main thread and a page fault handler thread.  Once\na page fault happens in the main thread, kernel stops it, and let's the\nhandler take care of the page fault.\n\nThis is a problem for Valgrind, because it serializes the threads\nexecution (using one \"big mutex\", VG_(acquire_BigLock)).  Once kernel\nstops the main thread, under valgrind, the handler thread doesn't have\na chance to handle the page fault.  Valgrind stalls till the timeout\n(adjustable via LTP_TIMEOUT_MUL ;)\n\nHowever, some of the testcases can be easily changed to use forked\nprocesses instead of threads.  That's what this patch does.  When\nclient program forks, Valgrind forks too, and that allows for the needed\nparallelism to handle the page fault.\n\nThis redesign can't be easily done with some of the tests, such as e.g.\nuserfaultfd02 where both the main thread and the handler thread need to\nshare the address space.  That could be done via clone() and is proven\nto work.  But unfortunately there is another Valgrind limitation in clone\nflags it supports, so this also isn't a practical way to go.\n\nThat said, this update tweaks userfaultfd01, userfaultfd03, and\nuserfaultfd04 in a way that they become \"compatible\" with Valgrind.\nIt's a test coverage improvement.\n\n[1] https://www.kernel.org/doc/html/latest/admin-guide/mm/userfaultfd.html\n---\n .../kernel/syscalls/userfaultfd/userfaultfd01.c   | 13 +++++++++----\n .../kernel/syscalls/userfaultfd/userfaultfd03.c   | 15 ++++++++++-----\n .../kernel/syscalls/userfaultfd/userfaultfd04.c   | 13 +++++++++----\n 3 files changed, 28 insertions(+), 13 deletions(-)",
    "diff": "diff --git a/testcases/kernel/syscalls/userfaultfd/userfaultfd01.c b/testcases/kernel/syscalls/userfaultfd/userfaultfd01.c\nindex 7368d3863..c927cda95 100644\n--- a/testcases/kernel/syscalls/userfaultfd/userfaultfd01.c\n+++ b/testcases/kernel/syscalls/userfaultfd/userfaultfd01.c\n@@ -57,7 +57,7 @@ static void reset_pages(void)\n \tSAFE_MUNMAP(copy_page, page_size);\n }\n \n-static void *handle_thread(void)\n+static void *pagefault_handler(void)\n {\n \tstatic struct uffd_msg msg;\n \tstruct uffdio_copy uffdio_copy = {};\n@@ -91,7 +91,7 @@ static void *handle_thread(void)\n \n static void run(unsigned int i)\n {\n-\tpthread_t thr;\n+\tpid_t pid;\n \tstruct uffdio_api uffdio_api = {};\n \tstruct uffdio_register uffdio_register;\n \tstruct tcase *tc = &tcases[i];\n@@ -112,7 +112,11 @@ static void run(unsigned int i)\n \n \tSAFE_IOCTL(uffd, UFFDIO_REGISTER, &uffdio_register);\n \n-\tSAFE_PTHREAD_CREATE(&thr, NULL, (void *) handle_thread, NULL);\n+\tpid = SAFE_FORK();\n+\tif (pid == 0) {\n+\t\tpagefault_handler();\n+\t\t_exit(0);\n+\t}\n \n \tchar c = page[0xf];\n \n@@ -121,7 +125,7 @@ static void run(unsigned int i)\n \telse\n \t\ttst_res(TFAIL, \"Pagefault not handled!\");\n \n-\tSAFE_PTHREAD_JOIN(thr, NULL);\n+\tSAFE_WAITPID(pid, NULL, 0);\n \treset_pages();\n }\n \n@@ -129,4 +133,5 @@ static struct tst_test test = {\n \t.setup = setup,\n \t.test = run,\n \t.tcnt = ARRAY_SIZE(tcases),\n+\t.forks_child = 1,\n };\ndiff --git a/testcases/kernel/syscalls/userfaultfd/userfaultfd03.c b/testcases/kernel/syscalls/userfaultfd/userfaultfd03.c\nindex b65f39eca..f5d3be1ae 100644\n--- a/testcases/kernel/syscalls/userfaultfd/userfaultfd03.c\n+++ b/testcases/kernel/syscalls/userfaultfd/userfaultfd03.c\n@@ -61,7 +61,7 @@ static void reset_pages(void)\n \tSAFE_MUNMAP(copy_page, page_size);\n }\n \n-static void *handle_thread(void)\n+static void *pagefault_handler(void)\n {\n \tstatic struct uffd_msg msg;\n \tstruct uffdio_copy uffdio_copy = {};\n@@ -95,7 +95,7 @@ static void *handle_thread(void)\n \n static void run(void)\n {\n-\tpthread_t thr;\n+\tpid_t pid;\n \tstruct uffdio_api uffdio_api = {};\n \tstruct uffdio_register uffdio_register;\n \n@@ -112,7 +112,11 @@ static void run(void)\n \n \tSAFE_IOCTL(uffd, UFFDIO_REGISTER, &uffdio_register);\n \n-\tSAFE_PTHREAD_CREATE(&thr, NULL, (void *) handle_thread, NULL);\n+\tpid = SAFE_FORK();\n+\t\tif (pid == 0) {\n+\t\tpagefault_handler();\n+\t\t_exit(0);\n+\t}\n \n \tchar c = page[0xf];\n \n@@ -121,7 +125,7 @@ static void run(void)\n \telse\n \t\ttst_res(TFAIL, \"Pagefault not handled via /dev/userfaultfd\");\n \n-\tSAFE_PTHREAD_JOIN(thr, NULL);\n+\tSAFE_WAITPID(pid, NULL, 0);\n \treset_pages();\n }\n \n@@ -132,5 +136,6 @@ static struct tst_test test = {\n \t.needs_kconfigs = (const char *[]) {\n \t\t\"CONFIG_USERFAULTFD=y\",\n \t\tNULL\n-\t}\n+\t},\n+\t.forks_child = 1,\n };\ndiff --git a/testcases/kernel/syscalls/userfaultfd/userfaultfd04.c b/testcases/kernel/syscalls/userfaultfd/userfaultfd04.c\nindex 4eb811e45..13883a711 100644\n--- a/testcases/kernel/syscalls/userfaultfd/userfaultfd04.c\n+++ b/testcases/kernel/syscalls/userfaultfd/userfaultfd04.c\n@@ -33,7 +33,7 @@ static void reset_pages(void)\n \tSAFE_MUNMAP(page, page_size);\n }\n \n-static void *handle_thread(void)\n+static void *pagefault_handler(void)\n {\n \tstatic struct uffd_msg msg;\n \tstruct uffdio_zeropage uffdio_zeropage = {};\n@@ -64,7 +64,7 @@ static void *handle_thread(void)\n \n static void run(void)\n {\n-\tpthread_t thr;\n+\tpid_t pid;\n \tstruct uffdio_api uffdio_api = {};\n \tstruct uffdio_register uffdio_register;\n \n@@ -81,7 +81,11 @@ static void run(void)\n \n \tSAFE_IOCTL(uffd, UFFDIO_REGISTER, &uffdio_register);\n \n-\tSAFE_PTHREAD_CREATE(&thr, NULL, (void *) handle_thread, NULL);\n+\tpid = SAFE_FORK();\n+\tif (pid == 0) {\n+\t\tpagefault_handler();\n+\t\t_exit(0);\n+\t}\n \n \tfor (int i = 0; i < page_size; i++) {\n \t\tif (page[i] != 0) {\n@@ -92,10 +96,11 @@ static void run(void)\n \n \ttst_res(TPASS, \"Pagefault handled with UFFDIO_ZEROPAGE\");\n \n-\tSAFE_PTHREAD_JOIN(thr, NULL);\n+\tSAFE_WAITPID(pid, NULL, 0);\n \treset_pages();\n }\n \n static struct tst_test test = {\n \t.test_all = run,\n+\t.forks_child = 1,\n };\n",
    "prefixes": []
}