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 C6058469F8; Thu, 19 Jun 2025 09:12:11 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 7157F42E5B; Thu, 19 Jun 2025 09:11:57 +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 DD1F442E5D for ; Thu, 19 Jun 2025 09:11:56 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1750317116; 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=m661c+oZMAJPvQqVQf0Kme0uhdVgj3mRY9OuAIZVJ5I=; b=bpRWO7DGXgyIehYIne2TqRoy/ncC84MPWLL8I/xX3Qvi/q4DNK7YIjhezbrFfmoJzhf+Wr cVqAOPV7657UoMovBMLDHrZGI6S58Cj36k/uDXBg2/Up79PEcGK491LsuO7oSAV4GmiQZt Jkl23o5M/zyoFP464WFpyBlDY1LqHk4= Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-575-qBFtXRWBMCmfHDzWlbWYXg-1; Thu, 19 Jun 2025 03:11:53 -0400 X-MC-Unique: qBFtXRWBMCmfHDzWlbWYXg-1 X-Mimecast-MFC-AGG-ID: qBFtXRWBMCmfHDzWlbWYXg_1750317111 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (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-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 6DB181956096; Thu, 19 Jun 2025 07:11:51 +0000 (UTC) Received: from dmarchan.lan (unknown [10.44.33.8]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 734A430001A1; Thu, 19 Jun 2025 07:11:48 +0000 (UTC) From: David Marchand To: dev@dpdk.org Cc: stable@dpdk.org, Yipeng Wang , Sameh Gobriel , Bruce Richardson , Vladimir Medvedkin , Konstantin Ananyev , John McNamara Subject: [PATCH 08/10] hash: fix unaligned access in predictable RSS Date: Thu, 19 Jun 2025 09:10:34 +0200 Message-ID: <20250619071037.37325-9-david.marchand@redhat.com> In-Reply-To: <20250619071037.37325-1-david.marchand@redhat.com> References: <20250619071037.37325-1-david.marchand@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: nYA0VJf56ezf8iX0EYoVY3cyDvPbcXhhBbxwOMZlfZc_1750317111 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit content-type: text/plain; charset="US-ASCII"; x-default=true 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 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 --- 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.49.0