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 9A38A4614D; Thu, 30 Jan 2025 22:06:58 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 31AED40275; Thu, 30 Jan 2025 22:06:58 +0100 (CET) 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 39F444025A for ; Thu, 30 Jan 2025 22:06:57 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1738271216; 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=DlWlvEI86CP9gXVruF7/yNlbccSmb7bfUmZ0TSnPKe0=; b=Aq5/jv+Umao3Tw3v7XDNprdhPQ557EO1KH2CHSTQ8eQn4HwQCQPkDZvW6VOx0TNp2HSkM7 Cc/Ef4qe7VebgOP8ndHJzGt6GAanjORV3Da1AYDRhOp7DW0sBgyQ71n8RncJAdoi72bBAM aynk87qqHW89VbWm/QfIQRxhXGiAXnU= Received: from mail-lj1-f200.google.com (mail-lj1-f200.google.com [209.85.208.200]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-497-TBmhLmGzONed7-zOFyvTGg-1; Thu, 30 Jan 2025 16:06:55 -0500 X-MC-Unique: TBmhLmGzONed7-zOFyvTGg-1 X-Mimecast-MFC-AGG-ID: TBmhLmGzONed7-zOFyvTGg Received: by mail-lj1-f200.google.com with SMTP id 38308e7fff4ca-30220c5ca63so5769821fa.3 for ; Thu, 30 Jan 2025 13:06:55 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1738271214; x=1738876014; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=DlWlvEI86CP9gXVruF7/yNlbccSmb7bfUmZ0TSnPKe0=; b=NCMyMXgAp0xoJE9KzxsUtIWQi+gvWHCpf96ejzidWvg1uAyEcgvskLIV4bsiGIOblE N0LL6rETNnDJ3+/zXVWc4C3KFQjb9hS8pwIojl6v7LovaEWPvfsZBVncYUnrbbEW3B4k Syxdyh98Mq9Vh3d8kO2c9f/JOhB5r4aMw+kNgExu0dqme92qAeOX3jOJv/TIKad8B3Ck 6FOcN/BVKgdDq9wHCxjPPcxAO45HJlNP9um5htm3DALU5gpg5c/Pxl2GOCQlYyswN3MG snkBpVbZpMviGn6s8KXmM/ddz3Raq5uamPu0mTGo1AgmtlrwJ781Mw9piKG3OrhdlBkj 7QbA== X-Gm-Message-State: AOJu0YwDhqbRXuNkryJBbz2uIRELKI67K4Jb6Ub/UnljRsIbjQ1miNoD 9JX9o87xnBvE4535ibwweSiABcuub/thEk10NCKXYl6/JEwK1uHncSSLvN67cT2BW24Fo61oL6u ZhfeEFcpv8eHR7P0QiptAlqC/jN7gInu+fRvnqOVmwPZeR7l6BWXwCE+Ps1nDT8PPquAVuiiSma KQ0+6Sd+18lK554JI= X-Gm-Gg: ASbGncskWgq03GU2aevli9QjtHTXey+itzHmjy4CYAMkXZio4ftyg9W2XodTz3NktMW IZcMOnvK2TjDWmGTOzz/AgN6CfQC3NIUnGUjnbxJJZZnhg3wttVI+4GLhMOPrxGXb X-Received: by 2002:a05:6512:3d10:b0:540:1e51:b919 with SMTP id 2adb3069b0e04-543e4c038cdmr3095346e87.31.1738271213760; Thu, 30 Jan 2025 13:06:53 -0800 (PST) X-Google-Smtp-Source: AGHT+IHuocarPqzrOewhNslxxQEkD4d8zhlUKEJe10Qz/4ClSYkXQiQDM0cqdohJttMErE70wfO7+2H4PUvXOZa3PdY= X-Received: by 2002:a05:6512:3d10:b0:540:1e51:b919 with SMTP id 2adb3069b0e04-543e4c038cdmr3095335e87.31.1738271213348; Thu, 30 Jan 2025 13:06:53 -0800 (PST) MIME-Version: 1.0 References: <20250124161408.310581-1-david.marchand@redhat.com> <20250130145849.82003-1-david.marchand@redhat.com> <20250130145849.82003-3-david.marchand@redhat.com> <20250130111043.76b8cd2c@hermes.local> In-Reply-To: <20250130111043.76b8cd2c@hermes.local> From: David Marchand Date: Thu, 30 Jan 2025 22:06:41 +0100 X-Gm-Features: AWEUYZmt_-NRIH6Ip6xwbmbzwa5eDKNwxd6j_vDL6UUG074IjJvZTXY4VdFGmZY Message-ID: Subject: Re: [PATCH v2 3/3] trace: fix undefined behavior in register To: Stephen Hemminger Cc: dev@dpdk.org, Chengwen Feng , Kevin Laatz , Bruce Richardson , Jerin Jacob , Sunil Kumar Kori , Tyler Retzlaff X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: 2ir3e_1VC4BUTORsa5oykB8N4ruahQamna3lAk4V5Cg_1738271214 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 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 On Thu, Jan 30, 2025 at 8:10=E2=80=AFPM Stephen Hemminger wrote: > > On Thu, 30 Jan 2025 15:58:49 +0100 > David Marchand wrote: > > > Registering a tracepoint handler was resulting so far in undefined > > behavior at runtime. > > > > The RTE_TRACE_POINT_REGISTER() macro was casting the tracepoint handler > > (which expects arguments) to a void (*)(void). > > At runtime, calling this handler while registering resulted in > > reading the current stack with no relation to this function prototype. > > > > Instead, declare an additional inline _register() handler for each > > tracepoint and make sure that the emitting macros in > > rte_trace_point_register.h only work on arguments name and type. > > > > The original tracepoint handler prototype is adjusted by adding a > > __rte_unused for each argument (since emitting macros do nothing > > with them). > > This last part introduces an implementation limit of 15 arguments. > > > > With this change in place, the workaround in dmadev tracepoints can be > > removed. > > > > Signed-off-by: David Marchand > > When I build with -Db_santize=3Dundefined the following warning shows up. > It seems related. > > In function =E2=80=98rte_ethdev_trace_get_dcb_info=E2=80=99, > inlined from =E2=80=98rte_eth_dev_get_dcb_info=E2=80=99 at ../lib/eth= dev/rte_ethdev.c:6720:2: > ../lib/eal/include/rte_trace_point.h:381:9: warning: writing 1 byte into = a region of size 0 [-Wstringop-overflow=3D] > 381 | memcpy(mem, &(in), sizeof(in)); \ > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > ../lib/eal/include/rte_trace_point.h:53:9: note: in definition of macro = =E2=80=98__RTE_TRACE_POINT=E2=80=99 > 53 | __VA_ARGS__ \ > | ^~~~~~~~~~~ > ../lib/ethdev/ethdev_trace.h:1213:1: note: in expansion of macro =E2=80= =98RTE_TRACE_POINT=E2=80=99 > 1213 | RTE_TRACE_POINT( > | ^~~~~~~~~~~~~~~ > ../lib/eal/include/rte_trace_point.h:399:9: note: in expansion of macro = =E2=80=98__rte_trace_point_emit=E2=80=99 > 399 | __rte_trace_point_emit(len, uint8_t); \ > | ^~~~~~~~~~~~~~~~~~~~~~ > ../lib/ethdev/ethdev_trace.h:1223:9: note: in expansion of macro =E2=80= =98rte_trace_point_emit_blob=E2=80=99 > 1223 | rte_trace_point_emit_blob(dcb_info->tc_bws, num_tcs); This is something I saw with optimisations (like O2 or O3 iirc) too. Compiling and running with optimisations made GHA vm go out of memory, so I have been testing only with O0 when it comes to ubsan. In any case, this series is fixing just one undefined behavior. Fixing all build and runtime errors seen with ubsan requires more work. --=20 David Marchand