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 C22A2A0557; Fri, 3 Jun 2022 17:57:38 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 758CD4021E; Fri, 3 Jun 2022 17:57:37 +0200 (CEST) Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by mails.dpdk.org (Postfix) with ESMTP id 561EE40041; Fri, 3 Jun 2022 17:57:35 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1654271855; x=1685807855; h=message-id:date:subject:to:cc:references:from: in-reply-to:content-transfer-encoding:mime-version; bh=wsXIBLfSApuV0HmEAoVlwY7z1yHclyzsa6Uch/d+vFI=; b=WlT/fjK5WU7hTgfPR5kABNvYSZ3Twafb78BBiUACoSI3f8stM6zHW/lM KUnABYewM+YluX1XGDzedzEqDGu0zQ6Wcuwe0Tfleq6XL7nE+/EGyGb9u lLENbqmutSf3DOptQAJI611o/NWeIkBuAt3zj0EwILIZ2q11CPZztwSJc 3alSpOv2go1ZT0WN/MHygb3kPftkhPQyvtHHH8W44Uwkf3OrkEluJMD9+ a0c6Gp8pnTn6/SFGRpbCcYOB1OxqLU86LV/F5hd85AR6KTVkEuEQclnA5 n8/If4Cb/dLjoCcL9iP2lra2BIPPkuIcSmPMCVKAoq027SbnbNhs4I0sL w==; X-IronPort-AV: E=McAfee;i="6400,9594,10367"; a="256144706" X-IronPort-AV: E=Sophos;i="5.91,274,1647327600"; d="scan'208";a="256144706" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Jun 2022 08:57:32 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.91,274,1647327600"; d="scan'208";a="607455953" Received: from fmsmsx601.amr.corp.intel.com ([10.18.126.81]) by orsmga008.jf.intel.com with ESMTP; 03 Jun 2022 08:57:29 -0700 Received: from fmsmsx609.amr.corp.intel.com (10.18.126.89) by fmsmsx601.amr.corp.intel.com (10.18.126.81) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.27; Fri, 3 Jun 2022 08:57:29 -0700 Received: from fmsmsx610.amr.corp.intel.com (10.18.126.90) by fmsmsx609.amr.corp.intel.com (10.18.126.89) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.27; Fri, 3 Jun 2022 08:57:29 -0700 Received: from FMSEDG603.ED.cps.intel.com (10.1.192.133) by fmsmsx610.amr.corp.intel.com (10.18.126.90) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.27 via Frontend Transport; Fri, 3 Jun 2022 08:57:29 -0700 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (104.47.57.172) by edgegateway.intel.com (192.55.55.68) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2308.27; Fri, 3 Jun 2022 08:57:28 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=IsyJWjb4soiTQuDDWvJQC0FkLNbsNHxSAC+6dTC+YH2ySjZKpWZpy/49wZJkpUaX+vN7ow8T1/V+SwlLggTzPB/B2rQoqf4ItkLznMNl5Rxdce67a70mmJLzkwgHO8Z+gBdbNBay8LkhB1JNQXHQb+J9DS7xuxAPNenolgj+XAxy3YiLEyVL1+JCbneJ7Gjg03epHXBeMwDWwJmP+nuBXT/tnvh1VL74U9I2L3YaDskdirWpZW9SMzpd/uEd6hM47OEOsrcwh6C8xyugNV0jL/C19QeZg67U+0wwalHFW8JvF0GHuKoLfdviS0DNbdZx+rcD2S03ltNTAoNmuR1oGw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=uOfxw5NNKiePpxj4YuyYqNJSzYcIRoDfAgxzLt0wN74=; b=nqctQyRE5lmIT8qRY0yP5Uf/jJMKQp5oT8Ym/n3esOkRyHvYkUIFdDTDKI5ITLjLJS1GHmcQkLE4u+6QG48Rk0FrC84hbuWVASpD9Y3LgTmWT+uv7+YFwIl/FnAuxajZWHlw1/7ea5/1YYoeaHVVPTI9SLex2VO1LldNdT90j8lgJnDU8Pv1RKnjUDsQ0iV7BuEy+dma9cHUjeCxAr0SswTxRL+lFObYZrz5DYFARwb3mJ4YLEr0msyB/DvQwoUP4YYD1Hz8r+yuHbZG3UMVbxC7o1b52xqZp0J+DNJwk+nbDGVjjpVaBti6K+P0pP4iQdywdbmw7n/8vo1i2AXEqA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; Received: from SJ0PR11MB5772.namprd11.prod.outlook.com (2603:10b6:a03:422::8) by CY4PR11MB1752.namprd11.prod.outlook.com (2603:10b6:903:11a::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5314.15; Fri, 3 Jun 2022 15:57:27 +0000 Received: from SJ0PR11MB5772.namprd11.prod.outlook.com ([fe80::64ab:a179:cce5:11d0]) by SJ0PR11MB5772.namprd11.prod.outlook.com ([fe80::64ab:a179:cce5:11d0%7]) with mapi id 15.20.5314.013; Fri, 3 Jun 2022 15:57:27 +0000 Message-ID: <1f0bee5c-56c5-11f1-5452-5aa6c00d2acc@intel.com> Date: Fri, 3 Jun 2022 16:57:21 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Firefox/91.0 Thunderbird/91.9.1 Subject: Re: [PATCH 12/12] test/ipsec: fix build with GCC 12 Content-Language: en-US To: David Marchand , Bruce Richardson CC: dev , Thomas Monjalon , Ferruh Yigit , dpdk stable , Konstantin Ananyev , Bernard Iremonger References: <20220518101657.1230416-1-david.marchand@redhat.com> <20220518101657.1230416-13-david.marchand@redhat.com> From: "Medvedkin, Vladimir" In-Reply-To: Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit X-ClientProxiedBy: LO4P123CA0072.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:153::23) To SJ0PR11MB5772.namprd11.prod.outlook.com (2603:10b6:a03:422::8) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 87379ba0-cf39-4775-4cf2-08da4579c1d1 X-MS-TrafficTypeDiagnostic: CY4PR11MB1752:EE_ X-LD-Processed: 46c98d88-e344-4ed4-8496-4ed7712e255d,ExtAddr X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: iXNBQY3x3Uks0gKoWcMpwJopNkoUczamNcXI096blv93GQsA7Dn32bjQoWpaqxUfSnjU22dQQmJidcVrzBlWKFtlPwnbGPFHCW1DGodvOnJLRGufv9a6T/BdgiLfyle+KEnByzfrEo5Pl+EKs7VglhuMvNOyAKjQdSXBBxr8wj9L2wq8Z/Ee7wKGYlXewuKslGt6ScWaGtARCUv3BKpSxrzOvpD/XouokTVqAoY7c1RHoGVgJm7Uvk4OXM/enOhnKB3CyGFtqFsAse1x/bKvKQhuj2O19ZXxATrp7x7jwwQDpnmoqnV+3nBzTQrYMMoqL2oG2KtLUNwjPIhstR8WnrUWAaOUPVJ9RUdTr+N8YoCLHnU3RZbi4bJPCjRVXK2klQbO4nYtEIevwYyzgTbpjZKfV4t4cLwPexVMDZPgNP2ZFp9Hah6B9vRHOmptlqQqr+lfKWIW7zw61fY4KyfTR4hsiSCL+Q2NTWeun5HMIUezDX2qrhfiwkJM93PlXP2Sb52hw4bSHmFCifJCqiKZ0citAWRnRwqUdbL2kZUYqa6xLosxnEenNJUgN3fLc0cg4lEnHycllf/rI3FjzFZx8FBPGiAA1IvDQ3aEAkqvDxQ+mKnKPJI2WH0cKm5sPvymb7hb6VEUVzYvKyEc2P7zm6pgzpI+A28ZB5cHCzqgrUBreJfef+13iVCDX0YIkAf37GrjA9+tFql+s+yJx0jip5jz1tItHDBNfDadH7xs7GHEMhry0P6sm2iGNpym5KUU X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:SJ0PR11MB5772.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230001)(366004)(5660300002)(66476007)(36756003)(110136005)(54906003)(8676002)(4326008)(66946007)(8936002)(2906002)(316002)(6636002)(508600001)(6506007)(66556008)(6512007)(26005)(53546011)(6666004)(86362001)(82960400001)(2616005)(6486002)(107886003)(31696002)(186003)(38100700002)(83380400001)(31686004)(45980500001)(43740500002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?TnpRdFdTRHE2dDNxRVIyMmFXZVNUd2Y2RWxOZnBSN25sVXo3VnZjK2hQZDVS?= =?utf-8?B?d0xicEFGeENrOVZhd1FiYms1YlNDZVZOL1BsMWpINklwQVgvaExsSmM2YzY1?= =?utf-8?B?dUdRMnJ1UExxYThYT0JMbDRUMlJDYVFOWGVNTzRpUEY0alNVRWd2T2UzdFVs?= =?utf-8?B?YVAydEVuWERkZGNIV0dDS09hQ0lw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TjRFTWJ4ZlZwMGZoT0hXdXlnOUJZZ1BHOEVJWWFYSVk5aThZb3Fw?= =?utf-8?B?NlVhMFJUclM1U2tQakJSaUhFcWRzWXpOTWwva2RKeTltaEpYc1VmR04vOWVv?= =?utf-8?B?NC9jUVBGUXd0RFJWaXFZKzNiNmVzSElJbHZwT3F0aUdqUW1wOHZVSzdYaFFJ?= =?utf-8?B?cHdsdnMzN0NIcXYyc2YvM3hpTzlJbTRFZTBlNy9qMk40elk4OFVybHlSNTZo?= =?utf-8?B?RTlLQUp1VWRFbldpcmFNeUh2dGMyTldHUFZNUjExdmN5K01sQStsc2ZZYzhC?= =?utf-8?B?d3pnK3BQVlhUYWpyU0RSWVBBU0UzeEd5cUkxcTkwQzRvRzQxMkJWM0phS251?= =?utf-8?Q?A0Ffbzm0lPkwWm/U2RI1qCGrqEfN3aP0kTj4V?= X-MS-Exchange-CrossTenant-Network-Message-Id: 87379ba0-cf39-4775-4cf2-08da4579c1d1 X-MS-Exchange-CrossTenant-AuthSource: SJ0PR11MB5772.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Jun 2022 15:57:27.3299 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: rChlQCHVRUv0z1mfVARrUksq39wFGHlwBMCOVthFVBz5plTeDrRuDg5OfiHVGeNX9nPaOt9E/I4SUvH42sg8Bg9v1/83EIQpZHLh6Bw8rfE= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR11MB1752 X-OriginatorOrg: intel.com 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 Hi David, On 03/06/2022 10:41, David Marchand wrote: > 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. >>> The problem here is that if, for example, string_len is 8 bytes and len is 16, then it will write only 8 bytes. >> 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); > + RTE_VERIFY looks better here to make picky GCC happy. > > if (m) { > memset(m->buf_addr, 0, m->buf_len); > > -- Regards, Vladimir