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 E594AA0559 for ; Fri, 3 Jun 2022 11:41:45 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id BE09840691; Fri, 3 Jun 2022 11:41:45 +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 34B1840691 for ; Fri, 3 Jun 2022 11:41:44 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1654249303; 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=vyGE6o3nGgTv5V0VTTEbRzIkL5r6LtTeo9Tvg/qYxQ0=; b=BSqbp9egS04kZjpTJaQ05eDBX3MALkYDamabaIEET5H6TVP5IHv+bcdBcTs74fDwDJWn0r Cc7RK9Kjs6628TAlzgEWvI7Qgbo6vrOZGQWsTrdCfn5Vc+CPOoslQN/YWm+ayWQfx6Ipox GK8BaShz7fBkl58yCG+C/EBB+BKKfCE= 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-529-DAVNHMzUOvyQYOHHb_9xCg-1; Fri, 03 Jun 2022 05:41:42 -0400 X-MC-Unique: DAVNHMzUOvyQYOHHb_9xCg-1 Received: by mail-lj1-f198.google.com with SMTP id s15-20020a2e9c0f000000b002554eee26ebso1185310lji.21 for ; Fri, 03 Jun 2022 02:41:42 -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=vyGE6o3nGgTv5V0VTTEbRzIkL5r6LtTeo9Tvg/qYxQ0=; b=Q/UJifHVfo5RtSaUKpG+eFRYSbk5d4I7uv60+e+lv9rKDq1RzczkQ75JASNpMnuQ3F DWulit4O6Dhgnhxxysg53aMkt7VI6Itb6Sg4DtF/o9uW2eBu+fWdoSYqVUZXQrMte1Pe gkhj7pUufGOdmwQeXXTNPv9atz/WuTc7EFasGUlTqmQD3j4V1VKEfbaak6hVQQCZuos3 NsFoWPXLCa4Qu/Y8Ok5PscNV+itqQKbBA0nDHqWx5S7ln84h/0Od1jd8Z9aPINKjoTap YqqpinxG6eA6cotQ3UiNycavehsTpHe7LtouqxD6vOPIZBRgYaRN2RfkTUHqW/Dv4qt2 E6fg== X-Gm-Message-State: AOAM532MUC7i2G0ucN1xP9SiOzROy2KvIGbnzlGAzwoNhEe0REnbkWeb rZRj35jTcV6LDV5n+G9rgbQrTpMd81CaBkylCLTGXA4gnfmBkewEAjyyRPB1sMHVVMd4+UbTpkS U2/MPpRsrFkxyjwqdm1okqJ8= X-Received: by 2002:a05:6512:259f:b0:477:bbc5:182c with SMTP id bf31-20020a056512259f00b00477bbc5182cmr32199458lfb.265.1654249301091; Fri, 03 Jun 2022 02:41:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwAFeAIyn5DXZGZMM10SaEh2FLoHREY6xj1L7VgqhcGiJXS2Enqd8HR/xkNtNAyGXq0Xu7hozRytlbGHgymK9k= X-Received: by 2002:a05:6512:259f:b0:477:bbc5:182c with SMTP id bf31-20020a056512259f00b00477bbc5182cmr32199451lfb.265.1654249300873; Fri, 03 Jun 2022 02:41:40 -0700 (PDT) MIME-Version: 1.0 References: <20220518101657.1230416-1-david.marchand@redhat.com> <20220518101657.1230416-13-david.marchand@redhat.com> In-Reply-To: From: David Marchand Date: Fri, 3 Jun 2022 11:41:29 +0200 Message-ID: Subject: Re: [PATCH 12/12] test/ipsec: fix build with GCC 12 To: Bruce Richardson Cc: "Medvedkin, Vladimir" , dev , Thomas Monjalon , Ferruh Yigit , dpdk stable , Konstantin Ananyev , Bernard Iremonger 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 Fri, Jun 3, 2022 at 9:56 AM Bruce Richardson wrote: > > On Fri, Jun 03, 2022 at 09:45:45AM +0200, David Marchand wrote: > > Hello Vladimir, > > > > On Thu, Jun 2, 2022 at 8:42 PM Medvedkin, Vladimir > > wrote: > > > > if (!dst) { > > > > rte_pktmbuf_free(m); > > > > return NULL; > > > > } > > > > - if (string != NULL) > > > > - rte_memcpy(dst, string, t_len); > > > > - else > > > > - memset(dst, 0, t_len); > > > > + if (string != NULL) { > > > > + size_t off; > > > > + > > > > + for (off = 0; off + string_len < len; off += string_len) > > > > > > I think it should be off + string_len <= len here, because otherwise, if > > > len is a multiple of string_len, the last ret_memcpy (after this loop) > > > will copy 0 bytes. > > > > Changing to off + string_len <= len would trigger an oob access to dst > > (by one extra byte)? > > Otoh, I don't think it is an issue to have a 0-length call to rte_memcpy. > > > Given this is test code, do we need rte_memcpy for performance over regular > libc memcpy? Does fixing the warning become any easier or clearer if libc > memcpy is used? There was a similar proposal in vhost/crypto code. I am not a fan to switching to libc memcpy. We would be waiving a potential issue in rte_memcpy itself (which could also be a problem in how gcc understands this inlined code) or in the rte_memcpy caller code. Here, gcc is probably too picky. No path currently leads to oob access on the src string. Adding a simple hint (see simplified hunk below) seems to help gcc enough: @@ -554,12 +554,14 @@ struct rte_ipv4_hdr ipv4_outer = { }; static struct rte_mbuf * -setup_test_string(struct rte_mempool *mpool, - const char *string, size_t len, uint8_t blocksize) +setup_test_string(struct rte_mempool *mpool, const char *string, + size_t string_len, size_t len, uint8_t blocksize) { struct rte_mbuf *m = rte_pktmbuf_alloc(mpool); size_t t_len = len - (blocksize ? (len % blocksize) : 0); + RTE_VERIFY(len <= string_len); + if (m) { memset(m->buf_addr, 0, m->buf_len); -- David Marchand