Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/1707771/?format=api
{ "id": 1707771, "url": "http://patchwork.ozlabs.org/api/patches/1707771/?format=api", "web_url": "http://patchwork.ozlabs.org/project/linux-um/patch/20221122100759.208290-20-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-20-benjamin@sipsolutions.net>", "list_archive_url": null, "date": "2022-11-22T10:07:50", "name": "[v2,19/28] um: Pass full mm_id to functions creating helper processes", "commit_ref": null, "pull_url": null, "state": "not-applicable", "archived": false, "hash": "ebe11aea20504c1d68513f6897cdd1b4484685ab", "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-20-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/1707771/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/1707771/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=NDVfTAMe;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n secure) header.d=infradead.org header.i=@infradead.org header.a=rsa-sha256\n header.s=desiato.20200630 header.b=olE+BNqK;\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=hp3Hb1Hh;\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 4NGgRc2W2hz23np\n\tfor <incoming@patchwork.ozlabs.org>; Tue, 22 Nov 2022 21:27:08 +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 1oxQUQ-007ntt-TC; Tue, 22 Nov 2022 10:26:54 +0000", "from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05])\n\tby bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux))\n\tid 1oxQTK-007nKg-PZ\n\tfor linux-um@bombadil.infradead.org; Tue, 22 Nov 2022 10:25:46 +0000", "from s3.sipsolutions.net ([2a01:4f8:191:4433::2]\n helo=sipsolutions.net)\n\tby desiato.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux))\n\tid 1oxQF3-003P3r-Jp\n\tfor linux-um@lists.infradead.org; Tue, 22 Nov 2022 10:11:08 +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 1oxQEq-006IGn-2v;\n\tTue, 22 Nov 2022 11:10:49 +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=CF6BE3KMC2NLKEO98IrkvJCYPqbwTMjA4C+a6WDRh/c=; b=NDVfTAMe7akAaC\n\tsoZqf92fY1UaxrOjMA/EoS0wwKf0OSwsFUKLpiR9X9DwmDj93Se8ZJzLmR4Df2wQUGLbV6V5nTugz\n\tvyrJWjrkAtq6gwtGwjRjRXvGNtCO4uFzdebN5NpMjxgxMYJQXGeNA1LnW2nJxQ9Y74UvPU6keEmUj\n\tnru7PQ/PzY7FIR5lRNn2ofstcSZuTws178lLFwKoTQnGmp6pyojFvybyd9bQ2uRWtUs4Q2/IihFo/\n\t4P1iqBwbf8JNUaOkFN3AZh9yzpPySZYqYoMIzmxLHU8mdYv8Y16D+9j2UoaJKVOMoaOCRuzFT8Q0o\n\tIb1NXG9X6+P0RInIEfRA==;", "v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;\n\td=infradead.org; s=desiato.20200630; h=Content-Transfer-Encoding:MIME-Version\n\t:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:\n\tContent-Type:Content-ID:Content-Description;\n\tbh=yBeGg1yOlJJQ+w3KGj6EaxA4OEaEKz0gIyDSlhBDuVU=; b=olE+BNqKYi6cnrictcgUbdj81O\n\tEpwWazdlcPNRi8UXjpfLpD0oqqr77d8dquDjn6h4mec9R4iWjAakxfJfOH+4M35130jt962ljOfRj\n\tCcjoG15oxNk+Aetgm/KCB6oQHNd7zBEjUP3NkePuOvNrPb/1mmFJpdaeRiRJCR2lwtwsLucG9GsZq\n\t/p9FPDUZYUGPFJnwKG0RYP//y672i9Tga8eb93uLYYfyEQcGBEgv47kF7VIMSsnRONxt1AqWqEzZH\n\tMQ1nZOgzvnEB5fHH9z/uLSQSBSewhBRyMAQEg1ErfiifJSVEXfnptGkOggFOH5Y3Q5KqtMZfdvhu3\n\t7A55lybQ==;", "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=yBeGg1yOlJJQ+w3KGj6EaxA4OEaEKz0gIyDSlhBDuVU=;\n\tt=1669111861; x=1670321461; b=hp3Hb1Hhl+WmhxqcLX7SijMmU4Wyb16i0M24lHeO9YJMUlJ\n\tc/swz6dBI6/uLQIyqfmihRHj31cZE+crs5guNl32SUo+MYuAfJGpMR0dWCVTtfb7j1FnJilQNNvsV\n\t6KRiDpJCs8sV63+LL76TYATHBHxT792ap3llR2RswGpJbi6Q8eWV5Ux47mmlKuacYM1IG7RFmKGst\n\t/d28gnaQ43gA9aQRRmSbK9Bd9spQGUSQ35C1RqR/4IcmjCrv94u1VOjPLPTN3DbHJcr2kggCYw3nk\n\tCvPQL+ePnc1Odk34iotV70fEpRu62w50rDEWPLMM8PD5zNampQ1mbZf0She+zViw==;" ], "From": "benjamin@sipsolutions.net", "To": "linux-um@lists.infradead.org", "Cc": "Benjamin Berg <benjamin@sipsolutions.net>", "Subject": "[PATCH v2 19/28] um: Pass full mm_id to functions creating helper\n processes", "Date": "Tue, 22 Nov 2022 11:07:50 +0100", "Message-Id": "<20221122100759.208290-20-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_101101_942053_47A0EB1D ", "X-CRM114-Status": "GOOD ( 15.53 )", "X-Spam-Score": "-0.2 (/)", "X-Spam-Report": "Spam detection software,\n running on the system \"desiato.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> For\n seccomp,\n we need all information about the original process in copy_context_skas0.\n For consistency,\n change both copy_context_skas0 and start_userspace to take\n the mm_id struct as parameter and dir [...]\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_EF Message has a valid DKIM or DK signature from\n envelope-from domain\n 0.1 DKIM_SIGNED Message has a DKIM or DK signature,\n not necessarily\n valid\n -0.1 DKIM_VALID Message has at least one valid DKIM or DK\n signature", "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\nFor seccomp, we need all information about the original process in\ncopy_context_skas0. For consistency, change both copy_context_skas0 and\nstart_userspace to take the mm_id struct as parameter and directly set\nPID in addition to returning it.\n\nSigned-off-by: Benjamin Berg <benjamin@sipsolutions.net>\n---\n arch/um/include/shared/os.h | 4 +--\n arch/um/kernel/skas/mmu.c | 10 +++---\n arch/um/os-Linux/skas/process.c | 57 ++++++++++++++++-----------------\n 3 files changed, 34 insertions(+), 37 deletions(-)", "diff": "diff --git a/arch/um/include/shared/os.h b/arch/um/include/shared/os.h\nindex 22ea525165b7..d1f1dedad83b 100644\n--- a/arch/um/include/shared/os.h\n+++ b/arch/um/include/shared/os.h\n@@ -282,8 +282,8 @@ void protect(struct mm_id *mm_idp, unsigned long addr,\n \n /* skas/process.c */\n extern int is_skas_winch(int pid, int fd, void *data);\n-extern int start_userspace(unsigned long stub_stack);\n-extern int copy_context_skas0(unsigned long stack, int pid);\n+extern int start_userspace(struct mm_id *id);\n+extern int copy_context_skas0(struct mm_id *id, struct mm_id *from);\n extern void userspace(struct uml_pt_regs *regs, unsigned long *aux_fp_regs);\n extern void new_thread(void *stack, jmp_buf *buf, void (*handler)(void));\n extern void switch_threads(jmp_buf *me, jmp_buf *you);\ndiff --git a/arch/um/kernel/skas/mmu.c b/arch/um/kernel/skas/mmu.c\nindex 6ccb561b4373..d5838ff702dc 100644\n--- a/arch/um/kernel/skas/mmu.c\n+++ b/arch/um/kernel/skas/mmu.c\n@@ -31,15 +31,13 @@ int init_new_context(struct task_struct *task, struct mm_struct *mm)\n \n \tblock_signals_trace();\n \tif (from_mm)\n-\t\tto_mm->id.u.pid = copy_context_skas0(stack,\n-\t\t\t\t\t\t from_mm->id.u.pid);\n-\telse to_mm->id.u.pid = start_userspace(stack);\n+\t\tret = copy_context_skas0(&to_mm->id, &from_mm->id);\n+\telse\n+\t\tret = start_userspace(&to_mm->id);\n \tunblock_signals_trace();\n \n-\tif (to_mm->id.u.pid < 0) {\n-\t\tret = to_mm->id.u.pid;\n+\tif (ret < 0)\n \t\tgoto out_free;\n-\t}\n \n \tret = init_new_ldt(to_mm, from_mm);\n \tif (ret < 0) {\ndiff --git a/arch/um/os-Linux/skas/process.c b/arch/um/os-Linux/skas/process.c\nindex 17164c4a7d7c..1e1c378588ba 100644\n--- a/arch/um/os-Linux/skas/process.c\n+++ b/arch/um/os-Linux/skas/process.c\n@@ -267,11 +267,11 @@ int kill_userspace_mm[NR_CPUS];\n * when negative: an error number.\n * FIXME: can PIDs become negative?!\n */\n-int start_userspace(unsigned long stub_stack)\n+int start_userspace(struct mm_id *id)\n {\n \tvoid *stack;\n \tunsigned long sp;\n-\tint pid, status, n, flags, err;\n+\tint status, n, flags, err;\n \n \t/* setup a temporary stack page */\n \tstack = mmap(NULL, UM_KERN_PAGE_SIZE,\n@@ -290,8 +290,8 @@ int start_userspace(unsigned long stub_stack)\n \tflags = CLONE_FILES | SIGCHLD;\n \n \t/* clone into new userspace process */\n-\tpid = clone(userspace_tramp, (void *) sp, flags, (void *) stub_stack);\n-\tif (pid < 0) {\n+\tid->u.pid = clone(userspace_tramp, (void *) sp, flags, (void *) id->stack);\n+\tif (id->u.pid < 0) {\n \t\terr = -errno;\n \t\tprintk(UM_KERN_ERR \"%s : clone failed, errno = %d\\n\",\n \t\t __func__, errno);\n@@ -299,7 +299,7 @@ int start_userspace(unsigned long stub_stack)\n \t}\n \n \tdo {\n-\t\tCATCH_EINTR(n = waitpid(pid, &status, WUNTRACED | __WALL));\n+\t\tCATCH_EINTR(n = waitpid(id->u.pid, &status, WUNTRACED | __WALL));\n \t\tif (n < 0) {\n \t\t\terr = -errno;\n \t\t\tprintk(UM_KERN_ERR \"%s : wait failed, errno = %d\\n\",\n@@ -315,7 +315,7 @@ int start_userspace(unsigned long stub_stack)\n \t\tgoto out_kill;\n \t}\n \n-\tif (ptrace(PTRACE_SETOPTIONS, pid, NULL,\n+\tif (ptrace(PTRACE_SETOPTIONS, id->u.pid, NULL,\n \t\t (void *) PTRACE_O_TRACESYSGOOD) < 0) {\n \t\terr = -errno;\n \t\tprintk(UM_KERN_ERR \"%s : PTRACE_SETOPTIONS failed, errno = %d\\n\",\n@@ -330,10 +330,10 @@ int start_userspace(unsigned long stub_stack)\n \t\tgoto out_kill;\n \t}\n \n-\treturn pid;\n+\treturn id->u.pid;\n \n out_kill:\n-\tos_kill_ptraced_process(pid, 1);\n+\tos_kill_ptraced_process(id->u.pid, 1);\n \treturn err;\n }\n \n@@ -483,15 +483,14 @@ static int __init init_thread_regs(void)\n \n __initcall(init_thread_regs);\n \n-int copy_context_skas0(unsigned long new_stack, int pid)\n+int copy_context_skas0(struct mm_id *id, struct mm_id *from)\n {\n \tint err;\n \tunsigned long current_stack = current_stub_stack();\n-\tstruct stub_data *data = (struct stub_data *) current_stack;\n-\tstruct stub_data *child_data = (struct stub_data *) new_stack;\n+\tstruct stub_data *data = (struct stub_data *)current_stack;\n+\tstruct stub_data *child_data = (struct stub_data *)id->stack;\n \tunsigned long long new_offset;\n-\tint new_fd = phys_mapping(uml_to_phys((void *)new_stack), &new_offset);\n-\n+\tint new_fd = phys_mapping(uml_to_phys((void *)id->stack), &new_offset);\n \t/*\n \t * prepare offset and fd of child's stack as argument for parent's\n \t * and child's mmap2 calls\n@@ -507,18 +506,18 @@ int copy_context_skas0(unsigned long new_stack, int pid)\n \t\t.child_err = -ESRCH,\n \t});\n \n-\terr = ptrace_setregs(pid, thread_regs);\n+\terr = ptrace_setregs(from->u.pid, thread_regs);\n \tif (err < 0) {\n \t\terr = -errno;\n \t\tprintk(UM_KERN_ERR \"%s : PTRACE_SETREGS failed, pid = %d, errno = %d\\n\",\n-\t\t __func__, pid, -err);\n+\t\t __func__, from->u.pid, -err);\n \t\treturn err;\n \t}\n \n-\terr = put_fp_registers(pid, thread_fp_regs);\n+\terr = put_fp_registers(from->u.pid, thread_fp_regs);\n \tif (err < 0) {\n \t\tprintk(UM_KERN_ERR \"%s : put_fp_registers failed, pid = %d, err = %d\\n\",\n-\t\t __func__, pid, err);\n+\t\t __func__, from->u.pid, err);\n \t\treturn err;\n \t}\n \n@@ -526,36 +525,36 @@ int copy_context_skas0(unsigned long new_stack, int pid)\n \t * Wait, until parent has finished its work: read child's pid from\n \t * parent's stack, and check, if bad result.\n \t */\n-\terr = ptrace(PTRACE_CONT, pid, 0, 0);\n+\terr = ptrace(PTRACE_CONT, from->u.pid, 0, 0);\n \tif (err) {\n \t\terr = -errno;\n \t\tprintk(UM_KERN_ERR \"Failed to continue new process, pid = %d, errno = %d\\n\",\n-\t\t pid, errno);\n+\t\t from->u.pid, errno);\n \t\treturn err;\n \t}\n \n-\twait_stub_done(pid);\n+\twait_stub_done(from->u.pid);\n \n-\tpid = data->err;\n-\tif (pid < 0) {\n+\tid->u.pid = data->err;\n+\tif (id->u.pid < 0) {\n \t\tprintk(UM_KERN_ERR \"%s - stub-parent reports error %d\\n\",\n-\t\t __func__, -pid);\n-\t\treturn pid;\n+\t\t __func__, -id->u.pid);\n+\t\treturn id->u.pid;\n \t}\n \n \t/*\n \t * Wait, until child has finished too: read child's result from\n \t * child's stack and check it.\n \t */\n-\twait_stub_done(pid);\n+\twait_stub_done(id->u.pid);\n \tif (child_data->child_err != STUB_DATA) {\n \t\tprintk(UM_KERN_ERR \"%s - stub-child %d reports error %ld\\n\",\n-\t\t __func__, pid, data->child_err);\n+\t\t __func__, id->u.pid, data->child_err);\n \t\terr = data->child_err;\n \t\tgoto out_kill;\n \t}\n \n-\tif (ptrace(PTRACE_SETOPTIONS, pid, NULL,\n+\tif (ptrace(PTRACE_SETOPTIONS, id->u.pid, NULL,\n \t\t (void *)PTRACE_O_TRACESYSGOOD) < 0) {\n \t\terr = -errno;\n \t\tprintk(UM_KERN_ERR \"%s : PTRACE_SETOPTIONS failed, errno = %d\\n\",\n@@ -563,10 +562,10 @@ int copy_context_skas0(unsigned long new_stack, int pid)\n \t\tgoto out_kill;\n \t}\n \n-\treturn pid;\n+\treturn id->u.pid;\n \n out_kill:\n-\tos_kill_ptraced_process(pid, 1);\n+\tos_kill_ptraced_process(id->u.pid, 1);\n \treturn err;\n }\n \n", "prefixes": [ "v2", "19/28" ] }