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 2613B425A4;
Fri, 15 Sep 2023 13:49:03 +0200 (CEST)
Received: from mails.dpdk.org (localhost [127.0.0.1])
by mails.dpdk.org (Postfix) with ESMTP id A2630402DE;
Fri, 15 Sep 2023 13:49:02 +0200 (CEST)
Received: from inbox.dpdk.org (inbox.dpdk.org [95.142.172.178])
by mails.dpdk.org (Postfix) with ESMTP id 81E3D402D7
for ; Fri, 15 Sep 2023 13:49:01 +0200 (CEST)
Received: by inbox.dpdk.org (Postfix, from userid 33)
id 6C516425A5; Fri, 15 Sep 2023 13:49:01 +0200 (CEST)
From: bugzilla@dpdk.org
To: dev@dpdk.org
Subject: [Bug 1289] rte_table: lookup functions have UB for ctz
Date: Fri, 15 Sep 2023 11:49:01 +0000
X-Bugzilla-Reason: AssignedTo
X-Bugzilla-Type: new
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: DPDK
X-Bugzilla-Component: other
X-Bugzilla-Version: 23.11
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: qrealka@gmail.com
X-Bugzilla-Status: UNCONFIRMED
X-Bugzilla-Resolution:
X-Bugzilla-Priority: Normal
X-Bugzilla-Assigned-To: dev@dpdk.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields: bug_id short_desc product version rep_platform
op_sys bug_status bug_severity priority component assigned_to reporter
target_milestone
Message-ID:
Content-Type: multipart/alternative; boundary=16947785410.ab7CcE.233457
Content-Transfer-Encoding: 7bit
X-Bugzilla-URL: http://bugs.dpdk.org/
Auto-Submitted: auto-generated
X-Auto-Response-Suppress: All
MIME-Version: 1.0
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
--16947785410.ab7CcE.233457
Date: Fri, 15 Sep 2023 13:49:01 +0200
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
X-Bugzilla-URL: http://bugs.dpdk.org/
Auto-Submitted: auto-generated
X-Auto-Response-Suppress: All
https://bugs.dpdk.org/show_bug.cgi?id=3D1289
Bug ID: 1289
Summary: rte_table: lookup functions have UB for ctz
Product: DPDK
Version: 23.11
Hardware: x86
OS: Linux
Status: UNCONFIRMED
Severity: normal
Priority: Normal
Component: other
Assignee: dev@dpdk.org
Reporter: qrealka@gmail.com
Target Milestone: ---
Macros 'lookup2_stage0_with_odd_support' can call rte_ctz with zero value
(pkt_mask), which is undefined behaviour based on the GCC manual:
https://gcc.gnu.org/onlinedocs/gcc/Other-Builtins.html
Quote: "
Built-in Function: int __builtin_ctz (unsigned int x)
Returns the number of trailing 0-bits in x, starting at the least significa=
nt
bit position. If x is 0, the result is undefined.
"
It is confirmed by checking this code in GCC-13 with ASAN.
--=20
You are receiving this mail because:
You are the assignee for the bug.=
--16947785410.ab7CcE.233457
Date: Fri, 15 Sep 2023 13:49:01 +0200
MIME-Version: 1.0
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
X-Bugzilla-URL: http://bugs.dpdk.org/
Auto-Submitted: auto-generated
X-Auto-Response-Suppress: All
Macros 'lookup2_stage0_with_odd_su=
pport' can call rte_ctz with zero value
(pkt_mask), which is undefined behaviour based on the GCC manual:
https:/=
/gcc.gnu.org/onlinedocs/gcc/Other-Builtins.html
Quote: "
Built-in Function: int __builtin_ctz (unsigned int x)
Returns the number of trailing 0-bits in x, starting at the least significa=
nt
bit position. If x is 0, the result is undefined.
"
It is confirmed by checking this code in GCC-13 with ASAN.