patch 'build: force GCC 15 to initialize padding bits' has been queued to stable release 22.11.8

luca.boccassi at gmail.com luca.boccassi at gmail.com
Mon Feb 17 18:04:00 CET 2025


Hi,

FYI, your patch has been queued to stable release 22.11.8

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 02/19/25. So please
shout if anyone has objections.

Also note that after the patch there's a diff of the upstream commit vs the
patch applied to the branch. This will indicate if there was any rebasing
needed to apply to the stable branch. If there were code changes for rebasing
(ie: not only metadata diffs), please double check that the rebase was
correctly done.

Queued patches are on a temporary branch at:
https://github.com/bluca/dpdk-stable

This queued commit can be viewed at:
https://github.com/bluca/dpdk-stable/commit/655a2accb3b6c327b3480b6543db644f8e4abbce

Thanks.

Luca Boccassi

---
>From 655a2accb3b6c327b3480b6543db644f8e4abbce Mon Sep 17 00:00:00 2001
From: Stephen Hemminger <stephen at networkplumber.org>
Date: Fri, 24 Jan 2025 10:26:48 -0800
Subject: [PATCH] build: force GCC 15 to initialize padding bits
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

[ upstream commit 3c015da37afecbeaa7c9ebf8cf2adcb20ab0e54d ]

With GCC 15, the compiler has changed the default behavior when
initialization is used for aggregate variables. The new default
is to follow the standard (C23) and not initialize everything by
default. This breaks assumptions in some drivers and can be
lead to other bugs. Use the new zero initialization flag to
force of all fields to zero.

Note: other compilers always initialize to zero in these cases.
Only GCC seems to have decided to start initializing less as
a silly attempt at optimization.

Signed-off-by: Stephen Hemminger <stephen at networkplumber.org>
Acked-by: Morten Brørup <mb at smartsharesystems.com>
Acked-by: Bruce Richardson <bruce.richardson at intel.com>
---
 config/meson.build | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/config/meson.build b/config/meson.build
index c755083db0..2f07c187b9 100644
--- a/config/meson.build
+++ b/config/meson.build
@@ -262,7 +262,7 @@ add_project_arguments('-include', 'rte_config.h', language: 'c')
 # enable extra warnings and disable any unwanted warnings
 # -Wall is added by default at warning level 1, and -Wextra
 # at warning level 2 (DPDK default)
-warning_flags = [
+global_cflags = [
         # additional warnings in alphabetical order
         '-Wcast-qual',
         '-Wdeprecated',
@@ -283,22 +283,25 @@ warning_flags = [
         '-Wno-address-of-packed-member',
         '-Wno-packed-not-aligned',
         '-Wno-missing-field-initializers',
+
+        # guarantee that all non-initialized parts of structure/union are zero
+        '-fzero-init-padding-bits=all',
 ]
 if cc.get_id() == 'gcc' and cc.version().version_compare('>=10.0')
 # FIXME: Bugzilla 396
-    warning_flags += '-Wno-zero-length-bounds'
+    global_cflags += '-Wno-zero-length-bounds'
 endif
 if not dpdk_conf.get('RTE_ARCH_64')
 # for 32-bit, don't warn about casting a 32-bit pointer to 64-bit int - it's fine!!
-    warning_flags += '-Wno-pointer-to-int-cast'
+    global_cflags += '-Wno-pointer-to-int-cast'
 endif
 if cc.get_id() == 'intel'
     warning_ids = [181, 188, 2203, 2279, 2557, 3179, 3656]
     foreach i:warning_ids
-        warning_flags += '-diag-disable=@0@'.format(i)
+        global_cflags += '-diag-disable=@0@'.format(i)
     endforeach
 endif
-foreach arg: warning_flags
+foreach arg: global_cflags
     if cc.has_argument(arg)
         add_project_arguments(arg, language: 'c')
     endif
-- 
2.47.2

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2025-02-17 16:13:17.825189826 +0000
+++ 0027-build-force-GCC-15-to-initialize-padding-bits.patch	2025-02-17 16:13:16.814441593 +0000
@@ -1 +1 @@
-From 3c015da37afecbeaa7c9ebf8cf2adcb20ab0e54d Mon Sep 17 00:00:00 2001
+From 655a2accb3b6c327b3480b6543db644f8e4abbce Mon Sep 17 00:00:00 2001
@@ -8,0 +9,2 @@
+[ upstream commit 3c015da37afecbeaa7c9ebf8cf2adcb20ab0e54d ]
+
@@ -20,2 +21,0 @@
-Cc: stable at dpdk.org
-
@@ -26,2 +26,2 @@
- config/meson.build | 11 +++++++----
- 1 file changed, 7 insertions(+), 4 deletions(-)
+ config/meson.build | 13 ++++++++-----
+ 1 file changed, 8 insertions(+), 5 deletions(-)
@@ -30 +30 @@
-index 710206095b..f31fef216c 100644
+index c755083db0..2f07c187b9 100644
@@ -33 +33 @@
-@@ -310,7 +310,7 @@ endif
+@@ -262,7 +262,7 @@ add_project_arguments('-include', 'rte_config.h', language: 'c')
@@ -42,2 +42,2 @@
-@@ -330,16 +330,19 @@ warning_flags = [
-         # globally disabled warnings
+@@ -283,22 +283,25 @@ warning_flags = [
+         '-Wno-address-of-packed-member',
@@ -50 +50,5 @@
- 
+ if cc.get_id() == 'gcc' and cc.version().version_compare('>=10.0')
+ # FIXME: Bugzilla 396
+-    warning_flags += '-Wno-zero-length-bounds'
++    global_cflags += '-Wno-zero-length-bounds'
+ endif
@@ -63,5 +66,0 @@
- 
-@@ -351,7 +354,7 @@ if cc.has_argument('-Wvla')
-     endif
- endif
- 


More information about the stable mailing list