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 C750FA050B for ; Thu, 7 Apr 2022 17:24:24 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B9C6B410EF; Thu, 7 Apr 2022 17:24:24 +0200 (CEST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mails.dpdk.org (Postfix) with ESMTP id 5B2D440689 for ; Thu, 7 Apr 2022 17:24:23 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1649345062; 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: in-reply-to:in-reply-to:references:references; bh=PYRfrsR3wdeoNmFuGWSszkCAQDJayWXu7l1HhQic1kk=; b=C7SyjMX1KjVzPKrZVaU9KKJeu2n3UexemUhn9YTRPrI6GXVkMW6w4KsfyG9pViax7OyB9u HMJOW/5BBSEU75pQez5wDJmFEhlhwKKCeSnGtElXFCN7yPdS1a7YAuViCp2MzrTywMP6Uw 4D3haDFdfMl4FO98qEqvKLCJJIO9iYk= Received: from mail-lj1-f198.google.com (mail-lj1-f198.google.com [209.85.208.198]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-662-TeYyRUsbP4KBGLcw2YBsvg-1; Thu, 07 Apr 2022 11:24:20 -0400 X-MC-Unique: TeYyRUsbP4KBGLcw2YBsvg-1 Received: by mail-lj1-f198.google.com with SMTP id v8-20020a2e7a08000000b002498273eb20so2277804ljc.7 for ; Thu, 07 Apr 2022 08:24:20 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=PYRfrsR3wdeoNmFuGWSszkCAQDJayWXu7l1HhQic1kk=; b=oUME/EccR6pvc4gfZxm7GHZeHOsmxptcsjEza7SeCCgeJGa+hdXGU+BN1Uy4ehhZYP YnSxbWxzNjOScP6PQ2/o+EFXo/hig6DjVOZ//knbTA6SaqMV4wmrZAYxyS/de2akFWGe u4RAGuXF6UOJMdF24AaJtUapxL8Y+yoHI+l2s2GulayoTPRPxMMa0CvTJ1iZD0HVFN+Y 6sqwzP8wH3jMNL0Dq5ilATjJBYmTTIn65y8q/dqPw+jkFJNKf2DqPbxB/bSEuG8piNmQ wD/elzRRfSgUodR6Bo2C0PwrcjAm0GjYfhXiV6t00CPfsQHw31yjI2XmtnhGadfHkRzG 3m2w== X-Gm-Message-State: AOAM5325LLNi9+Z7hyjDwD1g7SWeaiHHFmyNHbCF28hWM8VQ7xu7+TNQ cIDOd8bR7ZoUvaCsm9oBRtjq3N9Vu+kA5EC2iOZkHGBYPbpRoGYH1Ba41PpiR2Lhz497px6155V 932IbYoSffckN2hTe3cmDI/8= X-Received: by 2002:a05:6512:398a:b0:44a:56b9:c03e with SMTP id j10-20020a056512398a00b0044a56b9c03emr9596375lfu.553.1649345059191; Thu, 07 Apr 2022 08:24:19 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxWXiBRuflpViSPugNwgSYt8zUfD6vWZdTkBC8xf04/LvgLzW8kd5ZicGUgtdls9VJswHSoQsbmu01GOFKk1ic= X-Received: by 2002:a05:6512:398a:b0:44a:56b9:c03e with SMTP id j10-20020a056512398a00b0044a56b9c03emr9596344lfu.553.1649345058847; Thu, 07 Apr 2022 08:24:18 -0700 (PDT) MIME-Version: 1.0 References: <20220115194102.444140-1-lucp.at.work@gmail.com> <20220225163804.506142-1-lucp.at.work@gmail.com> In-Reply-To: From: David Marchand Date: Thu, 7 Apr 2022 17:24:07 +0200 Message-ID: Subject: Re: [PATCH v7] eal: fix rte_memcpy strict aliasing/alignment bugs To: "Ananyev, Konstantin" , Luc Pelletier Cc: "Richardson, Bruce" , "dev@dpdk.org" , "Li, Xiaoyun" , "stable@dpdk.org" , Aaron Conole , Owen Hilyard Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=dmarchan@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="UTF-8" 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 On Thu, Mar 10, 2022 at 3:55 PM Ananyev, Konstantin wrote: > > Calls to rte_memcpy for 1 < n < 16 could result in unaligned > > loads/stores, which is undefined behaviour according to the C > > standard, and strict aliasing violations. > > > > The code was changed to use a packed structure that allows aliasing > > (using the __may_alias__ attribute) to perform the load/store > > operations. This results in code that has the same performance as the > > original code and that is also C standards-compliant. > > > > Fixes: d35cc1fe6a7a ("eal/x86: revert select optimized memcpy at run-time") > > Cc: stable@dpdk.org > > > > Signed-off-by: Luc Pelletier > Acked-by: Konstantin Ananyev > Tested-by: Konstantin Ananyev Thanks, applied. > As a side note, we probably need to check other similar places in DPDK code. What would be the best way to detect those problematic places? I tried UBsan, and it did report some of the issues fixed with this patch. -- David Marchand