diff mbox series

[BlueZ,v1,1/2] build: Enable -Wstringop-overflow and -D_FORTIFY_SOURCE=3

Message ID 20250204164927.2839802-1-luiz.dentz@gmail.com (mailing list archive)
State Superseded
Headers show
Series [BlueZ,v1,1/2] build: Enable -Wstringop-overflow and -D_FORTIFY_SOURCE=3 | expand

Checks

Context Check Description
tedd_an/pre-ci_am success Success
tedd_an/BuildEll success Build ELL PASS
tedd_an/BluezMake fail BluezMake FAIL: <command-line>: error: "_FORTIFY_SOURCE" redefined [-Werror] <command-line>: error: "_FORTIFY_SOURCE" redefined [-Werror] <built-in>: note: this is the location of the previous definition <built-in>: note: this is the location of the previous definition <command-line>: error: "_FORTIFY_SOURCE" redefined [-Werror] <built-in>: note: this is the location of the previous definition <command-line>: error: "_FORTIFY_SOURCE" redefined [-Werror] <built-in>: note: this is the location of the previous definition cc1: all warnings being treated as errors make[1]: *** [Makefile:8491: src/shared/libshared_mainloop_la-queue.lo] Error 1 make[1]: *** Waiting for unfinished jobs.... cc1: all warnings being treated as errors make[1]: *** [Makefile:8498: src/shared/libshared_mainloop_la-util.lo] Error 1 cc1: all warnings being treated as errors make[1]: *** [Makefile:8512: src/shared/libshared_mainloop_la-crypto.lo] Error 1 cc1: all warnings being treated as errors make[1]: *** [Makefile:8505: src/shared/libshared_mainloop_la-mgmt.lo] Error 1 make: *** [Makefile:4682: all] Error 2
tedd_an/MakeCheck fail BlueZ Make Check FAIL:
tedd_an/MakeDistcheck success Make Distcheck PASS
tedd_an/CheckValgrind fail Check Valgrind FAIL: <command-line>: error: "_FORTIFY_SOURCE" redefined [-Werror] <command-line>: error: "_FORTIFY_SOURCE" redefined [-Werror] <built-in>: note: this is the location of the previous definition <built-in>: note: this is the location of the previous definition <command-line>: error: "_FORTIFY_SOURCE" redefined [-Werror] <built-in>: note: this is the location of the previous definition <command-line>: error: "_FORTIFY_SOURCE" redefined [-Werror] <built-in>: note: this is the location of the previous definition cc1: all warnings being treated as errors make[1]: *** [Makefile:8491: src/shared/libshared_mainloop_la-queue.lo] Error 1 make[1]: *** Waiting for unfinished jobs.... cc1: all warnings being treated as errors make[1]: *** [Makefile:8512: src/shared/libshared_mainloop_la-crypto.lo] Error 1 cc1: all warnings being treated as errors make[1]: *** [Makefile:8505: src/shared/libshared_mainloop_la-mgmt.lo] Error 1 cc1: all warnings being treated as errors make[1]: *** [Makefile:8498: src/shared/libshared_mainloop_la-util.lo] Error 1 make: *** [Makefile:12320: check] Error 2
tedd_an/CheckSmatch fail CheckSparse: FAIL: src/shared/crypto.c:271:21: warning: Variable length array is used. src/shared/crypto.c:272:23: warning: Variable length array is used. <command-line>: error: "_FORTIFY_SOURCE" redefined [-Werror] <built-in>: note: this is the location of the previous definition cc1: all warnings being treated as errors make[1]: *** [Makefile:8491: src/shared/libshared_mainloop_la-queue.lo] Error 1 make[1]: *** Waiting for unfinished jobs.... <command-line>: error: "_FORTIFY_SOURCE" redefined [-Werror] <built-in>: note: this is the location of the previous definition <command-line>: error: "_FORTIFY_SOURCE" redefined [-Werror] <built-in>: note: this is the location of the previous definition <command-line>: error: "_FORTIFY_SOURCE" redefined [-Werror] <built-in>: note: this is the location of the previous definition cc1: all warnings being treated as errors make[1]: *** [Makefile:8512: src/shared/libshared_mainloop_la-crypto.lo] Error 1 cc1: all warnings being treated as errors make[1]: *** [Makefile:8505: src/shared/libshared_mainloop_la-mgmt.lo] Error 1 cc1: all warnings being treated as errors make[1]: *** [Makefile:8498: src/shared/libshared_mainloop_la-util.lo] Error 1 make: *** [Makefile:4682: all] Error 2
tedd_an/bluezmakeextell fail Make External ELL FAIL: <command-line>: error: "_FORTIFY_SOURCE" redefined [-Werror] <built-in>: note: this is the location of the previous definition <command-line>: error: "_FORTIFY_SOURCE" redefined [-Werror] <built-in>: note: this is the location of the previous definition <command-line>: error: "_FORTIFY_SOURCE" redefined [-Werror] <built-in>: note: this is the location of the previous definition <command-line>: error: "_FORTIFY_SOURCE" redefined [-Werror] <built-in>: note: this is the location of the previous definition cc1: all warnings being treated as errors make[1]: *** [Makefile:8491: src/shared/libshared_mainloop_la-queue.lo] Error 1 make[1]: *** Waiting for unfinished jobs.... cc1: all warnings being treated as errors make[1]: *** [Makefile:8512: src/shared/libshared_mainloop_la-crypto.lo] Error 1 cc1: all warnings being treated as errors make[1]: *** [Makefile:8498: src/shared/libshared_mainloop_la-util.lo] Error 1 cc1: all warnings being treated as errors make[1]: *** [Makefile:8505: src/shared/libshared_mainloop_la-mgmt.lo] Error 1 make: *** [Makefile:4682: all] Error 2
tedd_an/ScanBuild success Scan Build PASS

