build: Add sanitizer options
Subsystems (2)
Luiz Augusto von Dentz
maintainerPATCH 1/3 build: Add sanitizer options
From: Luiz Augusto von Dentz <[email protected]>
Build using Address Sanitizer (asan), Leak Sanitizer (lsan), or Undefined Behavior Sanitizer (ubsan) by using one of these options for the configure script:
--enable-asan
--enable-lsan
--enable-ubsan
For each of these to work, the compiler must support the requested sanitizer and the requisite libraries must be installed (libasan, liblsan, libubsan).
--- Makefile.am | 6 +++++ acinclude.m4 | 75 ++++++++++++++++++++++++++++++++++++++++++++++++++++ configure.ac | 3 +++ 3 files changed, 84 insertions(+)
Makefile.am +6 -0
@@ -243,6 +243,8 @@ src_libshared_glib_la_SOURCES = $(shared_sources) \ src/shared/mainloop-notify.h \ src/shared/mainloop-notify.c \ src/shared/tester.c +src_libshared_glib_la_LDFLAGS = $(AM_LDFLAGS) +src_libshared_glib_la_CFLAGS = $(AM_CFLAGS) src_libshared_mainloop_la_SOURCES = $(shared_sources) \ src/shared/io-mainloop.c \
@@ -250,6 +252,8 @@ src_libshared_mainloop_la_SOURCES = $(shared_sources) \ src/shared/mainloop.h src/shared/mainloop.c \ src/shared/mainloop-notify.h \ src/shared/mainloop-notify.c +src_libshared_mainloop_la_LDFLAGS = $(AM_LDFLAGS) +src_libshared_mainloop_la_CFLAGS = $(AM_CFLAGS) if LIBSHARED_ELL src_libshared_ell_la_SOURCES = $(shared_sources) \
@@ -257,6 +261,8 @@ src_libshared_ell_la_SOURCES = $(shared_sources) \ src/shared/timeout-ell.c \ src/shared/mainloop.h \ src/shared/mainloop-ell.c +src_libshared_ell_la_LDFLAGS = $(AM_LDFLAGS) +src_libshared_ell_la_CFLAGS = $(AM_CFLAGS) endif attrib_sources = attrib/att.h attrib/att-database.h attrib/att.c \
acinclude.m4 +75 -0
87 lines not on this page · raw message
configure.ac +3 -0
@@ -23,6 +23,9 @@ AC_C_RESTRICT AC_PROG_CC AM_PROG_CC_C_O AC_PROG_CC_PIE +AC_PROG_CC_ASAN +AC_PROG_CC_LSAN +AC_PROG_CC_UBSAN AC_PROG_INSTALL AC_PROG_MKDIR_P
Signature · 1 line
2.33.1
Luiz Augusto von Dentz
maintainerPATCH 2/3 build: Fix build when sanitizer are enabled
From: Luiz Augusto von Dentz <[email protected]>
This fixes various issues found when sanitizers are enabled.
--- monitor/packet.c | 3 ++- peripheral/main.c | 2 +- profiles/audio/a2dp.c | 5 ++++- profiles/network/bnep.c | 2 +- src/shared/gatt-server.c | 2 -- tools/mesh-gatt/util.c | 11 ++++++++--- tools/test-runner.c | 2 +- 7 files changed, 17 insertions(+), 10 deletions(-)
monitor/packet.c +2 -1
@@ -330,7 +330,8 @@ static void print_packet(struct timeval *tv, struct ucred *cred, char ident,if ((filter_mask &PACKET_FILTER_SHOW_INDEX ) && index !=HCI_DEV_NONE ) {if (use_color ()) { - n =sprintf (ts_str + ts_pos,"%s" ,COLOR_INDEX_LABEL ); + n =snprintf (ts_str + ts_pos,sizeof (ts_str) - ts_pos, +"%s" ,COLOR_INDEX_LABEL );if (n >0 ) ts_pos += n; }
peripheral/main.c +1 -1
@@ -73,7 +73,7 @@ static void prepare_filesystem(void)if (!is_init)return ; -for (i =0 ; mount_table[i].fstype; i++) { +for (i =0 ; mount_table[i].fstype && mount_table[i].target; i++) {struct stat st;if (lstat (mount_table[i].target, &st) <0 ) {
profiles/audio/a2dp.c +4 -1
@@ -1338,9 +1338,12 @@ static gboolean a2dp_reconfigure(gpointer data)if (setup->rsep) { cap =avdtp_get_codec (setup->rsep->sep); rsep_codec = (struct avdtp_media_codec_capability *) cap->data; +/* Check that codec really match after closing */ +if (sep->codec != rsep_codec->media_codec_type) + setup->rsep =NULL ; } -if (!setup->rsep || sep->codec != rsep_codec->media_codec_type) +if (!setup->rsep) setup->rsep =find_remote_sep (setup->chan, sep);if (!setup->rsep) {
profiles/network/bnep.c +1 -1
@@ -345,7 +345,7 @@ struct bnep *bnep_new(int sk, uint16_t local_role, uint16_t remote_role, session->io =g_io_channel_unix_new (dup_fd); session->src = local_role; session->dst = remote_role; -strncpy (session->iface, iface,16 ); +strncpy (session->iface, iface,15 ); session->iface[15 ] ='\0' ;g_io_channel_set_close_on_unref (session->io, TRUE);
src/shared/gatt-server.c +0 -2
@@ -1119,8 +1119,6 @@ static void read_multiple_cb(struct bt_att_chan *chan, uint8_t opcode, } data =read_mult_data_new (server, chan, opcode, length /2 ); -if (!data) - goto error;for (i =0 ; i < data->num_handles; i++) data->handles[i] =get_le16 (pdu + i *2 );
tools/mesh-gatt/util.c +8 -3
@@ -41,9 +41,14 @@ void print_byte_array(const char *prefix, const void *ptr, int len)char *line, *bytes;int i; - line =g_malloc (strlen (prefix) + (16 *3 ) +2 ); -sprintf (line,"%s " , prefix); - bytes = line +strlen (prefix) +1 ; +if (prefix) { + line =g_malloc (strlen (prefix) + (16 *3 ) +2 ); +sprintf (line,"%s " , prefix); + bytes = line +strlen (prefix) +1 ; + }else { + line =g_malloc ((16 *3 ) +2 ); + bytes = line +1 ; + }for (i =0 ; i < len; ++i) {sprintf (bytes,"%2.2x " , data[i]);
tools/test-runner.c +1 -1
@@ -136,7 +136,7 @@ static void prepare_sandbox(void) {int i; -for (i =0 ; mount_table[i].fstype; i++) { +for (i =0 ; mount_table[i].fstype && mount_table[i].target; i++) {struct stat st;if (lstat (mount_table[i].target, &st) <0 ) {
Signature · 1 line
2.33.1
Luiz Augusto von Dentz
maintainerPATCH 3/3 bootstrap-configure: Enable sanitizer options
In reply to Luiz Augusto von DentzFrom: Luiz Augusto von Dentz <[email protected]>
This makes bootstrap-configure enables all sanitizers.
--- bootstrap-configure | 3 +++ 1 file changed, 3 insertions(+)
bootstrap-configure +3 -0
@@ -28,6 +28,9 @@ fi --enable-btpclient \ --enable-logger \ --enable-pie \ + --enable-asan \ + --enable-lsan \ + --enable-ubsan \ --enable-cups \ --enable-library \ --enable-admin \
Signature · 1 line
2.33.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=598539
---Test result---
Test Summary:
CheckPatch PASS 1.51 seconds GitLint PASS 0.94 seconds Prep - Setup ELL PASS 53.01 seconds Build - Prep PASS 0.44 seconds Build - Configure PASS 10.44 seconds Build - Make FAIL 300.42 seconds Make Check FAIL 0.93 seconds Make Distcheck PASS 303.27 seconds Build w/ext ELL - Configure PASS 10.63 seconds Build w/ext ELL - Make FAIL 270.09 seconds Incremental Build with patchesFAIL 862.79 seconds
Details
##############################
Test: Build - Make - FAIL
Desc: Build the BlueZ source tree
Output:tools/mgmt-tester.c: In function ‘main’:tools/mgmt-tester.c:12364:5: note: variable tracking size limit exceeded with ‘-fvar-tracking-assignments’, retrying without 12364 | int main(int argc, char *argv[])
| ^~~~
In file included from /usr/include/string.h:495,
from /usr/include/glib-2.0/glib/gtestutils.h:30,
from /usr/include/glib-2.0/glib.h:85,
from profiles/network/bnep.c:27:
In function ‘strncpy’,
inlined from ‘bnep_connadd’ at profiles/network/bnep.c:111:2:
/usr/include/x86_64-linux-gnu/bits/string_fortified.h:106:10: error: ‘__builtin_strncpy’ specified bound 16 equals destination size [-Werror=stringop-truncation]
106 | return __builtin___strncpy_chk (__dest, __src, __len, __bos (__dest));
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~/usr/include/x86_64-linux-gnu/bits/string_fortified.h:106:10: error: ‘__builtin_strncpy’ specified bound 16 equals destination size [-Werror=stringop-truncation]
cc1: all warnings being treated as errors
make[1]: *** [Makefile:7271: profiles/network/bnep.o] Error 1
make: *** [Makefile:4301: all] Error 2
##############################
Test: Make Check - FAIL
Desc: Run 'make check'
Output:
In file included from /usr/include/string.h:495,
from /usr/include/glib-2.0/glib/gtestutils.h:30,
from /usr/include/glib-2.0/glib.h:85,
from profiles/network/bnep.c:27:
In function ‘strncpy’,
inlined from ‘bnep_connadd’ at profiles/network/bnep.c:111:2:
/usr/include/x86_64-linux-gnu/bits/string_fortified.h:106:10: error: ‘__builtin_strncpy’ specified bound 16 equals destination size [-Werror=stringop-truncation]
106 | return __builtin___strncpy_chk (__dest, __src, __len, __bos (__dest));
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~/usr/include/x86_64-linux-gnu/bits/string_fortified.h:106:10: error: ‘__builtin_strncpy’ specified bound 16 equals destination size [-Werror=stringop-truncation]
cc1: all warnings being treated as errors
make[1]: *** [Makefile:7271: profiles/network/bnep.o] Error 1
make: *** [Makefile:11305: check] Error 2
##############################
Test: Build w/ext ELL - Make - FAIL
Desc: Build BlueZ source with '--enable-external-ell' configuration
Output:tools/mgmt-tester.c: In function ‘main’:tools/mgmt-tester.c:12364:5: note: variable tracking size limit exceeded with ‘-fvar-tracking-assignments’, retrying without 12364 | int main(int argc, char *argv[])
| ^~~~
In file included from /usr/include/string.h:495,
from /usr/include/glib-2.0/glib/gtestutils.h:30,
from /usr/include/glib-2.0/glib.h:85,
from profiles/network/bnep.c:27:
In function ‘strncpy’,
inlined from ‘bnep_connadd’ at profiles/network/bnep.c:111:2:
/usr/include/x86_64-linux-gnu/bits/string_fortified.h:106:10: error: ‘__builtin_strncpy’ specified bound 16 equals destination size [-Werror=stringop-truncation]
106 | return __builtin___strncpy_chk (__dest, __src, __len, __bos (__dest));
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~/usr/include/x86_64-linux-gnu/bits/string_fortified.h:106:10: error: ‘__builtin_strncpy’ specified bound 16 equals destination size [-Werror=stringop-truncation]
cc1: all warnings being treated as errors
make[1]: *** [Makefile:7271: profiles/network/bnep.o] Error 1
make: *** [Makefile:4301: all] Error 2
##############################
Test: Incremental Build with patches - FAIL
Desc: Incremental build per patch in the series
Output:tools/mgmt-tester.c: In function ‘main’:tools/mgmt-tester.c:12364:5: note: variable tracking size limit exceeded with ‘-fvar-tracking-assignments’, retrying without 12364 | int main(int argc, char *argv[])
| ^~~~
In file included from /usr/include/string.h:495,
from /usr/include/glib-2.0/glib/gtestutils.h:30,
from /usr/include/glib-2.0/glib.h:85,
from profiles/network/bnep.c:27:
In function ‘strncpy’,
inlined from ‘bnep_connadd’ at profiles/network/bnep.c:111:2:
/usr/include/x86_64-linux-gnu/bits/string_fortified.h:106:10: error: ‘__builtin_strncpy’ specified bound 16 equals destination size [-Werror=stringop-truncation]
106 | return __builtin___strncpy_chk (__dest, __src, __len, __bos (__dest));
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~/usr/include/x86_64-linux-gnu/bits/string_fortified.h:106:10: error: ‘__builtin_strncpy’ specified bound 16 equals destination size [-Werror=stringop-truncation]
cc1: all warnings being treated as errors
make[1]: *** [Makefile:7271: profiles/network/bnep.o] Error 1
make: *** [Makefile:4301: all] Error 2
---
Regards,
Linux Bluetooth