get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 2226025,
    "url": "http://patchwork.ozlabs.org/api/1.2/patches/2226025/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/ltp/patch/20260422023115.27534-1-wegao@suse.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": "<20260422023115.27534-1-wegao@suse.com>",
    "list_archive_url": null,
    "date": "2026-04-22T02:30:59",
    "name": "[v9] mremap07.c: New test for mremap() with MREMAP_DONTUNMAP",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "8de0b79666e1575cebf9112e4eb46165cdc9f450",
    "submitter": {
        "id": 85577,
        "url": "http://patchwork.ozlabs.org/api/1.2/people/85577/?format=api",
        "name": "Wei Gao",
        "email": "wegao@suse.com"
    },
    "delegate": null,
    "mbox": "http://patchwork.ozlabs.org/project/ltp/patch/20260422023115.27534-1-wegao@suse.com/mbox/",
    "series": [
        {
            "id": 500913,
            "url": "http://patchwork.ozlabs.org/api/1.2/series/500913/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/ltp/list/?series=500913",
            "date": "2026-04-22T02:30:59",
            "name": "[v9] mremap07.c: New test for mremap() with MREMAP_DONTUNMAP",
            "version": 9,
            "mbox": "http://patchwork.ozlabs.org/series/500913/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/2226025/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/2226025/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=NFfckL2y;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n unprotected) header.d=suse.com header.i=@suse.com header.a=rsa-sha256\n header.s=google header.b=VCkGskWk;\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 4g0jsJ5kBPz1y2d\n\tfor <incoming@patchwork.ozlabs.org>; Wed, 22 Apr 2026 12:31:30 +1000 (AEST)",
            "from picard.linux.it (localhost [IPv6:::1])\n\tby picard.linux.it (Postfix) with ESMTP id 2D9BC3E4832\n\tfor <incoming@patchwork.ozlabs.org>; Wed, 22 Apr 2026 04:31:27 +0200 (CEST)",
            "from in-4.smtp.seeweb.it (in-4.smtp.seeweb.it\n [IPv6:2001:4b78:1:20::4])\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 65FD93E1DD1\n for <ltp@lists.linux.it>; Wed, 22 Apr 2026 04:31:20 +0200 (CEST)",
            "from mail-wm1-x336.google.com (mail-wm1-x336.google.com\n [IPv6:2a00:1450:4864:20::336])\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-4.smtp.seeweb.it (Postfix) with ESMTPS id 941DF10000C8\n for <ltp@lists.linux.it>; Wed, 22 Apr 2026 04:31:19 +0200 (CEST)",
            "by mail-wm1-x336.google.com with SMTP id\n 5b1f17b1804b1-488af9fdaa7so30705625e9.1\n for <ltp@lists.linux.it>; Tue, 21 Apr 2026 19:31:19 -0700 (PDT)",
            "from localhost ([2a07:de40:b240:0:2ad6:ed42:2ad6:ed42])\n by smtp.gmail.com with UTF8SMTPSA id\n 5b1f17b1804b1-488fc1393f5sm385782145e9.9.2026.04.21.19.31.18\n (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n Tue, 21 Apr 2026 19:31:18 -0700 (PDT)"
        ],
        "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=1776825087; h=to : date :\n message-id : in-reply-to : references : mime-version : subject :\n list-id : list-unsubscribe : list-archive : list-post : list-help :\n list-subscribe : from : reply-to : content-type :\n content-transfer-encoding : sender : from;\n bh=QNYJeuZWjRZWOzr+6u1uUnt63DqJQwSTmG+hgdzLOHQ=;\n b=NFfckL2y1Bhc2wZzpqRer2sLl7zE1WRXW8cZkB7jnXR0rHjoPFYNlBYIjAlqtJXJaaY7E\n ZXEFRsfXTF2ejgd8Cyzt0B0hrMAtWXhoPNb39vuIDzJDj0cQQjfQlojMrWqbpQUrMAFJOHs\n KbbOua62arpHCZvFYThC29iXDr5HRjE=",
            "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=suse.com; s=google; t=1776825079; x=1777429879; 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=Wh9g/eFpyClu+URyxsQhLkM6pC165eUMQ//eqGZR2yo=;\n b=VCkGskWkdw/3HJcepSvnLEZJjeehTT6v7XfPm+Uuo7XnsMBztKTUuTsZ8Jqc+rorf8\n M3jqsTb0pJ3xaPxbwQT9MYtZHCwaCxPiojC0H6GQUBo+0qhWEBdEcUTOYdI/b6EMEqD8\n ZYHHbEN67NNl1+HiXFVIv2Bos5txCnha4Ym98d9rOlMr3ro/wQ1xAV3huT2xwp2tDKqu\n kBiN2nyrzSo1cVbuLslKclGUdEJtMjxbI69iDXV3uZyVfcd5YWls047sTN7MptsSLGEV\n rOKF7Fp2lvoHdv17kklCjKoqVdOExte+H0oJesPHX6bQSyVpm0BE/Q5pEg/cYhYY9bOL\n 6POg=="
        ],
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20251104; t=1776825079; x=1777429879;\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=Wh9g/eFpyClu+URyxsQhLkM6pC165eUMQ//eqGZR2yo=;\n b=RlhTJY6zwjbaCAP7A4KrbVgs+YAFTFTXBj38Vbx+eo/qnryMoM+77KH+91NlU5bW82\n dlL7NFd4rYd41sy7PD/Hui6wArVj8VEYKPZbtpeQcqvCm2sYrarmZ9eGlqw+AzB1SJMy\n SJRFtPlqOvSuJOIEoqHzr1+caSoYwLI5tGl8FIDEChdsmMi+yya13qGSr6vxFnl/Aw5t\n QAoH7+rwZUzmj5mRrm14waB5KgzOBP3p3VC8Re9kmHt/cjtgL/pLSXHcDsG+I452wjfb\n sXJcct8dgQA23Dzt2UXobQbxT9t0UE0xfY4SbXBd15U2X3BKB7hbsxat13lzXLkUq93s\n OgYQ==",
        "X-Gm-Message-State": "AOJu0YzoodB0EnKIBpJvHuIxHPGNO5wK4XQ3tvmWIGXaHDcXKh89k5UE\n kEaCgJf/6xvn4bf8uBtGRK0ifkCmQVkUR5kKEb1FlMShHCX8yJg5QL9CmyDzMh1DOuQv73aWc88\n GFi4=",
        "X-Gm-Gg": "AeBDiesomNLWKpIJR9kkwXCGLxK+8H9a/uwZMNV1MC4hsNHW8wLqvc3xouxyqQ1gW2N\n I5on+UCdzKDf0a5Ou/39ddVCFII4VOAolJF3D8nCKX4OujSjBVXf4d+zsEBJDVSc9Nywsixncgn\n 9qMt6xqTxvJNz8srHT0OEEPFfu4xY//jnwauyCoTOhjzgjOgXLkJ0NV9FRzR/N3gnbve4Sfhk2q\n 5pRH8FM4igikhX+qv/4P+DSv6hvI8Pa/Mu6wQkAG1GvBwX5+FxolMHN76pDcM1MOItnT5QPj+3/\n lqJiWdI76HOOHUpyYCQOEELG0WUGxvhW0xBY253lxVZjsMm2ftl4G3dPZTKOKgZVuzkVcqCvp5+\n Zcam1swMP4vDng8vMggO1LNIWKC2B3/YnNRobg0dVW5FsZ+bCGxNennGTZ3diuLCUilAh4xjcH1\n dorNANEoAFstqNBrjSfBX43w==",
        "X-Received": "by 2002:a05:600d:8451:b0:48a:599a:36fe with SMTP id\n 5b1f17b1804b1-48a599a4413mr16113895e9.24.1776825078670;\n Tue, 21 Apr 2026 19:31:18 -0700 (PDT)",
        "To": "ltp@lists.linux.it",
        "Date": "Wed, 22 Apr 2026 02:30:59 +0000",
        "Message-ID": "<20260422023115.27534-1-wegao@suse.com>",
        "X-Mailer": "git-send-email 2.43.0",
        "In-Reply-To": "<20260417122804.23890-1-wegao@suse.com>",
        "References": "<20260417122804.23890-1-wegao@suse.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,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-4.smtp.seeweb.it",
        "X-Virus-Scanned": "clamav-milter 1.0.9 at in-4.smtp.seeweb.it",
        "X-Virus-Status": "Clean",
        "Subject": "[LTP] [PATCH v9] mremap07.c: New test for mremap() with\n MREMAP_DONTUNMAP",
        "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": "Wei Gao via ltp <ltp@lists.linux.it>",
        "Reply-To": "Wei Gao <wegao@suse.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": "This test verifies the mremap() syscall with the MREMAP_DONTUNMAP flag.\nIt uses userfaultfd to verify that accessing the old memory region\ncorrectly triggers a page fault after the mapping has been moved.\n\nMREMAP_DONTUNMAP behavior with userfaultfd was not covered by existing\nmremap tests. This test provides coverage for the feature requested in\nthe linked issue.\n\nCloses: https://github.com/linux-test-project/ltp/issues/1168\nSigned-off-by: Wei Gao <wegao@suse.com>\n---\nv8->v9:\n- Removed `MREMAP_DONTUNMAP` check from `configure.ac` and moved fallback to `include/lapi/mmap.h`.\n- Renamed address variables to `old_addr` and `new_addr` for clarity.\n- Replaced hardcoded strings with `TEST_STRING_A` and `TEST_STRING_B` macros.\n- Improved code formatting and indentation.\n- Removed `.min_kver = \"5.7\"` in favor of dynamic feature detection.\n- Added runtime `EINVAL` check to trigger `TCONF` on unsupported kernels.\n- Added verification logic for data content at `new_addr`.\n- Fixed stability issues for multiple test iterations (`-i` option).\n\n include/lapi/mmap.h                         |   4 +\n runtest/syscalls                            |   1 +\n testcases/kernel/syscalls/mremap/.gitignore |   1 +\n testcases/kernel/syscalls/mremap/Makefile   |   1 +\n testcases/kernel/syscalls/mremap/mremap07.c | 164 ++++++++++++++++++++\n 5 files changed, 171 insertions(+)\n create mode 100644 testcases/kernel/syscalls/mremap/mremap07.c",
    "diff": "diff --git a/include/lapi/mmap.h b/include/lapi/mmap.h\nindex 248b64564..3908310f4 100644\n--- a/include/lapi/mmap.h\n+++ b/include/lapi/mmap.h\n@@ -91,6 +91,10 @@\n # define MAP_DROPPABLE 0x08\n #endif\n \n+#ifndef MREMAP_DONTUNMAP\n+# define MREMAP_DONTUNMAP 4\n+#endif\n+\n #ifndef MAP_FIXED_NOREPLACE\n \n #ifdef __alpha__\ndiff --git a/runtest/syscalls b/runtest/syscalls\nindex 5025b259f..df5dc02b5 100644\n--- a/runtest/syscalls\n+++ b/runtest/syscalls\n@@ -927,6 +927,7 @@ mremap03 mremap03\n mremap04 mremap04\n mremap05 mremap05\n mremap06 mremap06\n+mremap07 mremap07\n \n mseal01 mseal01\n mseal02 mseal02\ndiff --git a/testcases/kernel/syscalls/mremap/.gitignore b/testcases/kernel/syscalls/mremap/.gitignore\nindex ec15a19cd..292899e03 100644\n--- a/testcases/kernel/syscalls/mremap/.gitignore\n+++ b/testcases/kernel/syscalls/mremap/.gitignore\n@@ -4,3 +4,4 @@\n /mremap04\n /mremap05\n /mremap06\n+/mremap07\ndiff --git a/testcases/kernel/syscalls/mremap/Makefile b/testcases/kernel/syscalls/mremap/Makefile\nindex 9f5aca9ec..8811b887e 100644\n--- a/testcases/kernel/syscalls/mremap/Makefile\n+++ b/testcases/kernel/syscalls/mremap/Makefile\n@@ -8,5 +8,6 @@ LTPLIBS = ipc\n include $(top_srcdir)/include/mk/testcases.mk\n \n mremap04: LTPLDLIBS  = -lltpipc\n+mremap07: LDLIBS  += -lpthread\n \n include $(top_srcdir)/include/mk/generic_leaf_target.mk\ndiff --git a/testcases/kernel/syscalls/mremap/mremap07.c b/testcases/kernel/syscalls/mremap/mremap07.c\nnew file mode 100644\nindex 000000000..ecd8319f9\n--- /dev/null\n+++ b/testcases/kernel/syscalls/mremap/mremap07.c\n@@ -0,0 +1,164 @@\n+// SPDX-License-Identifier: GPL-2.0-or-later\n+/*\n+ * Copyright (c) 2026 Wei Gao <wegao@suse.com>\n+ */\n+\n+/*\\\n+ * LTP test case for mremap() with MREMAP_DONTUNMAP and userfaultfd.\n+ *\n+ * Test mremap() with MREMAP_DONTUNMAP and verify that accessing the\n+ * old memory region triggers a page fault, which is then correctly\n+ * handled by a userfaultfd handler.\n+ */\n+\n+#define _GNU_SOURCE\n+#include <poll.h>\n+#include <pthread.h>\n+\n+#include \"tst_test.h\"\n+#include \"tst_safe_pthread.h\"\n+#include \"lapi/userfaultfd.h\"\n+#include \"lapi/mmap.h\"\n+#include \"config.h\"\n+\n+static int page_size;\n+static int uffd = -1;\n+static char *old_addr;\n+static char *new_addr;\n+\n+#define TEST_STRING_A \"ABCD\"\n+#define TEST_STRING_B \"EFGH\"\n+\n+static void *fault_handler_thread(void *arg LTP_ATTRIBUTE_UNUSED)\n+{\n+\tstruct uffd_msg msg;\n+\tstruct uffdio_copy uffdio_copy;\n+\n+\tTST_CHECKPOINT_WAIT(0);\n+\n+\tstruct pollfd pollfd;\n+\n+\tpollfd.fd = uffd;\n+\tpollfd.events = POLLIN;\n+\n+\tint nready = poll(&pollfd, 1, -1);\n+\n+\tif (nready == -1)\n+\t\ttst_brk(TBROK | TERRNO, \"poll() failed\");\n+\n+\tif (nready == 0)\n+\t\ttst_brk(TBROK, \"poll() timed out unexpectedly\");\n+\n+\tSAFE_READ(1, uffd, &msg, sizeof(msg));\n+\n+\tif (msg.event != UFFD_EVENT_PAGEFAULT)\n+\t\ttst_brk(TBROK, \"Received unexpected UFFD_EVENT: %d\", msg.event);\n+\n+\tif ((char *)msg.arg.pagefault.address != old_addr)\n+\t\ttst_brk(TBROK, \"Page fault on unexpected address: %p\",\n+\t\t\t(void *)msg.arg.pagefault.address);\n+\n+\ttst_res(TINFO, \"Userfaultfd handler caught a page fault at %p\",\n+\t\t(void *)msg.arg.pagefault.address);\n+\n+\tuffdio_copy.src = (unsigned long)new_addr;\n+\tuffdio_copy.dst = (unsigned long)old_addr;\n+\tuffdio_copy.len = page_size;\n+\tuffdio_copy.mode = 0;\n+\tuffdio_copy.copy = 0;\n+\n+\tSAFE_IOCTL(uffd, UFFDIO_COPY, &uffdio_copy);\n+\ttst_res(TPASS, \"Userfaultfd handler successfully handled the fault\");\n+\n+\treturn NULL;\n+}\n+\n+static void setup(void)\n+{\n+\tstruct uffdio_api uffdio_api;\n+\tstruct uffdio_register uffdio_register;\n+\n+\tpage_size = getpagesize();\n+\tuffd = SAFE_USERFAULTFD(O_CLOEXEC | O_NONBLOCK, true);\n+\n+\tuffdio_api.api = UFFD_API;\n+\tuffdio_api.features = 0;\n+\tSAFE_IOCTL(uffd, UFFDIO_API, &uffdio_api);\n+\n+\told_addr = SAFE_MMAP(NULL, page_size,\n+\t\t\t     PROT_READ | PROT_WRITE,\n+\t\t\t     MAP_PRIVATE | MAP_ANONYMOUS,\n+\t\t\t     -1, 0);\n+\n+\ttst_res(TINFO, \"Original mapping created at %p\", (void *)old_addr);\n+\n+\tstrcpy(old_addr, TEST_STRING_A);\n+\n+\tuffdio_register.range.start = (unsigned long)old_addr;\n+\tuffdio_register.range.len = page_size;\n+\tuffdio_register.mode = UFFDIO_REGISTER_MODE_MISSING;\n+\tSAFE_IOCTL(uffd, UFFDIO_REGISTER, &uffdio_register);\n+}\n+\n+static void cleanup(void)\n+{\n+\tif (new_addr && new_addr != MAP_FAILED)\n+\t\tSAFE_MUNMAP(new_addr, page_size);\n+\n+\tif (old_addr && old_addr != MAP_FAILED)\n+\t\tSAFE_MUNMAP(old_addr, page_size);\n+\n+\tif (uffd != -1)\n+\t\tSAFE_CLOSE(uffd);\n+}\n+\n+static void run(void)\n+{\n+\tnew_addr = NULL;\n+\tpthread_t handler_thread;\n+\n+\tSAFE_PTHREAD_CREATE(&handler_thread, NULL,\n+\t\t\t    fault_handler_thread, NULL);\n+\n+\tnew_addr = mremap(old_addr, page_size, page_size,\n+\t\t\t  MREMAP_DONTUNMAP | MREMAP_MAYMOVE, NULL);\n+\n+\tif (new_addr == MAP_FAILED) {\n+\t\tif (errno == EINVAL) {\n+\t\t\ttst_brk(TCONF | TERRNO,\n+\t\t\t\t\"mremap with MREMAP_DONTUNMAP not supported?\");\n+\t\t}\n+\t\ttst_brk(TBROK | TERRNO, \"mremap failed\");\n+\t}\n+\n+\ttst_res(TINFO, \"New mapping created at %p\", (void *)new_addr);\n+\n+\tTST_EXP_EQ_STR(new_addr, TEST_STRING_A);\n+\tstrcpy(new_addr, TEST_STRING_B);\n+\n+\tTST_CHECKPOINT_WAKE(0);\n+\n+\ttst_res(TINFO, \"Main thread accessing old address %p to trigger fault\",\n+\t\t(void *)old_addr);\n+\n+\t(void)*(volatile char *)old_addr;\n+\n+\tSAFE_PTHREAD_JOIN(handler_thread, NULL);\n+\n+\tTST_EXP_EQ_STR(old_addr, TEST_STRING_B);\n+\n+\tSAFE_MUNMAP(new_addr, page_size);\n+\tnew_addr = NULL;\n+\tstrcpy(old_addr, TEST_STRING_A);\n+}\n+\n+static struct tst_test test = {\n+\t.test_all = run,\n+\t.setup = setup,\n+\t.needs_checkpoints = 1,\n+\t.cleanup = cleanup,\n+\t.needs_kconfigs = (const char *[]) {\n+\t\t\"CONFIG_USERFAULTFD=y\",\n+\t\tNULL,\n+\t},\n+};\n",
    "prefixes": [
        "v9"
    ]
}