Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/1.2/patches/2233150/?format=api
{ "id": 2233150, "url": "http://patchwork.ozlabs.org/api/1.2/patches/2233150/?format=api", "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20260505185157.608910-3-peter.maydell@linaro.org/", "project": { "id": 14, "url": "http://patchwork.ozlabs.org/api/1.2/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": "<20260505185157.608910-3-peter.maydell@linaro.org>", "list_archive_url": null, "date": "2026-05-05T18:51:57", "name": "[2/2] hw/net/rocker_of_dpa: Avoid unaligned accesses in _of_dpa_flow_match()", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "f6dd02a1c2bb418e2f018c5147fac8286fd461f6", "submitter": { "id": 5111, "url": "http://patchwork.ozlabs.org/api/1.2/people/5111/?format=api", "name": "Peter Maydell", "email": "peter.maydell@linaro.org" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20260505185157.608910-3-peter.maydell@linaro.org/mbox/", "series": [ { "id": 502883, "url": "http://patchwork.ozlabs.org/api/1.2/series/502883/?format=api", "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/list/?series=502883", "date": "2026-05-05T18:51:56", "name": "hw/net_rocker_of_dpa: two bugfixes", "version": 1, "mbox": "http://patchwork.ozlabs.org/series/502883/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/2233150/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/2233150/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=linaro.org header.i=@linaro.org header.a=rsa-sha256\n header.s=google header.b=e8TDMAC8;\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 4g971w4hRvz1yJx\n\tfor <incoming@patchwork.ozlabs.org>; Wed, 06 May 2026 04:53:08 +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 1wKKsv-00037M-Lf; Tue, 05 May 2026 14:52:47 -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 <peter.maydell@linaro.org>)\n id 1wKKsI-0002hw-6Y\n for qemu-devel@nongnu.org; Tue, 05 May 2026 14:52:12 -0400", "from mail-wm1-x331.google.com ([2a00:1450:4864:20::331])\n by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)\n (Exim 4.90_1) (envelope-from <peter.maydell@linaro.org>)\n id 1wKKsF-0007Aa-Ep\n for qemu-devel@nongnu.org; Tue, 05 May 2026 14:52:05 -0400", "by mail-wm1-x331.google.com with SMTP id\n 5b1f17b1804b1-488a9033b2cso49794535e9.2\n for <qemu-devel@nongnu.org>; Tue, 05 May 2026 11:52:02 -0700 (PDT)", "from lanath.. (wildly.archaic.org.uk. [81.2.115.145])\n by smtp.gmail.com with ESMTPSA id\n 5b1f17b1804b1-48a8eb6ffb7sm377086675e9.5.2026.05.05.11.51.59\n (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n Tue, 05 May 2026 11:52:00 -0700 (PDT)" ], "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=linaro.org; s=google; t=1778007121; x=1778611921; darn=nongnu.org;\n h=content-transfer-encoding:mime-version:references:in-reply-to\n :message-id:date:subject:cc:to:from:from:to:cc:subject:date\n :message-id:reply-to;\n bh=wyvNlrhCDRRoXpiivbyJr1JUobLzjlCgnPIPMN8niGU=;\n b=e8TDMAC8hdMUCiKLjoTALciievk2cGh+1TGnB05PvLBeJrxTUHcLUa/9Z52XG1eu1n\n aB1nY+A6q3LTRWoVSoUguoLD4OjKOSq2xtNnh3MNDQaUA06GBex6l4N+5iPCf/oSX1/p\n cTpcX9KJBF3dW44RpRKofB+AZY/VTk09eSOFxrCtSegNK5MqugFxcYSoElwJ0xDdJQRJ\n 0yGSc5lyEMo5KpvLERF3E9AjFgQGEDPDr0hlBYt6AUw5ovbeCaVozXIOhUjaR+m1t2lK\n WCB0d4uEpXUzz5To8bR+NfipzXpfIyKxJlO4SJb8QtOnCwrcUpGtlVKJOtR9b0vfCE8P\n OxXg==", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20251104; t=1778007121; x=1778611921;\n h=content-transfer-encoding:mime-version:references:in-reply-to\n :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from\n :to:cc:subject:date:message-id:reply-to;\n bh=wyvNlrhCDRRoXpiivbyJr1JUobLzjlCgnPIPMN8niGU=;\n b=o6rEoZSxCpTfNVH2D7/0eRaJcc46hr5T43fVUtlC0b9BnthVzsTIdAQnmnngcq6SO9\n IyEV/hBBjjOpCoh+LytKvAbhD+HB1RewMsXU34rGtVK5pW+zj31xW12MYmCyQFxdQ1J8\n 0GmM1TeIDktOvwDxYh4QOUCjN7yqpBqTwB6micsJ8SdhLqjpUS4eV5BNH0HFDLr3YKPS\n 8UuA6EZsbpAM7ewtJmTCyPrHXYXqhil9b6D/K5oKTfOY9FkXY6vRTyW4/xhzIQfBxdBW\n rbcw3YFlIBXvdquGGoGAQrBeZnEuQUEj0W5HtRcDx4kntwQttsnULhaAHdffMrTPHpq9\n bM8Q==", "X-Gm-Message-State": "AOJu0YxQV+XjBU9xMQ/A65tcb6kYJXUtEAvXDGjjwpNO8nBvO2eTxNNT\n ZKLzis6/H59XzxX9k5lLZ0DS8oL2l41TniRfVXaPgEKeT6PkE9hlUU23+M98xq0pTpVnw9miXd6\n bB0Ir", "X-Gm-Gg": "AeBDiesRbgbvHbJVqmeyq8XH73MMB1jhs4V2lUovfK2KzLQUUg8kz+6Z8L44hWvAoPW\n /qEV2wbDhHEQO69AQ8AkKj5qZuHRTTOiJ6AEwuJuSDXmz+bl8IVjRiA+vZFq99xar+XTn8gWwaG\n ahiN8C7ggZfLqEn7gS/L85YGk5ajmdkjjVBq+ixg+9O/bImnXHjdUlSPs3t3j/ryzOXfSdp7Coy\n fVMtwlQwhDW6jMHYr+02AITPwBU3UvLQiAkWXgemaANdFbNDyeXjr1om4GdSaGr2HykR+t4/6zi\n YR0GANaNB2o7EtmRci/ZBNpPhNx4C12N3OuYj+m0bN0QmT58Ky5DhceHRdbZtRe+saUdf6nX7vt\n GMZ8yZDzYtqmTpKpCKSH+PF8VpmBrBdY8KdaZNAfhThzpsolhsV+Z5Fc9In+ZS42krRwCOFoYzz\n /OocHieDPF6JkaOWhTCuXYY/8aOC/5fWsuLf9VS4KaCCfKbioJUaOMaM3by1GnKy3qWzcWwS1HD\n 1glF45jb70VTIMPxABuk/xH9TFXfG2N+iGCpPjGpA==", "X-Received": "by 2002:a05:600c:1f0d:b0:48a:93d2:60d2 with SMTP id\n 5b1f17b1804b1-48e51dd9772mr8473475e9.0.1778007120740;\n Tue, 05 May 2026 11:52:00 -0700 (PDT)", "From": "Peter Maydell <peter.maydell@linaro.org>", "To": "qemu-devel@nongnu.org", "Cc": "Jiri Pirko <jiri@resnulli.us>,\n\tJason Wang <jasowang@redhat.com>", "Subject": "[PATCH 2/2] hw/net/rocker_of_dpa: Avoid unaligned accesses in\n _of_dpa_flow_match()", "Date": "Tue, 5 May 2026 19:51:57 +0100", "Message-ID": "<20260505185157.608910-3-peter.maydell@linaro.org>", "X-Mailer": "git-send-email 2.43.0", "In-Reply-To": "<20260505185157.608910-1-peter.maydell@linaro.org>", "References": "<20260505185157.608910-1-peter.maydell@linaro.org>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Received-SPF": "pass client-ip=2a00:1450:4864:20::331;\n envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x331.google.com", "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, DKIM_SIGNED=0.1,\n DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,\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-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": "_of_dpa_flow_match() tries to do masked comparisons of OfDpaFlowkey\nstructs by casting pointers to them to uint64_t* and then doing the\nmemory accesses as 64-bit. This is undefined behaviour because the\npointers might not be 64-bit aligned, and the UB sanitizer spots this:\n\n../../hw/net/rocker/rocker_of_dpa.c:321:20: runtime error: load of misaligned address 0x512000164044 for type 'uint64_t' (aka 'unsigned long'), which requires 8 byte alignment\n0x512000164044: note: pointer points here\n 02 00 00 00 00 00 ff ff 00 00 00 00 ff ff ff ff 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00\n ^\n\nWe do know that OfDpaFlowKey structs must be at least aligned enough\nfor uint32_t accesses, because that's the type of the first field.\nSwitch to using uint32_t accesses in the loop.\n\nBecause the \"width\" field is always set via the FLOW_KEY_WIDTH macro\nand not exposed to the guest, we can adjust the macro to store the\nnumber of uint32_t to be checked rather than needing to change the\nloop boundary in the match function.\n\nCc: qemu-stable@nongnu.org\nSigned-off-by: Peter Maydell <peter.maydell@linaro.org>\n---\n hw/net/rocker/rocker_of_dpa.c | 12 ++++++------\n 1 file changed, 6 insertions(+), 6 deletions(-)", "diff": "diff --git a/hw/net/rocker/rocker_of_dpa.c b/hw/net/rocker/rocker_of_dpa.c\nindex 958f3006c1..3d6f55b512 100644\n--- a/hw/net/rocker/rocker_of_dpa.c\n+++ b/hw/net/rocker/rocker_of_dpa.c\n@@ -99,13 +99,13 @@ typedef struct of_dpa_flow_key {\n } nd;\n } ipv6;\n };\n- int width; /* how many uint64_t's in key? */\n+ int width; /* how many uint32_t's in key? */\n } OfDpaFlowKey;\n \n-/* Width of key which includes field 'f' in u64s, rounded up */\n+/* Width of key which includes field 'f' in u32s, rounded up */\n #define FLOW_KEY_WIDTH(f) \\\n DIV_ROUND_UP(offsetof(OfDpaFlowKey, f) + sizeof_field(OfDpaFlowKey, f), \\\n- sizeof(uint64_t))\n+ sizeof(uint32_t))\n \n typedef struct of_dpa_flow_action {\n uint32_t goto_tbl;\n@@ -304,9 +304,9 @@ static void _of_dpa_flow_match(void *key, void *value, void *user_data)\n {\n OfDpaFlow *flow = value;\n OfDpaFlowMatch *match = user_data;\n- uint64_t *k = (uint64_t *)&flow->key;\n- uint64_t *m = (uint64_t *)&flow->mask;\n- uint64_t *v = (uint64_t *)&match->value;\n+ uint32_t *k = (uint32_t *)&flow->key;\n+ uint32_t *m = (uint32_t *)&flow->mask;\n+ uint32_t *v = (uint32_t *)&match->value;\n int i;\n \n if (flow->key.tbl_id == match->value.tbl_id) {\n", "prefixes": [ "2/2" ] }