Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/2216450/?format=api
{ "id": 2216450, "url": "http://patchwork.ozlabs.org/api/patches/2216450/?format=api", "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20260325-fix-name-to-handle-at-v1-1-49fb922e6fd3@craftyguy.net/", "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": "<20260325-fix-name-to-handle-at-v1-1-49fb922e6fd3@craftyguy.net>", "list_archive_url": null, "date": "2026-03-26T05:59:36", "name": "linux-user: fix name_to_handle_at when AT_HANDLE_MNT_ID_UNIQUE flag is set", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "89ad958b4cdc58e8abcafedc5af4a507c6ff5af1", "submitter": { "id": 92978, "url": "http://patchwork.ozlabs.org/api/people/92978/?format=api", "name": "Clayton Craft", "email": "craftyguy@postmarketos.org" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20260325-fix-name-to-handle-at-v1-1-49fb922e6fd3@craftyguy.net/mbox/", "series": [ { "id": 497589, "url": "http://patchwork.ozlabs.org/api/series/497589/?format=api", "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/list/?series=497589", "date": "2026-03-26T05:59:36", "name": "linux-user: fix name_to_handle_at when AT_HANDLE_MNT_ID_UNIQUE flag is set", "version": 1, "mbox": "http://patchwork.ozlabs.org/series/497589/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/2216450/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/2216450/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\tdkim=pass (2048-bit key;\n unprotected) header.d=postmarketos.org header.i=@postmarketos.org\n header.a=rsa-sha256 header.s=key1 header.b=T5ZscBA0;\n\tdkim-atps=neutral", "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 4fhPz65Z2nz1y1G\n\tfor <incoming@patchwork.ozlabs.org>; Fri, 27 Mar 2026 00:40:02 +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 1w5kvj-0006EH-Fb; Thu, 26 Mar 2026 09:39:23 -0400", "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 <clayton@craftyguy.net>)\n id 1w5dlQ-0003gg-Aq\n for qemu-devel@nongnu.org; Thu, 26 Mar 2026 02:00:16 -0400", "from out-173.mta1.migadu.com ([95.215.58.173])\n by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)\n (Exim 4.90_1) (envelope-from <clayton@craftyguy.net>)\n id 1w5dlM-0008W4-4N\n for qemu-devel@nongnu.org; Thu, 26 Mar 2026 02:00:16 -0400" ], "X-Report-Abuse": "Please report any abuse attempt to abuse@migadu.com and\n include these headers.", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=postmarketos.org;\n s=key1; t=1774504806;\n h=from:from:reply-to:subject:subject:date:date:message-id:message-id:\n to:to:cc:cc:mime-version:mime-version:content-type:content-type:\n content-transfer-encoding:content-transfer-encoding;\n bh=A14hZowf3NuwCrwr5yL7wfdM9vMTn4vKiUnFd9wTGhY=;\n b=T5ZscBA0lYVvCefmzgewS4vsklOW7FmfHGy7FNvJ8Zgu98LJSwDLirz9jGZaBppUcbX326\n I1Nvw/C95RVeYez/ze7/wrZaVbJ4thY7m0ERrvs2iBYQDzAVyf4aJsexbcj5crHtIjQQ2m\n fInnNFt5PTzUOjwJAn2VwnRr2BC61nTcGHZuda/Uv9csYUr2IgSoUjJ+BD5PlVy2NGERYR\n I5JMbU7864A/biPGMEYCmpp9r/cAOUo0N2Kbhmmjco6XxQ5eyUOHPgjIOIImbCWM8VzdGE\n aPOpQ9AUlE35O83tvbI7CwjsguaDda8dKsXcR2SFvLdeWQB+kbqfTEojjBQ4TA==", "From": "Clayton Craft <craftyguy@postmarketos.org>", "Date": "Wed, 25 Mar 2026 22:59:36 -0700", "Subject": "[PATCH] linux-user: fix name_to_handle_at when\n AT_HANDLE_MNT_ID_UNIQUE flag is set", "MIME-Version": "1.0", "Content-Type": "text/plain; charset=\"utf-8\"", "Content-Transfer-Encoding": "7bit", "Message-Id": "<20260325-fix-name-to-handle-at-v1-1-49fb922e6fd3@craftyguy.net>", "X-B4-Tracking": "v=1; b=H4sIAEfLxGkC/x2MSQqAMAwAvyI5G6hxofoV8VA0akCrtEUE8e8Gj\n wMz80DkIByhyx4IfEmUwysUeQbj6vzCKJMykKHGlFTjLDd6tzOmA1WYNkaX0BAZO1NbsbWg7Rl\n Yxf/bD+/7Aey6dDlnAAAA", "X-Change-ID": "20260325-fix-name-to-handle-at-02208f294e88", "To": "qemu-devel@nongnu.org", "Cc": "Laurent Vivier <laurent@vivier.eu>,\n Pierrick Bouvier <pierrick.bouvier@linaro.org>,\n Clayton Craft <craftyguy@postmarketos.org>", "X-Developer-Signature": "v=1; a=openpgp-sha256; l=3315; i=clayton@craftyguy.net;\n h=from:subject:message-id;\n bh=Ho8XpytcBpKaG3Fogbq2tol3XZ8ae7+JsKHuqwuhAsw=;\n b=owGbwMvMwCW20X/1yekyblWMp9WSGDKPnI6JVAiyNOv0yat+8Tb26e4b+hfX6Dla2VhOlhHIC\n C+8IxXdUcrCIMbFICumyOKZsM5KdKWZonbgOwaYOaxMIEMYuDgFYCLmExkZttvuDXCbsE972S6L\n iOCzOTv/7hP5GMKVFnJl39f9jIxhSgz/Ha9sTDiZylbNFL/acf6DcxO1VjNF8M9eFbH8xt6uUz4\n HGQA=", "X-Developer-Key": "i=clayton@craftyguy.net; a=openpgp;\n fpr=3E5FFFD4A3CBAADFDA59395F1BD9F71B57D592B9", "X-Migadu-Flow": "FLOW_OUT", "Received-SPF": "pass client-ip=95.215.58.173;\n envelope-from=clayton@craftyguy.net;\n helo=out-173.mta1.migadu.com", "X-Spam_score_int": "-24", "X-Spam_score": "-2.5", "X-Spam_bar": "--", "X-Spam_report": "(-2.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,\n DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.25,\n RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001,\n RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-0.001,\n SPF_PASS=-0.001 autolearn=ham autolearn_force=no", "X-Spam_action": "no action", "X-Mailman-Approved-At": "Thu, 26 Mar 2026 09:39:19 -0400", "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": "Linux 6.12 added AT_HANDLE_MNT_ID_UNIQUE, which indicates that mount_id\nis 64-bits. If name_to_handle_at is called with this flag set then qemu\npasses a 4 byte int to the kernel, which then tries to store 8 bytes in\na 4 byte variable, causing a SIGSEGV[1][2].\n\nThis stores mount_id in a 64-bit var if the flag is set.\n\n1. https://gitlab.postmarketos.org/postmarketOS/pmaports/-/work_items/4431\n2. https://github.com/systemd/systemd/issues/41279\n\nSigned-off-by: Clayton Craft <craftyguy@postmarketos.org>\n---\nThis fixes a crash experienced recently while running qemu user mode\nwith e.g. systemd which set AT_HANDLE_MNT_ID_UNIQUE when calling\nname_to_handle_at. AT_HANDLE_MNT_ID_UNIQUE was added in Linux 6.12.\n\nI'm a bit unsure of defining AT_HANDLE_MNT_ID_UNIQUE like this,\nit's part of linux/fcntl.h but this header isn't included in\nqemu/linux-headers.\n\n1. https://gitlab.postmarketos.org/postmarketOS/pmaports/-/work_items/4431\n2. https://github.com/systemd/systemd/issues/41279\n---\n linux-user/syscall.c | 21 ++++++++++++++++++---\n 1 file changed, 18 insertions(+), 3 deletions(-)\n\n\n---\nbase-commit: 007b29752ed06e467d3c830bc2c17a8851f8bcd3\nchange-id: 20260325-fix-name-to-handle-at-02208f294e88\n\nBest regards,", "diff": "diff --git a/linux-user/syscall.c b/linux-user/syscall.c\nindex 7832a1aba5..3cb00c643e 100644\n--- a/linux-user/syscall.c\n+++ b/linux-user/syscall.c\n@@ -8166,6 +8166,9 @@ static int do_futex(CPUState *cpu, bool time64, target_ulong uaddr,\n #endif\n \n #if defined(TARGET_NR_name_to_handle_at) && defined(CONFIG_OPEN_BY_HANDLE)\n+#ifndef AT_HANDLE_MNT_ID_UNIQUE\n+#define AT_HANDLE_MNT_ID_UNIQUE 0x001\n+#endif\n static abi_long do_name_to_handle_at(abi_long dirfd, abi_long pathname,\n abi_long handle, abi_long mount_id,\n abi_long flags)\n@@ -8173,6 +8176,7 @@ static abi_long do_name_to_handle_at(abi_long dirfd, abi_long pathname,\n struct file_handle *target_fh;\n struct file_handle *fh;\n int mid = 0;\n+ uint64_t mid64 = 0;\n abi_long ret;\n char *name;\n unsigned int size, total_size;\n@@ -8196,7 +8200,12 @@ static abi_long do_name_to_handle_at(abi_long dirfd, abi_long pathname,\n fh = g_malloc0(total_size);\n fh->handle_bytes = size;\n \n- ret = get_errno(name_to_handle_at(dirfd, path(name), fh, &mid, flags));\n+ if (flags & AT_HANDLE_MNT_ID_UNIQUE) {\n+ ret = get_errno(name_to_handle_at(dirfd, path(name), fh,\n+ (int *)&mid64, flags));\n+ } else {\n+ ret = get_errno(name_to_handle_at(dirfd, path(name), fh, &mid, flags));\n+ }\n unlock_user(name, pathname, 0);\n \n /* man name_to_handle_at(2):\n@@ -8210,8 +8219,14 @@ static abi_long do_name_to_handle_at(abi_long dirfd, abi_long pathname,\n g_free(fh);\n unlock_user(target_fh, handle, total_size);\n \n- if (put_user_s32(mid, mount_id)) {\n- return -TARGET_EFAULT;\n+ if (flags & AT_HANDLE_MNT_ID_UNIQUE) {\n+ if (put_user_u64(mid64, mount_id)) {\n+ return -TARGET_EFAULT;\n+ }\n+ } else {\n+ if (put_user_s32(mid, mount_id)) {\n+ return -TARGET_EFAULT;\n+ }\n }\n \n return ret;\n", "prefixes": [] }