Commit Message

Luiz Augusto von Dentz Feb. 4, 2025, 4:49 p.m. UTC
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

This enables -Wstringop-overflow compiler warnings:

  'Warn for calls to string manipulation functions such as "memcpy" and
  "strcpy" that are determined to overflow the destination buffer.'

Along with -D_FORTIFY_SOURCE=3 so the errors like the following can be
captured:

In function ‘read’,
    inlined from ‘serial_read_callback’ at emulator/serial.c:90:8:
/usr/include/bits/unistd.h:32:10: error: ‘__read_alias’ specified size between 18446744073709490177 and 18446744073709551615 exceeds maximum object size 9223372036854775807 [-Werror=stringop-overflow=]
   32 |   return __glibc_fortify (read, __nbytes, sizeof (char),
      |          ^~~~~~~~~~~~~~~
---
 acinclude.m4 | 2 ++
 1 file changed, 2 insertions(+)

Comments

bluez.test.bot@gmail.com Feb. 4, 2025, 5:33 p.m. UTC | #1
This is automated email and please do not reply to this email!

Dear submitter,

Thank you for submitting the patches to the linux bluetooth mailing list.
This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=930511

---Test result---

Test Summary:
CheckPatch                    PENDING   0.22 seconds
GitLint                       PENDING   0.18 seconds
BuildEll                      PASS      20.37 seconds
BluezMake                     FAIL      9.10 seconds
MakeCheck                     FAIL      1.23 seconds
MakeDistcheck                 PASS      159.54 seconds
CheckValgrind                 FAIL      8.91 seconds
CheckSmatch                   FAIL      9.41 seconds
bluezmakeextell               FAIL      10.21 seconds
IncrementalBuild              PENDING   0.26 seconds
ScanBuild                     PASS      858.19 seconds

Details
##############################
Test: CheckPatch - PENDING
Desc: Run checkpatch.pl script
Output:

##############################
Test: GitLint - PENDING
Desc: Run gitlint
Output:

##############################
Test: BluezMake - FAIL
Desc: Build BlueZ
Output:

<command-line>: error: "_FORTIFY_SOURCE" redefined [-Werror]
<command-line>: error: "_FORTIFY_SOURCE" redefined [-Werror]
<built-in>: note: this is the location of the previous definition
<built-in>: note: this is the location of the previous definition
<command-line>: error: "_FORTIFY_SOURCE" redefined [-Werror]
<built-in>: note: this is the location of the previous definition
<command-line>: error: "_FORTIFY_SOURCE" redefined [-Werror]
<built-in>: note: this is the location of the previous definition
cc1: all warnings being treated as errors
make[1]: *** [Makefile:8491: src/shared/libshared_mainloop_la-queue.lo] Error 1
make[1]: *** Waiting for unfinished jobs....
cc1: all warnings being treated as errors
make[1]: *** [Makefile:8498: src/shared/libshared_mainloop_la-util.lo] Error 1
cc1: all warnings being treated as errors
make[1]: *** [Makefile:8512: src/shared/libshared_mainloop_la-crypto.lo] Error 1
cc1: all warnings being treated as errors
make[1]: *** [Makefile:8505: src/shared/libshared_mainloop_la-mgmt.lo] Error 1
make: *** [Makefile:4682: all] Error 2
##############################
Test: MakeCheck - FAIL
Desc: Run Bluez Make Check
Output:

<command-line>: error: "_FORTIFY_SOURCE" redefined [-Werror]
<built-in>: note: this is the location of the previous definition
cc1: all warnings being treated as errors
make[1]: *** [Makefile:7851: client/main.o] Error 1
make: *** [Makefile:12320: check] Error 2
##############################
Test: CheckValgrind - FAIL
Desc: Run Bluez Make Check with Valgrind
Output:

<command-line>: error: "_FORTIFY_SOURCE" redefined [-Werror]
<command-line>: error: "_FORTIFY_SOURCE" redefined [-Werror]
<built-in>: note: this is the location of the previous definition
<built-in>: note: this is the location of the previous definition
<command-line>: error: "_FORTIFY_SOURCE" redefined [-Werror]
<built-in>: note: this is the location of the previous definition
<command-line>: error: "_FORTIFY_SOURCE" redefined [-Werror]
<built-in>: note: this is the location of the previous definition
cc1: all warnings being treated as errors
make[1]: *** [Makefile:8491: src/shared/libshared_mainloop_la-queue.lo] Error 1
make[1]: *** Waiting for unfinished jobs....
cc1: all warnings being treated as errors
make[1]: *** [Makefile:8512: src/shared/libshared_mainloop_la-crypto.lo] Error 1
cc1: all warnings being treated as errors
make[1]: *** [Makefile:8505: src/shared/libshared_mainloop_la-mgmt.lo] Error 1
cc1: all warnings being treated as errors
make[1]: *** [Makefile:8498: src/shared/libshared_mainloop_la-util.lo] Error 1
make: *** [Makefile:12320: check] Error 2
##############################
Test: CheckSmatch - FAIL
Desc: Run smatch tool with source
Output:

src/shared/crypto.c:271:21: warning: Variable length array is used.
src/shared/crypto.c:272:23: warning: Variable length array is used.
<command-line>: error: "_FORTIFY_SOURCE" redefined [-Werror]
<built-in>: note: this is the location of the previous definition
cc1: all warnings being treated as errors
make[1]: *** [Makefile:8491: src/shared/libshared_mainloop_la-queue.lo] Error 1
make[1]: *** Waiting for unfinished jobs....
<command-line>: error: "_FORTIFY_SOURCE" redefined [-Werror]
<built-in>: note: this is the location of the previous definition
<command-line>: error: "_FORTIFY_SOURCE" redefined [-Werror]
<built-in>: note: this is the location of the previous definition
<command-line>: error: "_FORTIFY_SOURCE" redefined [-Werror]
<built-in>: note: this is the location of the previous definition
cc1: all warnings being treated as errors
make[1]: *** [Makefile:8512: src/shared/libshared_mainloop_la-crypto.lo] Error 1
cc1: all warnings being treated as errors
make[1]: *** [Makefile:8505: src/shared/libshared_mainloop_la-mgmt.lo] Error 1
cc1: all warnings being treated as errors
make[1]: *** [Makefile:8498: src/shared/libshared_mainloop_la-util.lo] Error 1
make: *** [Makefile:4682: all] Error 2
##############################
Test: bluezmakeextell - FAIL
Desc: Build Bluez with External ELL
Output:

<command-line>: error: "_FORTIFY_SOURCE" redefined [-Werror]
<built-in>: note: this is the location of the previous definition
<command-line>: error: "_FORTIFY_SOURCE" redefined [-Werror]
<built-in>: note: this is the location of the previous definition
<command-line>: error: "_FORTIFY_SOURCE" redefined [-Werror]
<built-in>: note: this is the location of the previous definition
<command-line>: error: "_FORTIFY_SOURCE" redefined [-Werror]
<built-in>: note: this is the location of the previous definition
cc1: all warnings being treated as errors
make[1]: *** [Makefile:8491: src/shared/libshared_mainloop_la-queue.lo] Error 1
make[1]: *** Waiting for unfinished jobs....
cc1: all warnings being treated as errors
make[1]: *** [Makefile:8512: src/shared/libshared_mainloop_la-crypto.lo] Error 1
cc1: all warnings being treated as errors
make[1]: *** [Makefile:8498: src/shared/libshared_mainloop_la-util.lo] Error 1
cc1: all warnings being treated as errors
make[1]: *** [Makefile:8505: src/shared/libshared_mainloop_la-mgmt.lo] Error 1
make: *** [Makefile:4682: all] Error 2
##############################
Test: IncrementalBuild - PENDING
Desc: Incremental build with the patches in the series
Output:



---
Regards,
Linux Bluetooth
diff mbox series

Patch

diff --git a/acinclude.m4 b/acinclude.m4
index 4b73a5bfc38f..7f8e28d0bdaf 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -61,9 +61,11 @@  AC_DEFUN([COMPILER_FLAGS], [
 		with_cflags="$with_cflags -Wcast-align"
 		with_cflags="$with_cflags -Wswitch-enum"
 		with_cflags="$with_cflags -Wformat -Wformat-security"
+		with_cflags="$with_cflags -Wstringop-overflow"
 		with_cflags="$with_cflags -DG_DISABLE_DEPRECATED"
 		with_cflags="$with_cflags -DGLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_2_28"
 		with_cflags="$with_cflags -DGLIB_VERSION_MAX_ALLOWED=GLIB_VERSION_2_32"
+		with_cflags="$with_cflags -D_FORTIFY_SOURCE=3"
 	fi
 	AC_SUBST([WARNING_CFLAGS], $with_cflags)
 ])