{"id":2221537,"url":"http://patchwork.ozlabs.org/api/1.1/patches/2221537/?format=json","web_url":"http://patchwork.ozlabs.org/project/qemu-devel/patch/20260409164938.6735-1-yixinwei@meta.com/","project":{"id":14,"url":"http://patchwork.ozlabs.org/api/1.1/projects/14/?format=json","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":"<20260409164938.6735-1-yixinwei@meta.com>","date":"2026-04-09T16:49:38","name":"linux-user: fix off-by-one in host_to_target_for_each_rtattr()","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"70072080fdd4c7e4d4957443f33b232572602c24","submitter":{"id":93103,"url":"http://patchwork.ozlabs.org/api/1.1/people/93103/?format=json","name":"Yixin Wei","email":"easonwei1998@gmail.com"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/qemu-devel/patch/20260409164938.6735-1-yixinwei@meta.com/mbox/","series":[{"id":499331,"url":"http://patchwork.ozlabs.org/api/1.1/series/499331/?format=json","web_url":"http://patchwork.ozlabs.org/project/qemu-devel/list/?series=499331","date":"2026-04-09T16:49:38","name":"linux-user: fix off-by-one in host_to_target_for_each_rtattr()","version":1,"mbox":"http://patchwork.ozlabs.org/series/499331/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/2221537/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/2221537/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=gmail.com header.i=@gmail.com header.a=rsa-sha256\n header.s=20251104 header.b=Ufthzdlf;\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 (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 4fs6Lb4Hljz1yCv\n\tfor <incoming@patchwork.ozlabs.org>; Fri, 10 Apr 2026 03:27:01 +1000 (AEST)","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 1wAt9D-0008RN-85; Thu, 09 Apr 2026 13:26:31 -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 <easonwei1998@gmail.com>)\n id 1wAsf3-0007sG-2z\n for qemu-devel@nongnu.org; Thu, 09 Apr 2026 12:55:21 -0400","from mail-wr1-x432.google.com ([2a00:1450:4864:20::432])\n by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)\n (Exim 4.90_1) (envelope-from <easonwei1998@gmail.com>)\n id 1wAsf1-0007dI-GX\n for qemu-devel@nongnu.org; Thu, 09 Apr 2026 12:55:20 -0400","by mail-wr1-x432.google.com with SMTP id\n ffacd0b85a97d-43cf7683a28so744396f8f.2\n for <qemu-devel@nongnu.org>; Thu, 09 Apr 2026 09:55:18 -0700 (PDT)","from yixinwei-mac.thefacebook.com ([2620:10d:c092:500::4:9bf4])\n by smtp.gmail.com with ESMTPSA id\n ffacd0b85a97d-43d63e46a90sm73292f8f.19.2026.04.09.09.55.15\n (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256);\n Thu, 09 Apr 2026 09:55:15 -0700 (PDT)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=gmail.com; s=20251104; t=1775753716; x=1776358516; darn=nongnu.org;\n h=content-transfer-encoding:mime-version:message-id:date:subject:cc\n :to:from:from:to:cc:subject:date:message-id:reply-to;\n bh=8cLNNdF+q/x6S9UkU3OcxSQ8zWRQMmUrvueeQ1bJbRw=;\n b=Ufthzdlf3PaNYHSSEuiCajmi4RZQRkqdHCLwPweCUgY4LwHpshnndoi6j0cOJlgwy9\n EkO9Lupdp131J2cC3eW//KBq6NG6I0rk81ts0b4mpGDrLbnpovQCb5WllyRNqiGjSpru\n Ie3stA/jwFBTG1+yA3GlNm89vwYSvzqkWamlF3hNvJsvjuL5A1pcMgYL7AJsBwB7lUr/\n CHwjdsC83L1d8g+6JKBsNZvxO26zaM5qG8aaCzX8J6ENx2ewsoaC3I59D/d12IB4bV4q\n Zl/Y2z1/yNND9POAE+Yr0ve20S30ta0lmKD+0sgkaoye1aS6Km18/9H4fUQb5qYxpZge\n RbaQ==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20251104; t=1775753716; x=1776358516;\n h=content-transfer-encoding:mime-version:message-id:date:subject:cc\n :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date\n :message-id:reply-to;\n bh=8cLNNdF+q/x6S9UkU3OcxSQ8zWRQMmUrvueeQ1bJbRw=;\n b=ZRdKqE9UvGrtxC/Rk8UXnnQu1l3XaqbMKcfPaxHRWxjbOeFmIc1L4vW+wOyH42wL7W\n aUnxDo4RUlm/qKSscRpbooFFhoPcYIcyLjteYiVrQ2DINQRoAeEuSU3Jdj/HlTKbcrD8\n eIFIDAnAMV/UWHu/M47UmHzzmplEBNDlWkZLo2vbZbXRxyfErvutxeh5ZIED44VBqkA1\n gPEjSP1IFomWDS99VuJ3tUzgTJ9NJwqHKroJIRWmQB7+04ivzxc6gWxKkxFhuBCyPexq\n mMZG/XQhm01WG79QcI63GveMgLU5Cpgb5Sp9o1FX7LOIKhx/Od71iVzLGqgTHqcItU9/\n 8W4Q==","X-Gm-Message-State":"AOJu0YweoCNkEBOqX0cbghQx5Vwwi1MzIV8FYLlKuiWyHWP9t00saGHx\n 9TIunaaK5ljFIpvLGUHVd3vpM4U+KU+KY72jhZ+i/Ytx5gRqBh/IeM4UDjQiADPuEBU=","X-Gm-Gg":"AeBDievLJVP57fxBdDFgmFbju5Hm+XmJLn1OiKreqqyiu1SLyFSI50GGoeTuYRo3b8z\n QjBjbDqX8WvZBEAI1g7uW/qYEtTJbrGRFEqy2pIpz3Yq85F+UEhJE4t9nVVf3hAMhpRCLnRCFQ/\n 12IMU1eL4yOOHlNtvSu3P8y/DYDkAhbJZ6AxvGsq5iVypFVgC8loUmPy6u0WRLu04lkGJroAquG\n G6/q/AgS/p/jBcT34Zt3gdPKaIBzRspZ7wbSF9efo2EjHCHpOiDUfAx+SEMf3wGet2jRmOD/M2k\n fsNbkackHqcl+4xxY3Xjq+PTTlXMcRlJzvkaWWMrVNxxgTN2hg2OWwd5Erhzk9cX8wGhbUc1f7D\n QjFqVu9mjWF99XJUI9Y9FGVG1cTDPbWVdG7bDIxVilJIwu55jBJdlhTBf3RGZVXt77jabrK7EQ3\n lZH2mv5ofMXVAuRLgYfPjrIElQLfB0Sw7zPbKS2B5Uhg+t9qpNkQ==","X-Received":"by 2002:a05:6000:310a:b0:43b:4212:2ee8 with SMTP id\n ffacd0b85a97d-43d292cbcd8mr36865503f8f.24.1775753716246;\n Thu, 09 Apr 2026 09:55:16 -0700 (PDT)","From":"Yixin Wei <easonwei1998@gmail.com>","X-Google-Original-From":"Yixin Wei <yixinwei@meta.com>","To":"qemu-devel@nongnu.org","Cc":"laurent@vivier.eu, richard.henderson@linaro.org, easonwei1998@gmail.com,\n Yixin Wei <yixinwei@meta.com>","Subject":"[PATCH] linux-user: fix off-by-one in\n host_to_target_for_each_rtattr()","Date":"Thu,  9 Apr 2026 17:49:38 +0100","Message-ID":"<20260409164938.6735-1-yixinwei@meta.com>","X-Mailer":"git-send-email 2.50.1","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Received-SPF":"pass client-ip=2a00:1450:4864:20::432;\n envelope-from=easonwei1998@gmail.com; helo=mail-wr1-x432.google.com","X-Spam_score_int":"-17","X-Spam_score":"-1.8","X-Spam_bar":"-","X-Spam_report":"(-1.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,\n DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,\n FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001,\n RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001,\n SPF_PASS=-0.001 autolearn=ham autolearn_force=no","X-Spam_action":"no action","X-Mailman-Approved-At":"Thu, 09 Apr 2026 13:26:29 -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":"host_to_target_for_each_rtattr() uses \"len > sizeof(struct rtattr)\"\nas its loop condition. When the last rtattr in a netlink message has\nexactly sizeof(struct rtattr) (4) bytes remaining, the loop exits\nwithout byte-swapping its rta_len and rta_type. A big-endian guest\nthen reads rta_len in the wrong byte order and fails validation.\n\nThe companion function target_to_host_for_each_rtattr() correctly\nuses \">=\" (added in commit fa2229dbf8). The kernel's RTA_OK macro\nalso uses \">=\". Fix the host_to_target direction to match.\n\nResolves: https://gitlab.com/qemu-project/qemu/-/issues/2485\nSigned-off-by: Yixin Wei <yixinwei@meta.com>\n---\n linux-user/fd-trans.c | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)","diff":"diff --git a/linux-user/fd-trans.c b/linux-user/fd-trans.c\nindex 64dd0745d2..7f55a0690b 100644\n--- a/linux-user/fd-trans.c\n+++ b/linux-user/fd-trans.c\n@@ -480,7 +480,7 @@ static abi_long host_to_target_for_each_rtattr(struct rtattr *rtattr,\n     unsigned short aligned_rta_len;\n     abi_long ret;\n \n-    while (len > sizeof(struct rtattr)) {\n+    while (len >= sizeof(struct rtattr)) {\n         rta_len = rtattr->rta_len;\n         if (rta_len < sizeof(struct rtattr) ||\n             rta_len > len) {\n","prefixes":[]}