From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 8EB2B46B3E; Wed, 16 Jul 2025 08:00:24 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 82E19402D4; Wed, 16 Jul 2025 08:00:23 +0200 (CEST) Received: from mail.lysator.liu.se (mail.lysator.liu.se [130.236.254.3]) by mails.dpdk.org (Postfix) with ESMTP id 8804B4013F; Wed, 16 Jul 2025 08:00:22 +0200 (CEST) Received: from mail.lysator.liu.se (localhost [127.0.0.1]) by mail.lysator.liu.se (Postfix) with ESMTP id DF4781A725; Wed, 16 Jul 2025 08:00:21 +0200 (CEST) Received: by mail.lysator.liu.se (Postfix, from userid 1004) id B26F11A676; Wed, 16 Jul 2025 08:00:21 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on hermod.lysator.liu.se X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED autolearn=disabled version=4.0.1 X-Spam-Score: -1.0 Received: from [192.168.1.85] (h-62-63-215-114.A163.priv.bahnhof.se [62.63.215.114]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by mail.lysator.liu.se (Postfix) with ESMTPSA id 8C82B1A78E; Wed, 16 Jul 2025 08:00:19 +0200 (CEST) Message-ID: Date: Wed, 16 Jul 2025 08:00:19 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v2 08/10] hash: fix unaligned access in predictable RSS To: David Marchand , dev@dpdk.org Cc: stable@dpdk.org, Yipeng Wang , Sameh Gobriel , Bruce Richardson , Vladimir Medvedkin , John McNamara , Konstantin Ananyev References: <20250619071037.37325-1-david.marchand@redhat.com> <20250623135242.461965-1-david.marchand@redhat.com> <20250623135242.461965-9-david.marchand@redhat.com> Content-Language: en-US From: =?UTF-8?Q?Mattias_R=C3=B6nnblom?= In-Reply-To: <20250623135242.461965-9-david.marchand@redhat.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Virus-Scanned: ClamAV using ClamSMTP X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org On 2025-06-23 15:52, David Marchand wrote: > Caught by UBSan: > > ../lib/hash/rte_thash.c:421:8: runtime error: load of misaligned address > 0x0001816c2da3 for type 'uint32_t' (aka 'unsigned int'), > which requires 4 byte alignment > > Fixes: 28ebff11c2dc ("hash: add predictable RSS") > Cc: stable@dpdk.org > > Signed-off-by: David Marchand Acked-by: Mattias Rönnblom > --- > lib/hash/rte_thash.c | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > > diff --git a/lib/hash/rte_thash.c b/lib/hash/rte_thash.c > index 6c662bf14f..6d4dbea6d7 100644 > --- a/lib/hash/rte_thash.c > +++ b/lib/hash/rte_thash.c > @@ -415,10 +415,10 @@ generate_subkey(struct rte_thash_ctx *ctx, struct thash_lfsr *lfsr, > static inline uint32_t > get_subvalue(struct rte_thash_ctx *ctx, uint32_t offset) > { > - uint32_t *tmp, val; > + uint32_t tmp, val; > > - tmp = (uint32_t *)(&ctx->hash_key[offset >> 3]); > - val = rte_be_to_cpu_32(*tmp); > + memcpy(&tmp, &ctx->hash_key[offset >> 3], sizeof(tmp)); > + val = rte_be_to_cpu_32(tmp); > val >>= (TOEPLITZ_HASH_LEN - ((offset & (CHAR_BIT - 1)) + > ctx->reta_sz_log)); >