Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/2195067/?format=api
{ "id": 2195067, "url": "http://patchwork.ozlabs.org/api/patches/2195067/?format=api", "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20260210121657.69363-15-mjt@tls.msk.ru/", "project": { "id": 14, "url": "http://patchwork.ozlabs.org/api/projects/14/?format=api", "name": "QEMU Development", "link_name": "qemu-devel", "list_id": "qemu-devel.nongnu.org", "list_email": "qemu-devel@nongnu.org", "web_url": "", "scm_url": "", "webscm_url": "", "list_archive_url": "", "list_archive_url_format": "", "commit_url_format": "" }, "msgid": "<20260210121657.69363-15-mjt@tls.msk.ru>", "list_archive_url": null, "date": "2026-02-10T12:16:48", "name": "[Stable-10.0.8,84/85] linux-user/syscall.c: Prevent acquiring clone_lock while fork()", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "093883bf64d00466ac2a7ed8b5f2b6128b3a72ae", "submitter": { "id": 183, "url": "http://patchwork.ozlabs.org/api/people/183/?format=api", "name": "Michael Tokarev", "email": "mjt@tls.msk.ru" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20260210121657.69363-15-mjt@tls.msk.ru/mbox/", "series": [ { "id": 491663, "url": "http://patchwork.ozlabs.org/api/series/491663/?format=api", "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/list/?series=491663", "date": "2026-02-10T12:16:40", "name": "Patch Round-up for stable 10.0.8, freeze on 2026-02-10 (frozen)", "version": 1, "mbox": "http://patchwork.ozlabs.org/series/491663/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/2195067/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/2195067/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>", "X-Original-To": "incoming@patchwork.ozlabs.org", "Delivered-To": "patchwork-incoming@legolas.ozlabs.org", "Authentication-Results": "legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org\n (client-ip=209.51.188.17; helo=lists.gnu.org;\n envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n receiver=patchwork.ozlabs.org)", "Received": [ "from lists.gnu.org (lists.gnu.org [209.51.188.17])\n\t(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4f9LKq6rBYz1xtr\n\tfor <incoming@patchwork.ozlabs.org>; Tue, 10 Feb 2026 23:22:23 +1100 (AEDT)", "from localhost ([::1] helo=lists1p.gnu.org)\n\tby lists.gnu.org with esmtp (Exim 4.90_1)\n\t(envelope-from <qemu-devel-bounces@nongnu.org>)\n\tid 1vpmkJ-0005fG-HF; Tue, 10 Feb 2026 07:21:35 -0500", "from eggs.gnu.org ([2001:470:142:3::10])\n by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)\n (Exim 4.90_1) (envelope-from <mjt@tls.msk.ru>)\n id 1vpmjC-0001vC-Op; Tue, 10 Feb 2026 07:20:26 -0500", "from isrv.corpit.ru ([212.248.84.144])\n by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)\n (Exim 4.90_1) (envelope-from <mjt@tls.msk.ru>)\n id 1vpmjA-0002KS-GT; Tue, 10 Feb 2026 07:20:26 -0500", "from tsrv.corpit.ru (tsrv.tls.msk.ru [192.168.177.2])\n by isrv.corpit.ru (Postfix) with ESMTP id 6B7D5187DE8;\n Tue, 10 Feb 2026 15:16:18 +0300 (MSK)", "from think4mjt.tls.msk.ru (mjtthink.wg.tls.msk.ru [192.168.177.146])\n by tsrv.corpit.ru (Postfix) with ESMTP id 0A179360CFC;\n Tue, 10 Feb 2026 15:17:14 +0300 (MSK)" ], "From": "Michael Tokarev <mjt@tls.msk.ru>", "To": "qemu-devel@nongnu.org", "Cc": "qemu-stable@nongnu.org, Aleksandr Sergeev <sergeev0xef@gmail.com>,\n Richard Henderson <richard.henderson@linaro.org>,\n Michael Tokarev <mjt@tls.msk.ru>", "Subject": "[Stable-10.0.8 84/85] linux-user/syscall.c: Prevent acquiring\n clone_lock while fork()", "Date": "Tue, 10 Feb 2026 15:16:48 +0300", "Message-ID": "<20260210121657.69363-15-mjt@tls.msk.ru>", "X-Mailer": "git-send-email 2.47.3", "In-Reply-To": "<qemu-stable-10.0.8-20260210151548@cover.tls.msk.ru>", "References": "<qemu-stable-10.0.8-20260210151548@cover.tls.msk.ru>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Received-SPF": "pass client-ip=212.248.84.144; envelope-from=mjt@tls.msk.ru;\n helo=isrv.corpit.ru", "X-Spam_score_int": "-18", "X-Spam_score": "-1.9", "X-Spam_bar": "-", "X-Spam_report": "(-1.9 / 5.0 requ) BAYES_00=-1.9,\n RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001,\n SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no", "X-Spam_action": "no action", "X-BeenThere": "qemu-devel@nongnu.org", "X-Mailman-Version": "2.1.29", "Precedence": "list", "List-Id": "qemu development <qemu-devel.nongnu.org>", "List-Unsubscribe": "<https://lists.nongnu.org/mailman/options/qemu-devel>,\n <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>", "List-Archive": "<https://lists.nongnu.org/archive/html/qemu-devel>", "List-Post": "<mailto:qemu-devel@nongnu.org>", "List-Help": "<mailto:qemu-devel-request@nongnu.org?subject=help>", "List-Subscribe": "<https://lists.nongnu.org/mailman/listinfo/qemu-devel>,\n <mailto:qemu-devel-request@nongnu.org?subject=subscribe>", "Errors-To": "qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org", "Sender": "qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org" }, "content": "From: Aleksandr Sergeev <sergeev0xef@gmail.com>\n\nBy the spec, fork() copies only the thread which executes it.\nSo it may happen, what while one thread is doing a fork,\nanother thread is holding `clone_lock` mutex\n(e.g. doing a `fork()` or `exit()`).\nSo the child process is born with the mutex being held,\nand there are nobody to release it.\n\nAs the thread executing do_syscall() is not considered running,\nstart_exclusive() does not protect us from the case.\n\nResolves: https://gitlab.com/qemu-project/qemu/-/issues/3226\nSigned-off-by: Aleksandr Sergeev <sergeev0xef@gmail.com>\nReviewed-by: Richard Henderson <richard.henderson@linaro.org>\nSigned-off-by: Richard Henderson <richard.henderson@linaro.org>\nMessage-ID: <20260126151612.2176451-1-sergeev0xef@gmail.com>\n(cherry picked from commit d22e9aec572396836782e993cb18d598e6012688)\nSigned-off-by: Michael Tokarev <mjt@tls.msk.ru>", "diff": "diff --git a/linux-user/main.c b/linux-user/main.c\nindex 2cd867491b..db99160d2d 100644\n--- a/linux-user/main.c\n+++ b/linux-user/main.c\n@@ -145,6 +145,7 @@ unsigned long guest_stack_size = TARGET_DEFAULT_STACK_SIZE;\n void fork_start(void)\n {\n start_exclusive();\n+ clone_fork_start();\n mmap_fork_start();\n cpu_list_lock();\n qemu_plugin_user_prefork_lock();\n@@ -174,6 +175,7 @@ void fork_end(pid_t pid)\n cpu_list_unlock();\n }\n gdbserver_fork_end(thread_cpu, pid);\n+ clone_fork_end(child);\n /*\n * qemu_init_cpu_list() reinitialized the child exclusive state, but we\n * also need to keep current_cpu consistent, so call end_exclusive() for\ndiff --git a/linux-user/syscall.c b/linux-user/syscall.c\nindex fd98ccc92e..e6dd35d2a1 100644\n--- a/linux-user/syscall.c\n+++ b/linux-user/syscall.c\n@@ -6735,6 +6735,20 @@ static void *clone_func(void *arg)\n return NULL;\n }\n \n+void clone_fork_start(void)\n+{\n+ pthread_mutex_lock(&clone_lock);\n+}\n+\n+void clone_fork_end(bool child)\n+{\n+ if (child) {\n+ pthread_mutex_init(&clone_lock, NULL);\n+ } else {\n+ pthread_mutex_unlock(&clone_lock);\n+ }\n+}\n+\n /* do_fork() Must return host values and target errnos (unlike most\n do_*() functions). */\n static int do_fork(CPUArchState *env, unsigned int flags, abi_ulong newsp,\ndiff --git a/linux-user/user-internals.h b/linux-user/user-internals.h\nindex ccbd495cc1..02872a98d5 100644\n--- a/linux-user/user-internals.h\n+++ b/linux-user/user-internals.h\n@@ -68,6 +68,8 @@ abi_long get_errno(abi_long ret);\n const char *target_strerror(int err);\n int get_osversion(void);\n void init_qemu_uname_release(void);\n+void clone_fork_start(void);\n+void clone_fork_end(bool child);\n void fork_start(void);\n void fork_end(pid_t pid);\n \n", "prefixes": [ "Stable-10.0.8", "84/85" ] }