get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 2231742,
    "url": "http://patchwork.ozlabs.org/api/1.1/patches/2231742/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20260501111854.15674-1-deller@kernel.org/",
    "project": {
        "id": 14,
        "url": "http://patchwork.ozlabs.org/api/1.1/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": ""
    },
    "msgid": "<20260501111854.15674-1-deller@kernel.org>",
    "date": "2026-05-01T11:18:54",
    "name": "linux-user: Fix AT_EXECFN in AUXV for symlinked programs",
    "commit_ref": null,
    "pull_url": null,
    "state": "new",
    "archived": false,
    "hash": "e9adf0fabb389c46e8468815e7df459d6d47103a",
    "submitter": {
        "id": 87076,
        "url": "http://patchwork.ozlabs.org/api/1.1/people/87076/?format=api",
        "name": "Helge Deller",
        "email": "deller@kernel.org"
    },
    "delegate": null,
    "mbox": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20260501111854.15674-1-deller@kernel.org/mbox/",
    "series": [
        {
            "id": 502443,
            "url": "http://patchwork.ozlabs.org/api/1.1/series/502443/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/list/?series=502443",
            "date": "2026-05-01T11:18:54",
            "name": "linux-user: Fix AT_EXECFN in AUXV for symlinked programs",
            "version": 1,
            "mbox": "http://patchwork.ozlabs.org/series/502443/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/2231742/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/2231742/checks/",
    "tags": {},
    "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=kernel.org header.i=@kernel.org header.a=rsa-sha256\n header.s=k20201202 header.b=uz3Dx0Pt;\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=lists1p.gnu.org;\n envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n receiver=patchwork.ozlabs.org)"
        ],
        "Received": [
            "from lists1p.gnu.org (lists1p.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 4g6T8y0qCwz1xqf\n\tfor <incoming@patchwork.ozlabs.org>; Fri, 01 May 2026 21:20:00 +1000 (AEST)",
            "from localhost ([::1] helo=lists1p.gnu.org)\n\tby lists1p.gnu.org with esmtp (Exim 4.90_1)\n\t(envelope-from <qemu-devel-bounces@nongnu.org>)\n\tid 1wIltq-0008GJ-4i; Fri, 01 May 2026 07:19:14 -0400",
            "from eggs.gnu.org ([2001:470:142:3::10])\n by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)\n (Exim 4.90_1) (envelope-from <deller@kernel.org>) id 1wIltn-0008Fi-HM\n for qemu-devel@nongnu.org; Fri, 01 May 2026 07:19:11 -0400",
            "from tor.source.kernel.org ([2600:3c04:e001:324:0:1991:8:25])\n by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)\n (Exim 4.90_1) (envelope-from <deller@kernel.org>) id 1wIltl-0005rO-RU\n for qemu-devel@nongnu.org; Fri, 01 May 2026 07:19:11 -0400",
            "from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58])\n by tor.source.kernel.org (Postfix) with ESMTP id 9DA6E6011F;\n Fri,  1 May 2026 11:19:00 +0000 (UTC)",
            "by smtp.kernel.org (Postfix) with ESMTPSA id 9B578C2BCB4;\n Fri,  1 May 2026 11:18:59 +0000 (UTC)"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org;\n s=k20201202; t=1777634340;\n bh=gonc7RCHdVYjcEQb8ak4HONl3LWUpKP3jqs5xJvEy9o=;\n h=From:To:Cc:Subject:Date:From;\n b=uz3Dx0PteJkt2K5Qg5MQ9P09zMaJe74+V+D8nGmNCN7Hid2aWmB24Qf+hkcPjZKa4\n uIGFUIuAUwb/Gql6xQ6pzN1Pf6e/e9fFLo+bUbj8wLFjuJBswiAEPwgre4W8GPZVV0\n NUdxwPeHZWwp+VaAzHTtCYNiRWbyeczZNDGNTcM1lhxZXSvtvrDEU+UhOrVHz+zV77\n 9sqj8FEKbWBjU/9KtHsc+sk5CUootQ16w89iY8eXCbzSJKw04gbsXhKGO3YzXYHf0C\n Xrt1DgTAiraKc0BAmFwf0nEbbtC6aTOTD9Mo8p+1eTG5f7xFT9JEYK2wcuTkxCm4LM\n 8beRK5lh6HeJA==",
        "From": "Helge Deller <deller@kernel.org>",
        "To": "qemu-devel@nongnu.org",
        "Cc": "deller@gmx.de",
        "Subject": "[PATCH] linux-user: Fix AT_EXECFN in AUXV for symlinked programs",
        "Date": "Fri,  1 May 2026 13:18:54 +0200",
        "Message-ID": "<20260501111854.15674-1-deller@kernel.org>",
        "X-Mailer": "git-send-email 2.53.0",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Received-SPF": "pass client-ip=2600:3c04:e001:324:0:1991:8:25;\n envelope-from=deller@kernel.org; helo=tor.source.kernel.org",
        "X-Spam_score_int": "-20",
        "X-Spam_score": "-2.1",
        "X-Spam_bar": "--",
        "X-Spam_report": "(-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001,\n DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,\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: Helge Deller <deller@gmx.de>\n\nThe AT_EXECFN entry in AUXV needs to keep the value which was used when\nthe program was started. Especially for symlinked programs qemu should\nnot try to resolve the realpath.\n\nHere is a reproducer:\n(arm64-chroot)root@p100:/# cd /usr/bin\n(arm64-chroot)root@p100:/usr/bin# ln -s echo testprog\n(arm64-chroot)root@p100:/usr/bin# LD_SHOW_AUXV=1 ./testprog | grep AT_EXECFN\nAT_EXECFN:            ./testprog\n\nIn this example, \"./testprog\" is the correct output, and not \"/usr/bin/echo\".\n\nThis patch fixes parts of commit 258bec39 (\"linux-user: Fix access to\n/proc/self/exe\").\n\nFixes: 258bec39 (\"linux-user: Fix access to /proc/self/exe\")\nResolves: https://gitlab.com/qemu-project/qemu/-/work_items/3379\nSigned-off-by: Helge Deller <deller@gmx.de>\n---\n linux-user/main.c           |  6 ++++--\n linux-user/syscall.c        | 14 +++++++-------\n linux-user/user-internals.h |  1 +\n 3 files changed, 12 insertions(+), 9 deletions(-)",
    "diff": "diff --git a/linux-user/main.c b/linux-user/main.c\nindex 86d04cca3c..c08c73fd80 100644\n--- a/linux-user/main.c\n+++ b/linux-user/main.c\n@@ -772,8 +772,10 @@ int main(int argc, char **argv, char **envp)\n     }\n \n     /* Resolve executable file name to full path name */\n-    if (realpath(exec_path, real_exec_path)) {\n-        exec_path = real_exec_path;\n+    /* Keep how we started the program in exec_path, e.g. \"./my_program\" */\n+    /* Store real path in real_exec_path, e.g. \"/usr/local/bin/my_program\" */\n+    if (!realpath(exec_path, real_exec_path)) {\n+        printf(\"Could not resolve %s\\n\", exec_path);\n     }\n \n     /*\ndiff --git a/linux-user/syscall.c b/linux-user/syscall.c\nindex d3d9fffb54..65bbeb8551 100644\n--- a/linux-user/syscall.c\n+++ b/linux-user/syscall.c\n@@ -8790,9 +8790,9 @@ static int maybe_do_fake_open(CPUArchState *cpu_env, int dirfd,\n             return -1;\n         }\n         if (safe) {\n-            return safe_openat(dirfd, exec_path, flags, mode);\n+            return safe_openat(dirfd, real_exec_path, flags, mode);\n         } else {\n-            return openat(dirfd, exec_path, flags, mode);\n+            return openat(dirfd, real_exec_path, flags, mode);\n         }\n     }\n \n@@ -8929,9 +8929,9 @@ ssize_t do_guest_readlink(const char *pathname, char *buf, size_t bufsiz)\n          * Don't worry about sign mismatch as earlier mapping\n          * logic would have thrown a bad address error.\n          */\n-        ret = MIN(strlen(exec_path), bufsiz);\n+        ret = MIN(strlen(real_exec_path), bufsiz);\n         /* We cannot NUL terminate the string. */\n-        memcpy(buf, exec_path, ret);\n+        memcpy(buf, real_exec_path, ret);\n     } else {\n         ret = readlink(path(pathname), buf, bufsiz);\n     }\n@@ -9022,7 +9022,7 @@ static int do_execv(CPUArchState *cpu_env, int dirfd,\n \n     const char *exe = p;\n     if (is_proc_myself(p, \"exe\")) {\n-        exe = exec_path;\n+        exe = real_exec_path;\n     }\n     ret = is_execveat\n         ? safe_execveat(dirfd, exe, argp, envp, flags)\n@@ -11033,9 +11033,9 @@ static abi_long do_syscall1(CPUArchState *cpu_env, int num, abi_long arg1,\n                  * Don't worry about sign mismatch as earlier mapping\n                  * logic would have thrown a bad address error.\n                  */\n-                ret = MIN(strlen(exec_path), arg4);\n+                ret = MIN(strlen(real_exec_path), arg4);\n                 /* We cannot NUL terminate the string. */\n-                memcpy(p2, exec_path, ret);\n+                memcpy(p2, real_exec_path, ret);\n             } else {\n                 ret = get_errno(readlinkat(arg1, path(p), p2, arg4));\n             }\ndiff --git a/linux-user/user-internals.h b/linux-user/user-internals.h\nindex 24d35998f0..7730444aa5 100644\n--- a/linux-user/user-internals.h\n+++ b/linux-user/user-internals.h\n@@ -24,6 +24,7 @@\n #include \"exec/translation-block.h\"\n \n extern char *exec_path;\n+extern char real_exec_path[PATH_MAX];\n void init_task_state(TaskState *ts);\n void task_settid(TaskState *);\n void stop_all_tasks(void);\n",
    "prefixes": []
}