get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 1707746,
    "url": "http://patchwork.ozlabs.org/api/patches/1707746/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/linux-um/patch/20221122100759.208290-27-benjamin@sipsolutions.net/",
    "project": {
        "id": 60,
        "url": "http://patchwork.ozlabs.org/api/projects/60/?format=api",
        "name": "User-mode Linux Development",
        "link_name": "linux-um",
        "list_id": "linux-um.lists.infradead.org",
        "list_email": "linux-um@lists.infradead.org",
        "web_url": "",
        "scm_url": "",
        "webscm_url": "",
        "list_archive_url": "",
        "list_archive_url_format": "",
        "commit_url_format": ""
    },
    "msgid": "<20221122100759.208290-27-benjamin@sipsolutions.net>",
    "list_archive_url": null,
    "date": "2022-11-22T10:07:57",
    "name": "[v2,26/28] um: Die if a child dies unexpectedly in seccomp mode",
    "commit_ref": null,
    "pull_url": null,
    "state": "not-applicable",
    "archived": false,
    "hash": "106b4b12df3d0dabe91f8d9be981f0756bef8a03",
    "submitter": {
        "id": 67525,
        "url": "http://patchwork.ozlabs.org/api/people/67525/?format=api",
        "name": "Benjamin Berg",
        "email": "benjamin@sipsolutions.net"
    },
    "delegate": {
        "id": 54851,
        "url": "http://patchwork.ozlabs.org/api/users/54851/?format=api",
        "username": "rw",
        "first_name": "Richard",
        "last_name": "Weinberger",
        "email": "richard@nod.at"
    },
    "mbox": "http://patchwork.ozlabs.org/project/linux-um/patch/20221122100759.208290-27-benjamin@sipsolutions.net/mbox/",
    "series": [
        {
            "id": 329466,
            "url": "http://patchwork.ozlabs.org/api/series/329466/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/linux-um/list/?series=329466",
            "date": "2022-11-22T10:07:37",
            "name": "Implement SECCOMP based userland",
            "version": 2,
            "mbox": "http://patchwork.ozlabs.org/series/329466/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/1707746/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/1707746/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "\n <linux-um-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org>",
        "X-Original-To": "incoming@patchwork.ozlabs.org",
        "Delivered-To": "patchwork-incoming@legolas.ozlabs.org",
        "Authentication-Results": [
            "legolas.ozlabs.org;\n spf=none (no SPF record) smtp.mailfrom=lists.infradead.org\n (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org;\n envelope-from=linux-um-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org;\n receiver=<UNKNOWN>)",
            "legolas.ozlabs.org;\n\tdkim=pass (2048-bit key;\n secure) header.d=lists.infradead.org header.i=@lists.infradead.org\n header.a=rsa-sha256 header.s=bombadil.20210309 header.b=z1+nYIVX;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n secure) header.d=sipsolutions.net header.i=@sipsolutions.net\n header.a=rsa-sha256 header.s=mail header.b=h2kxzZt5;\n\tdkim-atps=neutral"
        ],
        "Received": [
            "from bombadil.infradead.org (bombadil.infradead.org\n [IPv6:2607:7c80:54:3::133])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4NGg5b2zmVz23nl\n\tfor <incoming@patchwork.ozlabs.org>; Tue, 22 Nov 2022 21:11:31 +1100 (AEDT)",
            "from localhost ([::1] helo=bombadil.infradead.org)\n\tby bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux))\n\tid 1oxQFM-007fyH-6j; Tue, 22 Nov 2022 10:11:20 +0000",
            "from s3.sipsolutions.net ([2a01:4f8:191:4433::2]\n helo=sipsolutions.net)\n\tby bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux))\n\tid 1oxQF1-007feo-Op\n\tfor linux-um@lists.infradead.org; Tue, 22 Nov 2022 10:11:06 +0000",
            "by sipsolutions.net with esmtpsa\n (TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256)\n\t(Exim 4.96)\n\t(envelope-from <benjamin@sipsolutions.net>)\n\tid 1oxQEu-006IGn-2y;\n\tTue, 22 Nov 2022 11:10:53 +0100"
        ],
        "DKIM-Signature": [
            "v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;\n\td=lists.infradead.org; s=bombadil.20210309; h=Sender:\n\tContent-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post:\n\tList-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:\n\tMessage-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description:\n\tResent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:\n\tList-Owner; bh=g8SmPXZh0kSlENkQTk+yy/Du9QzuSyPCCqTDmFT5AAA=; b=z1+nYIVX/WuqJu\n\tpWaUEzV10dM1k58nknx9k4Aq/IJ4adezgJV1p0WQDol4CplFGGg9pO2/dBxqz/KhRH+Sk3O1ne6Y1\n\tsSJr+4N8AgcnKcq+0JR5TTU/7g9rnTIe3/KvpjfrF///GZhugjae8TnbN6IAOquG6HvdggRd5BK7I\n\tWxeAsGUFDopcqZwyc8b/isLWjvdE8fnKtz7vJSCeZO9JOBI5P3Qnj9eglmlScVda5iWB6JNC0tuxJ\n\t6csjJ6TXBsVI/YVn2mg9pG4ZfoqJ+Kg96Xe6NpITNJcxjwa8rGP81CoFDTHQ4a2ikng/Yzt3yTFhS\n\tElpQPm+oyOlbIlWndDTw==;",
            "v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;\n\td=sipsolutions.net; s=mail; h=Content-Transfer-Encoding:MIME-Version:\n\tReferences:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Content-Type:Sender\n\t:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-To:\n\tResent-Cc:Resent-Message-ID; bh=utAvEKQ+jPHNcrosqX7HWwVjeA1rAK1oeYCrGOYxwl4=;\n\tt=1669111857; x=1670321457; b=h2kxzZt5szfw92eEjl4MxVWSLZmn6dVIkWNrqI5AWlUKid3\n\tRKkjr1ZrxigJIvifkX9Bi+0Ip63FEdOeu3aj75q8PSKvBFAwjTUlps6Ic9RS/gD4TBaQ3/0DzaBcg\n\t3EJ7FuLb8qlh88ftpR9Mm9XbFkI/E+V/09whvn3LvcKfy4EJgkOBX5GFPvdYqR47Sr06a+ZG4dw8T\n\t3jDqbMD69/Pa/owAowgb3+/53rLvrR3vLmHycqw9FJqvxz40VMxiIvpjkhsiRcGaf6dkwIYId2dY8\n\tTM2NjiGAH8rl08hjxiv5g2QkfktwFxqPCwGCbyFlzVc39IbgvPp3I1yvm6uJNf8Q==;"
        ],
        "From": "benjamin@sipsolutions.net",
        "To": "linux-um@lists.infradead.org",
        "Cc": "Benjamin Berg <benjamin@sipsolutions.net>",
        "Subject": "[PATCH v2 26/28] um: Die if a child dies unexpectedly in seccomp mode",
        "Date": "Tue, 22 Nov 2022 11:07:57 +0100",
        "Message-Id": "<20221122100759.208290-27-benjamin@sipsolutions.net>",
        "X-Mailer": "git-send-email 2.38.1",
        "In-Reply-To": "<20221122100759.208290-1-benjamin@sipsolutions.net>",
        "References": "<20221122100759.208290-1-benjamin@sipsolutions.net>",
        "MIME-Version": "1.0",
        "X-CRM114-Version": "20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 ",
        "X-CRM114-CacheID": "sfid-20221122_021059_884260_0DAEE2F6 ",
        "X-CRM114-Status": "GOOD (  16.28  )",
        "X-Spam-Score": "-0.2 (/)",
        "X-Spam-Report": "Spam detection software,\n running on the system \"bombadil.infradead.org\",\n has NOT identified this incoming email as spam.  The original\n message has been attached to this so you can view it or label\n similar future email.  If you have any questions, see\n the administrator of that system for details.\n Content preview:  From: Benjamin Berg <benjamin@sipsolutions.net> When in\n seccomp\n    mode, we would hang forever on the futex if a child has died unexpectedly.\n    In contrast, ptrace mode will notice it and kill the corresponding thread\n    when it fails to run it.\n Content analysis details:   (-0.2 points, 5.0 required)\n  pts rule name              description\n ---- ----------------------\n --------------------------------------------------\n -0.0 SPF_PASS               SPF: sender matches SPF record\n -0.0 SPF_HELO_PASS          SPF: HELO matches SPF record\n -0.1 DKIM_VALID_AU          Message has a valid DKIM or DK signature from\n                             author's domain\n -0.1 DKIM_VALID             Message has at least one valid DKIM or DK\n signature\n  0.1 DKIM_SIGNED            Message has a DKIM or DK signature,\n not necessarily\n                             valid\n -0.1 DKIM_VALID_EF          Message has a valid DKIM or DK signature from\n                             envelope-from domain",
        "X-BeenThere": "linux-um@lists.infradead.org",
        "X-Mailman-Version": "2.1.34",
        "Precedence": "list",
        "List-Id": "<linux-um.lists.infradead.org>",
        "List-Unsubscribe": "<http://lists.infradead.org/mailman/options/linux-um>,\n <mailto:linux-um-request@lists.infradead.org?subject=unsubscribe>",
        "List-Archive": "<http://lists.infradead.org/pipermail/linux-um/>",
        "List-Post": "<mailto:linux-um@lists.infradead.org>",
        "List-Help": "<mailto:linux-um-request@lists.infradead.org?subject=help>",
        "List-Subscribe": "<http://lists.infradead.org/mailman/listinfo/linux-um>,\n <mailto:linux-um-request@lists.infradead.org?subject=subscribe>",
        "Content-Type": "text/plain; charset=\"us-ascii\"",
        "Content-Transfer-Encoding": "7bit",
        "Sender": "\"linux-um\" <linux-um-bounces@lists.infradead.org>",
        "Errors-To": "linux-um-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org"
    },
    "content": "From: Benjamin Berg <benjamin@sipsolutions.net>\n\nWhen in seccomp mode, we would hang forever on the futex if a child has\ndied unexpectedly. In contrast, ptrace mode will notice it and kill the\ncorresponding thread when it fails to run it.\n\nFix this issue by simply printing a message and aborting. In this case\nsomething from the outside (e.g. OOM killer) has interferred with the\nmachine and it is reasonable to not try to recover.\n\nSigned-off-by: Benjamin Berg <benjamin@sipsolutions.net>\n---\n arch/um/include/shared/os.h |  1 +\n arch/um/os-Linux/process.c  | 40 +++++++++++++++++++++++++++++++++++++\n arch/um/os-Linux/signal.c   |  7 +++++++\n 3 files changed, 48 insertions(+)",
    "diff": "diff --git a/arch/um/include/shared/os.h b/arch/um/include/shared/os.h\nindex d1f1dedad83b..07683f45d7e1 100644\n--- a/arch/um/include/shared/os.h\n+++ b/arch/um/include/shared/os.h\n@@ -192,6 +192,7 @@ extern void get_host_cpu_features(\n extern int create_mem_file(unsigned long long len);\n \n /* process.c */\n+void os_check_child_lost(void);\n extern unsigned long os_process_pc(int pid);\n extern int os_process_parent(int pid);\n extern void os_alarm_process(int pid);\ndiff --git a/arch/um/os-Linux/process.c b/arch/um/os-Linux/process.c\nindex e52dd37ddadc..db98fc79d9e2 100644\n--- a/arch/um/os-Linux/process.c\n+++ b/arch/um/os-Linux/process.c\n@@ -17,6 +17,7 @@\n #include <init.h>\n #include <longjmp.h>\n #include <os.h>\n+#include <skas/skas.h>\n \n #define ARBITRARY_ADDR -1\n #define FAILURE_PID    -1\n@@ -102,9 +103,18 @@ void os_stop_process(int pid)\n \n void os_kill_process(int pid, int reap_child)\n {\n+\tsigset_t chld;\n+\n+\t/* Block SIGCHLD so that we can reap it before the handler runs. */\n+\tsigemptyset(&chld);\n+\tsigaddset(&chld, SIGCHLD);\n+\tsigprocmask(SIG_BLOCK, &chld, NULL);\n+\n \tkill(pid, SIGKILL);\n \tif (reap_child)\n \t\tCATCH_EINTR(waitpid(pid, NULL, __WALL));\n+\n+\tsigprocmask(SIG_UNBLOCK, &chld, NULL);\n }\n \n /* Kill off a ptraced child by all means available.  kill it normally first,\n@@ -114,11 +124,39 @@ void os_kill_process(int pid, int reap_child)\n \n void os_kill_ptraced_process(int pid, int reap_child)\n {\n+\tsigset_t chld;\n+\n+\t/* Block SIGCHLD so that we can reap it before the handler runs. */\n+\tsigemptyset(&chld);\n+\tsigaddset(&chld, SIGCHLD);\n+\tsigprocmask(SIG_BLOCK, &chld, NULL);\n+\n \tkill(pid, SIGKILL);\n \tptrace(PTRACE_KILL, pid);\n \tptrace(PTRACE_CONT, pid);\n \tif (reap_child)\n \t\tCATCH_EINTR(waitpid(pid, NULL, __WALL));\n+\n+\tsigprocmask(SIG_UNBLOCK, &chld, NULL);\n+}\n+\n+void os_check_child_lost(void)\n+{\n+\tint status;\n+\tpid_t pid;\n+\n+\t/*\n+\t * Check if we can reap a child.\n+\t * Any expected kills will clean up without this handler being fired.\n+\t */\n+\tpid = waitpid(-1, &status, WNOHANG);\n+\tif (pid <= 0)\n+\t\treturn;\n+\n+\tos_warn(\"Child %d died unexpectedly with status %d, cannot recover in seccomp mode!\\r\\n\",\n+\t\tpid, status);\n+\t/* Kill ourselves including all children. */\n+\tkillpg(os_getpid(), SIGABRT);\n }\n \n /* Don't use the glibc version, which caches the result in TLS. It misses some\n@@ -283,5 +321,7 @@ void init_new_thread_signals(void)\n \tset_handler(SIGBUS);\n \tsignal(SIGHUP, SIG_IGN);\n \tset_handler(SIGIO);\n+\tif (using_seccomp)\n+\t\tset_handler(SIGCHLD);\n \tsignal(SIGWINCH, SIG_IGN);\n }\ndiff --git a/arch/um/os-Linux/signal.c b/arch/um/os-Linux/signal.c\nindex 24a403a70a02..d8c92e04c873 100644\n--- a/arch/um/os-Linux/signal.c\n+++ b/arch/um/os-Linux/signal.c\n@@ -108,6 +108,11 @@ static void timer_real_alarm_handler(mcontext_t *mc)\n \ttimer_handler(SIGALRM, NULL, &regs);\n }\n \n+static void sig_child_handler(int sig, struct siginfo *unused_si, mcontext_t *mc)\n+{\n+\tos_check_child_lost();\n+}\n+\n void timer_alarm_handler(int sig, struct siginfo *unused_si, mcontext_t *mc)\n {\n \tint enabled;\n@@ -169,6 +174,8 @@ static void (*handlers[_NSIG])(int sig, struct siginfo *si, mcontext_t *mc) = {\n \n \t[SIGIO] = sig_handler,\n \t[SIGWINCH] = sig_handler,\n+\t/* SIGCHLD is only registered in seccomp mode. */\n+\t[SIGCHLD] = sig_child_handler,\n \t[SIGALRM] = timer_alarm_handler,\n \n \t[SIGUSR1] = sigusr1_handler,\n",
    "prefixes": [
        "v2",
        "26/28"
    ]
}