Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/2218305/?format=api
{ "id": 2218305, "url": "http://patchwork.ozlabs.org/api/patches/2218305/?format=api", "web_url": "http://patchwork.ozlabs.org/project/ltp/patch/20260331220354.297027-1-rbranco@suse.de/", "project": { "id": 59, "url": "http://patchwork.ozlabs.org/api/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": "<20260331220354.297027-1-rbranco@suse.de>", "list_archive_url": null, "date": "2026-03-31T22:03:53", "name": "[v3] userfaultfd: Add new test using UFFDIO_CONTINUE", "commit_ref": null, "pull_url": null, "state": "needs-review-ack", "archived": false, "hash": "fce8874dd03041f98cc6866639131420c1e0414d", "submitter": { "id": 92484, "url": "http://patchwork.ozlabs.org/api/people/92484/?format=api", "name": "Ricardo Branco", "email": "rbranco@suse.de" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/ltp/patch/20260331220354.297027-1-rbranco@suse.de/mbox/", "series": [ { "id": 498257, "url": "http://patchwork.ozlabs.org/api/series/498257/?format=api", "web_url": "http://patchwork.ozlabs.org/project/ltp/list/?series=498257", "date": "2026-03-31T22:03:53", "name": "[v3] userfaultfd: Add new test using UFFDIO_CONTINUE", "version": 3, "mbox": "http://patchwork.ozlabs.org/series/498257/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/2218305/comments/", "check": "fail", "checks": "http://patchwork.ozlabs.org/api/patches/2218305/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\" (1024-bit key;\n unprotected) header.d=suse.de header.i=@suse.de header.a=rsa-sha256\n header.s=susede2_rsa header.b=ZQvYq7mu;\n\tdkim=fail reason=\"signature verification failed\" header.d=suse.de\n header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519\n header.b=esvZVzxD;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key)\n header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa\n header.b=mqC1jp4s;\n\tdkim=neutral header.d=suse.de header.i=@suse.de header.a=ed25519-sha256\n header.s=susede2_ed25519 header.b=aRgy7sRf;\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)", "smtp-out2.suse.de;\n\tnone" ], "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 4flhwS4s5bz1yFv\n\tfor <incoming@patchwork.ozlabs.org>; Wed, 01 Apr 2026 09:04:05 +1100 (AEDT)", "from picard.linux.it (localhost [IPv6:::1])\n\tby picard.linux.it (Postfix) with ESMTP id D95293E5C15\n\tfor <incoming@patchwork.ozlabs.org>; Wed, 1 Apr 2026 00:04:02 +0200 (CEST)", "from in-7.smtp.seeweb.it (in-7.smtp.seeweb.it [217.194.8.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 B83013C9314\n for <ltp@lists.linux.it>; Wed, 1 Apr 2026 00:03:59 +0200 (CEST)", "from smtp-out2.suse.de (smtp-out2.suse.de [195.135.223.131])\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 2C119200758\n for <ltp@lists.linux.it>; Wed, 1 Apr 2026 00:03:58 +0200 (CEST)", "from imap1.dmz-prg2.suse.org (unknown [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-out2.suse.de (Postfix) with ESMTPS id 6055E5BD35;\n Tue, 31 Mar 2026 22:03:57 +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 3DE944A0A2;\n Tue, 31 Mar 2026 22:03:57 +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 QitbDc1EzGnXagAAD6G6ig\n (envelope-from <rbranco@suse.de>); Tue, 31 Mar 2026 22:03:57 +0000" ], "DKIM-Signature": [ "v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de;\n s=susede2_rsa;\n t=1774994638;\n h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc:\n mime-version:mime-version:\n content-transfer-encoding:content-transfer-encoding;\n bh=wgBw0PE5P5lWlIZh/iILgV1TIfWKVlTRbcyS5ZhweUM=;\n b=ZQvYq7mu3AGIy/4NBn2prHwoVhL2D8ZJ30TDN05/f500EK7DSSF1KvuiodXGuHKHqx6BTq\n RRMGk5YX0kdhir70rm4uNNRfLsYCLRbmog1Jzkxoc3eeXRJZuWpyVwFG1x2825y/abjJuu\n 7i1spJAGNsFow3DsdxpxqHnz61p2k40=", "v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de;\n s=susede2_ed25519; t=1774994638;\n h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc:\n mime-version:mime-version:\n content-transfer-encoding:content-transfer-encoding;\n bh=wgBw0PE5P5lWlIZh/iILgV1TIfWKVlTRbcyS5ZhweUM=;\n b=esvZVzxDIEHVzYG8pPk2eqWE0JMTVriyzpdtpv+eiQfELb9kcwfipI2AbqPI2V38tzy1LQ\n Mui+J06zTVC8UNCQ==", "v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de;\n s=susede2_rsa;\n t=1774994637;\n h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc:\n mime-version:mime-version:\n content-transfer-encoding:content-transfer-encoding;\n bh=wgBw0PE5P5lWlIZh/iILgV1TIfWKVlTRbcyS5ZhweUM=;\n b=mqC1jp4sG8hoYxCCTD7k6dG7UhBGTq1adNzFGc3zYU+4IvYXW8CnXENkYIJwLezHl6+nVP\n QVtEMQeAPH7ueyWbNx9Nr3sBARcLIHyYEkM5JxM0FkPxRZxTz52ulP86rq9IGlcguLEuTp\n kDGSFoXHn1qxin+RTzuotFyBMmSDAyc=", "v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de;\n s=susede2_ed25519; t=1774994637;\n h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc:\n mime-version:mime-version:\n content-transfer-encoding:content-transfer-encoding;\n bh=wgBw0PE5P5lWlIZh/iILgV1TIfWKVlTRbcyS5ZhweUM=;\n b=aRgy7sRfD5NK27+SAPu0zC73rWzQQar6CzT222c9gfHuAsU+L95stFRRea9LhxoC2IcQC2\n KdHHrNp1q+LqmKDg==" ], "From": "Ricardo Branco <rbranco@suse.de>", "To": "ltp@lists.linux.it", "Date": "Wed, 1 Apr 2026 00:03:53 +0200", "Message-ID": "<20260331220354.297027-1-rbranco@suse.de>", "X-Mailer": "git-send-email 2.53.0", "MIME-Version": "1.0", "X-Spam-Score": "-2.80", "X-Spam-Level": "", "X-Spamd-Result": "default: False [-2.80 / 50.00]; BAYES_HAM(-3.00)[100.00%];\n NEURAL_HAM_LONG(-1.00)[-1.000]; MID_CONTAINS_FROM(1.00)[];\n R_MISSING_CHARSET(0.50)[]; NEURAL_HAM_SHORT(-0.20)[-0.995];\n MIME_GOOD(-0.10)[text/plain]; TO_MATCH_ENVRCPT_ALL(0.00)[];\n ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[];\n FROM_HAS_DN(0.00)[]; MIME_TRACE(0.00)[0:+];\n DBL_BLOCKED_OPENRESOLVER(0.00)[suse.com:email,imap1.dmz-prg2.suse.org:helo,suse.de:mid,suse.de:email,pollfd.events:url];\n FUZZY_RATELIMITED(0.00)[rspamd.com]; RCPT_COUNT_TWO(0.00)[2];\n RCVD_COUNT_TWO(0.00)[2]; FROM_EQ_ENVFROM(0.00)[];\n DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519];\n TO_DN_SOME(0.00)[]; RCVD_TLS_ALL(0.00)[]", "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-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 v3] userfaultfd: Add new test using UFFDIO_CONTINUE", "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>", "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": "Add test to exercise UFFDIO_CONTINUE on a shared-memory mapping with\nUFFD_PAGEFAULT_FLAG_MINOR. The test populates a memfd-backed page,\ndrops only the PTEs with MADV_DONTNEED, verifies that the resulting\nfault is reported as MINOR, updates the page cache from the handler\nthread, and resumes execution with UFFDIO_CONTINUE.\n\nSigned-off-by: Ricardo Branco <rbranco@suse.de>\n---\n include/lapi/userfaultfd.h | 1 +\n runtest/syscalls | 1 +\n .../kernel/syscalls/userfaultfd/.gitignore | 1 +\n .../kernel/syscalls/userfaultfd/Makefile | 1 +\n .../syscalls/userfaultfd/userfaultfd07.c | 152 ++++++++++++++++++\n 5 files changed, 156 insertions(+)\n create mode 100644 testcases/kernel/syscalls/userfaultfd/userfaultfd07.c", "diff": "diff --git a/include/lapi/userfaultfd.h b/include/lapi/userfaultfd.h\nindex aab3890b7..c05b8dbf5 100644\n--- a/include/lapi/userfaultfd.h\n+++ b/include/lapi/userfaultfd.h\n@@ -171,6 +171,7 @@ struct uffdio_zeropage {\n #ifndef UFFD_PAGEFAULT_FLAG_MINOR\n #define UFFD_FEATURE_MINOR_HUGETLBFS\t\t(1<<9)\n #define UFFDIO_REGISTER_MODE_MINOR\t((__u64)1<<2)\n+#define UFFD_PAGEFAULT_FLAG_MINOR\t(1<<2)\n \n #define _UFFDIO_CONTINUE\t\t(0x07)\n #define UFFDIO_CONTINUE\t\t_IOWR(UFFDIO, _UFFDIO_CONTINUE,\t\\\ndiff --git a/runtest/syscalls b/runtest/syscalls\nindex 6ba0227a8..534140f42 100644\n--- a/runtest/syscalls\n+++ b/runtest/syscalls\n@@ -1780,6 +1780,7 @@ userfaultfd03 userfaultfd03\n userfaultfd04 userfaultfd04\n userfaultfd05 userfaultfd05\n userfaultfd06 userfaultfd06\n+userfaultfd07 userfaultfd07\n \n ustat01 ustat01\n ustat02 ustat02\ndiff --git a/testcases/kernel/syscalls/userfaultfd/.gitignore b/testcases/kernel/syscalls/userfaultfd/.gitignore\nindex bc32fdf3b..3478a162e 100644\n--- a/testcases/kernel/syscalls/userfaultfd/.gitignore\n+++ b/testcases/kernel/syscalls/userfaultfd/.gitignore\n@@ -4,3 +4,4 @@\n /userfaultfd04\n /userfaultfd05\n /userfaultfd06\n+/userfaultfd07\ndiff --git a/testcases/kernel/syscalls/userfaultfd/Makefile b/testcases/kernel/syscalls/userfaultfd/Makefile\nindex 3252e47df..257249e88 100644\n--- a/testcases/kernel/syscalls/userfaultfd/Makefile\n+++ b/testcases/kernel/syscalls/userfaultfd/Makefile\n@@ -17,3 +17,4 @@ userfaultfd03: CFLAGS += -pthread\n userfaultfd04: CFLAGS += -pthread\n userfaultfd05: CFLAGS += -pthread\n userfaultfd06: CFLAGS += -pthread\n+userfaultfd07: CFLAGS += -pthread\ndiff --git a/testcases/kernel/syscalls/userfaultfd/userfaultfd07.c b/testcases/kernel/syscalls/userfaultfd/userfaultfd07.c\nnew file mode 100644\nindex 000000000..9d37589e8\n--- /dev/null\n+++ b/testcases/kernel/syscalls/userfaultfd/userfaultfd07.c\n@@ -0,0 +1,152 @@\n+// SPDX-License-Identifier: GPL-2.0-or-later\n+/*\n+ * Copyright (c) 2026 SUSE LLC\n+ * Author: Ricardo Branco <rbranco@suse.com>\n+ */\n+\n+/*\\\n+ * Force a pagefault event and handle it using :manpage:`userfaultfd(2)`\n+ * from a different thread testing UFFDIO_CONTINUE.\n+ */\n+\n+#include \"config.h\"\n+#include <poll.h>\n+#include <unistd.h>\n+#include \"tst_test.h\"\n+#include \"tst_safe_macros.h\"\n+#include \"tst_safe_prw.h\"\n+#include \"tst_safe_pthread.h\"\n+#include \"lapi/memfd.h\"\n+#include \"lapi/userfaultfd.h\"\n+#include \"lapi/syscalls.h\"\n+\n+static long page_size;\n+static char *page;\n+static int uffd = -1;\n+static int memfd = -1;\n+\n+static void set_pages(void)\n+{\n+\tchar ch = 'A';\n+\n+\tpage_size = SAFE_SYSCONF(_SC_PAGE_SIZE);\n+\n+\tmemfd = sys_memfd_create(\"ltp-uffd-continue\", MFD_CLOEXEC);\n+\tif (memfd < 0)\n+\t\ttst_brk(TBROK | TERRNO, \"memfd_create failed\");\n+\n+\tSAFE_FTRUNCATE(memfd, page_size);\n+\n+\t/*\n+\t * Populate page cache so that after MADV_DONTNEED the next access\n+\t * can generate a MINOR fault rather than a MISSING fault.\n+\t */\n+\tSAFE_PWRITE(1, memfd, &ch, 1, 0);\n+\n+\tpage = SAFE_MMAP(NULL, page_size, PROT_READ, MAP_SHARED, memfd, 0);\n+}\n+\n+static void reset_pages(void)\n+{\n+\tif (page) {\n+\t\tSAFE_MUNMAP(page, page_size);\n+\t\tpage = NULL;\n+\t}\n+\n+\tif (memfd != -1)\n+\t\tmemfd = -1;\n+\n+\tif (uffd != -1)\n+\t\tSAFE_CLOSE(uffd);\n+}\n+\n+static void *handle_thread(void *arg LTP_ATTRIBUTE_UNUSED)\n+{\n+\tstatic struct uffd_msg msg;\n+\tstruct uffdio_continue uffdio_continue = {};\n+\tstruct pollfd pollfd;\n+\tint nready;\n+\tchar z = 'Z';\n+\n+\tpollfd.fd = uffd;\n+\tpollfd.events = POLLIN;\n+\tnready = poll(&pollfd, 1, -1);\n+\tif (nready == -1)\n+\t\ttst_brk(TBROK | TERRNO, \"Error on poll\");\n+\n+\tSAFE_READ(1, uffd, &msg, sizeof(msg));\n+\n+\tif (msg.event != UFFD_EVENT_PAGEFAULT)\n+\t\ttst_brk(TFAIL, \"Received unexpected UFFD_EVENT %d\", msg.event);\n+\n+\tif (!(msg.arg.pagefault.flags & UFFD_PAGEFAULT_FLAG_MINOR)) {\n+\t\ttst_brk(TBROK, \"expected MINOR fault, got flags=0x%llx\",\n+\t\t\t(unsigned long long)msg.arg.pagefault.flags);\n+\t}\n+\n+\t/* Update the shmem page in page cache before resuming the fault. */\n+\tSAFE_PWRITE(1, memfd, &z, 1, 0);\n+\n+\tuffdio_continue.range.start =\n+\t\tmsg.arg.pagefault.address & ~((unsigned long)page_size - 1);\n+\tuffdio_continue.range.len = page_size;\n+\n+\tSAFE_IOCTL(uffd, UFFDIO_CONTINUE, &uffdio_continue);\n+\n+\tSAFE_CLOSE(uffd);\n+\treturn NULL;\n+}\n+\n+static void run(void)\n+{\n+\tpthread_t thr;\n+\tstruct uffdio_api uffdio_api = {};\n+\tstruct uffdio_register uffdio_register;\n+\n+\tset_pages();\n+\n+\tuffd = SAFE_USERFAULTFD(O_CLOEXEC | O_NONBLOCK, true);\n+\n+\tuffdio_api.api = UFFD_API;\n+\tuffdio_api.features = UFFD_FEATURE_MINOR_SHMEM;\n+\n+\tSAFE_IOCTL(uffd, UFFDIO_API, &uffdio_api);\n+\n+\tif (!(uffdio_api.features & UFFD_FEATURE_MINOR_SHMEM))\n+\t\ttst_brk(TCONF, \"UFFD_FEATURE_MINOR_SHMEM not supported\");\n+\n+\tuffdio_register.range.start = (unsigned long) page;\n+\tuffdio_register.range.len = page_size;\n+\tuffdio_register.mode = UFFDIO_REGISTER_MODE_MINOR;\n+\n+\tSAFE_IOCTL(uffd, UFFDIO_REGISTER, &uffdio_register);\n+\n+\t/*\n+\t * Drop PTEs while retaining the cached shmem page so the next access\n+\t * faults in MINOR mode.\n+\t */\n+\tif (madvise(page, page_size, MADV_DONTNEED) < 0)\n+\t\ttst_brk(TBROK | TERRNO, \"madvise MADV_DONTNEED failed\");\n+\n+\tSAFE_PTHREAD_CREATE(&thr, NULL, (void *) handle_thread, NULL);\n+\n+\tchar c = page[0];\n+\n+\tif (c == 'Z')\n+\t\ttst_res(TPASS, \"Pagefault handled via UFFDIO_CONTINUE\");\n+\telse\n+\t\ttst_res(TFAIL, \"pagefault not handled via UFFDIO_CONTINUE, got '%c'\", c);\n+\n+\tSAFE_PTHREAD_JOIN(thr, NULL);\n+\treset_pages();\n+}\n+\n+static struct tst_test test = {\n+\t.test_all = run,\n+\t/*\n+\t * UFFDIO_CONTINUE is available since 5.13 but\n+\t * UFFD_FEATURE_MINOR_SHMEM appeared in 5.14\n+\t */\n+\t.min_kver = \"5.14\",\n+\t.cleanup = reset_pages,\n+};\n", "prefixes": [ "v3" ] }