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 46CD146B27 for ; Tue, 8 Jul 2025 14:30:24 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 3EB964068A; Tue, 8 Jul 2025 14:30:24 +0200 (CEST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mails.dpdk.org (Postfix) with ESMTP id 953354068A for ; Tue, 8 Jul 2025 14:30:22 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1751977822; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=5t9yploWbX/jcIoaytNm+uJ78DSsjQIRz3Sg8E5Iaik=; b=d4f0zOntBsPBk7kYZ0QHffJL9v5SUE66apqEniMc8lq477q8tUE7c006Oh3D5HySK73Xca P/FXicHKRvuNk1gaHjUYDY+uUVWrF6p38LgPMZAdcFLS7mE3bUa4paCgNr9vIPvlGeDvKD gP/HezHMlu3UsvV5T2txSbQ+x2/5Bkg= Received: from mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-487-3gg0rtClNLO3epfZAOncmA-1; Tue, 08 Jul 2025 08:30:20 -0400 X-MC-Unique: 3gg0rtClNLO3epfZAOncmA-1 X-Mimecast-MFC-AGG-ID: 3gg0rtClNLO3epfZAOncmA_1751977819 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 395FC18002ED; Tue, 8 Jul 2025 12:30:19 +0000 (UTC) Received: from dmarchan.lan (unknown [10.44.33.95]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 6600E18002B5; Tue, 8 Jul 2025 12:30:11 +0000 (UTC) From: David Marchand To: dev@dpdk.org Cc: stable@dpdk.org, Bruce Richardson , Yipeng Wang , Sameh Gobriel , Vladimir Medvedkin , John McNamara , Konstantin Ananyev Subject: [PATCH v3 08/18] hash: fix unaligned access in predictable RSS Date: Tue, 8 Jul 2025 14:28:12 +0200 Message-ID: <20250708122823.3406288-9-david.marchand@redhat.com> In-Reply-To: <20250708122823.3406288-1-david.marchand@redhat.com> References: <20250619071037.37325-1-david.marchand@redhat.com> <20250708122823.3406288-1-david.marchand@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: 5kc3SlNu5jWjRp4_9UuRhmou4hgtVC4U1jnn-hgKXqA_1751977819 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit content-type: text/plain; charset="US-ASCII"; x-default=true X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org 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: Bruce Richardson --- 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)); -- 2.50.0