bus1 / dbus-broker

Linux D-Bus Message Broker
https://github.com/bus1/dbus-broker/wiki
Apache License 2.0
667 stars 78 forks source link

The unit tests seem to fail under UBSan (clang) #292

Closed evverx closed 2 years ago

evverx commented 2 years ago
CC=clang CXX=clang++ meson -Db_sanitize=address,undefined -Db_lundef=false build
find -name meson.build | xargs sed -i '/-Wl,--no-undefined/d'
ninja -C ./build -v
UBSAN_OPTIONS=print_stacktrace=1:print_summary=1:halt_on_error=1 ninja -C ./build/ -v test
 1/46 libcstdaux-1 / API Symbol Visibility       FAIL            0.04s   exit status 1
00:15:39 MALLOC_PERTURB_=6 /home/vagrant/dbus-broker/build/subprojects/libcstdaux-1/src/test-api
----------------------------------- output -----------------------------------
stderr:
../subprojects/libcstdaux-1/src/test-api.c:158:17: runtime error: member access within null pointer of type 'struct FooBarContainer'
    #0 0x4fd16f in test_api_macros /home/vagrant/dbus-broker/build/../subprojects/libcstdaux-1/src/test-api.c:158:17
    #1 0x4fc453 in main /home/vagrant/dbus-broker/build/../subprojects/libcstdaux-1/src/test-api.c:211:9
    #2 0x7f096f05143f in __libc_start_call_main (/lib64/libc.so.6+0x4043f)
    #3 0x7f096f0514ef in __libc_start_main@GLIBC_2.2.5 (/lib64/libc.so.6+0x404ef)
    #4 0x41c3b4 in _start (/home/vagrant/dbus-broker/build/subprojects/libcstdaux-1/src/test-api+0x41c3b4)

SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior ../subprojects/libcstdaux-1/src/test-api.c:158:17 in
------------------------------------------------------------------------------

 2/46 libcstdaux-1 / Basic API Behavior          FAIL            0.05s   exit status 1
00:15:39 MALLOC_PERTURB_=43 /home/vagrant/dbus-broker/build/subprojects/libcstdaux-1/src/test-basic
----------------------------------- output -----------------------------------
stderr:
../subprojects/libcstdaux-1/src/test-basic.c:137:17: runtime error: member access within null pointer of type 'struct foobar'
    #0 0x4fcda4 in test_misc /home/vagrant/dbus-broker/build/../subprojects/libcstdaux-1/src/test-basic.c:137:17
    #1 0x4fc42d in main /home/vagrant/dbus-broker/build/../subprojects/libcstdaux-1/src/test-basic.c:491:9
    #2 0x7fc939f0443f in __libc_start_call_main (/lib64/libc.so.6+0x4043f)
    #3 0x7fc939f044ef in __libc_start_main@GLIBC_2.2.5 (/lib64/libc.so.6+0x404ef)
    #4 0x41c3a4 in _start (/home/vagrant/dbus-broker/build/subprojects/libcstdaux-1/src/test-basic+0x41c3a4)

SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior ../subprojects/libcstdaux-1/src/test-basic.c:137:17 in
------------------------------------------------------------------------------

 3/46 libcutf8-1 / API Symbol Visibility         OK              0.03s
00:15:39 MALLOC_PERTURB_=229 /home/vagrant/dbus-broker/build/subprojects/libcutf8-1/src/test-api
----------------------------------- output -----------------------------------
------------------------------------------------------------------------------

 4/46 libcdvar-1 / API Symbol Visibility         OK              0.03s
00:15:39 MALLOC_PERTURB_=191 /home/vagrant/dbus-broker/build/subprojects/libcdvar-1/src/test-api
----------------------------------- output -----------------------------------
------------------------------------------------------------------------------

 5/46 libcdvar-1 / Basic API Behavior            FAIL            0.05s   exit status 1
00:15:39 MALLOC_PERTURB_=80 /home/vagrant/dbus-broker/build/subprojects/libcdvar-1/src/test-basic
----------------------------------- output -----------------------------------
stderr:
../subprojects/libcdvar-1/src/c-dvar-writer.c:45:29: runtime error: applying zero offset to null pointer
    #0 0x51cbc8 in c_dvar_write_data /home/vagrant/dbus-broker/build/../subprojects/libcdvar-1/src/c-dvar-writer.c:45:29
    #1 0x518521 in c_dvar_try_vwrite /home/vagrant/dbus-broker/build/../subprojects/libcdvar-1/src/c-dvar-writer.c:131:29
    #2 0x51695b in c_dvar_vwrite /home/vagrant/dbus-broker/build/../subprojects/libcdvar-1/src/c-dvar-writer.c:309:30
    #3 0x5006ad in c_dvar_write /home/vagrant/dbus-broker/build/../subprojects/libcdvar-1/src/c-dvar.h:349:13
    #4 0x4fcb0d in test_basic_serialization /home/vagrant/dbus-broker/build/../subprojects/libcdvar-1/src/test-basic.c:49:9
    #5 0x4fc41f in main /home/vagrant/dbus-broker/build/../subprojects/libcdvar-1/src/test-basic.c:287:9
    #6 0x7fd7af91e43f in __libc_start_call_main (/lib64/libc.so.6+0x4043f)
    #7 0x7fd7af91e4ef in __libc_start_main@GLIBC_2.2.5 (/lib64/libc.so.6+0x404ef)
    #8 0x41c394 in _start (/home/vagrant/dbus-broker/build/subprojects/libcdvar-1/src/test-basic+0x41c394)

SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior ../subprojects/libcdvar-1/src/c-dvar-writer.c:45:29 in
------------------------------------------------------------------------------

 6/46 libcdvar-1 / D-Bus String Restrictions     OK              0.02s
00:15:39 MALLOC_PERTURB_=24 /home/vagrant/dbus-broker/build/subprojects/libcdvar-1/src/test-string
----------------------------------- output -----------------------------------
------------------------------------------------------------------------------

 7/46 libcdvar-1 / Type and Signature Parser     OK              0.02s
00:15:39 MALLOC_PERTURB_=186 /home/vagrant/dbus-broker/build/subprojects/libcdvar-1/src/test-type
----------------------------------- output -----------------------------------
------------------------------------------------------------------------------

 8/46 libcutf8-1 / Basic API Behavior            OK              0.16s
00:15:39 MALLOC_PERTURB_=18 /home/vagrant/dbus-broker/build/subprojects/libcutf8-1/src/test-basic
----------------------------------- output -----------------------------------
------------------------------------------------------------------------------

 9/46 libclist-3 / API Symbol Visibility         OK              0.03s
00:15:39 MALLOC_PERTURB_=35 /home/vagrant/dbus-broker/build/subprojects/libclist-3/src/test-api
----------------------------------- output -----------------------------------
------------------------------------------------------------------------------

10/46 libclist-3 / Basic API Behavior            OK              0.03s
00:15:39 MALLOC_PERTURB_=194 /home/vagrant/dbus-broker/build/subprojects/libclist-3/src/test-basic
----------------------------------- output -----------------------------------
------------------------------------------------------------------------------

11/46 libclist-3 / Embedded List Nodes           OK              0.03s
00:15:39 MALLOC_PERTURB_=16 /home/vagrant/dbus-broker/build/subprojects/libclist-3/src/test-embed
----------------------------------- output -----------------------------------
------------------------------------------------------------------------------

12/46 libcrbtree-3 / API Symbol Visibility       OK              0.03s
00:15:39 MALLOC_PERTURB_=226 /home/vagrant/dbus-broker/build/subprojects/libcrbtree-3/src/test-api
----------------------------------- output -----------------------------------
------------------------------------------------------------------------------

13/46 libcrbtree-3 / Generic Map                 OK              0.04s
00:15:39 MALLOC_PERTURB_=153 /home/vagrant/dbus-broker/build/subprojects/libcrbtree-3/src/test-map
----------------------------------- output -----------------------------------
------------------------------------------------------------------------------

14/46 libcrbtree-3 / Miscellaneous               OK              0.02s
00:15:39 MALLOC_PERTURB_=245 /home/vagrant/dbus-broker/build/subprojects/libcrbtree-3/src/test-misc
----------------------------------- output -----------------------------------
------------------------------------------------------------------------------

15/46 libcini-1 / API Symbol Visibility          OK              0.03s
00:15:39 MALLOC_PERTURB_=81 /home/vagrant/dbus-broker/build/subprojects/libcini-1/src/test-api
----------------------------------- output -----------------------------------
------------------------------------------------------------------------------

16/46 libcini-1 / Basic API Behavior             OK              0.03s
00:15:39 MALLOC_PERTURB_=165 /home/vagrant/dbus-broker/build/subprojects/libcini-1/src/test-basic
----------------------------------- output -----------------------------------
------------------------------------------------------------------------------

17/46 libcini-1 / Parser Capabilities            OK              0.02s
00:15:39 MALLOC_PERTURB_=60 /home/vagrant/dbus-broker/build/subprojects/libcini-1/src/test-reader
----------------------------------- output -----------------------------------
------------------------------------------------------------------------------

18/46 libcshquote-1 / API Symbol Visibility      OK              0.03s
00:15:39 MALLOC_PERTURB_=44 /home/vagrant/dbus-broker/build/subprojects/libcshquote-1/src/test-api
----------------------------------- output -----------------------------------
stderr:
0
------------------------------------------------------------------------------

19/46 libcshquote-1 / Basic API Behavior         OK              0.02s
00:15:39 MALLOC_PERTURB_=48 /home/vagrant/dbus-broker/build/subprojects/libcshquote-1/src/test-basic
----------------------------------- output -----------------------------------
------------------------------------------------------------------------------

20/46 libcshquote-1 / Private Helper Functions   OK              0.03s
00:15:39 MALLOC_PERTURB_=3 /home/vagrant/dbus-broker/build/subprojects/libcshquote-1/src/test-private
----------------------------------- output -----------------------------------
------------------------------------------------------------------------------

21/46 dbus-broker / Address Handling             OK              0.02s
00:15:39 MALLOC_PERTURB_=33 /home/vagrant/dbus-broker/build/src/test-address
----------------------------------- output -----------------------------------
------------------------------------------------------------------------------

22/46 dbus-broker / AppArmor Handling            OK              0.03s
00:15:39 MALLOC_PERTURB_=220 /home/vagrant/dbus-broker/build/src/test-apparmor
----------------------------------- output -----------------------------------
------------------------------------------------------------------------------

23/46 dbus-broker / Configuration Parser         FAIL            0.07s   exit status 1
00:15:39 MALLOC_PERTURB_=160 /home/vagrant/dbus-broker/build/src/test-config
----------------------------------- output -----------------------------------
stderr:
../src/launch/config.c:995:49: runtime error: member access within null pointer of type 'ConfigParser' (aka 'struct ConfigParser')
    #0 0x50d715 in config_parser_begin_fn /home/vagrant/dbus-broker/build/../src/launch/config.c:995:49
    #1 0x7f782cbde793  (/lib64/libexpat.so.1+0xd793)
    #2 0x7f782cbdce1d  (/lib64/libexpat.so.1+0xbe1d)
    #3 0x7f782cbddd0b  (/lib64/libexpat.so.1+0xcd0b)
    #4 0x7f782cbe1e54 in XML_ParseBuffer (/lib64/libexpat.so.1+0x10e54)
    #5 0x5073e6 in config_parser_include /home/vagrant/dbus-broker/build/../src/launch/config.c:1302:21
    #6 0x504233 in config_parser_read /home/vagrant/dbus-broker/build/../src/launch/config.c:1360:21
    #7 0x4fd636 in parse_config /home/vagrant/dbus-broker/build/../src/launch/test-config.c:63:13
    #8 0x4fdbc3 in parse_config_inline /home/vagrant/dbus-broker/build/../src/launch/test-config.c:81:16
    #9 0x4fcf7e in test_config_sample0 /home/vagrant/dbus-broker/build/../src/launch/test-config.c:121:13
    #10 0x4fc600 in main /home/vagrant/dbus-broker/build/../src/launch/test-config.c:154:9
    #11 0x7f782c9ee43f in __libc_start_call_main (/lib64/libc.so.6+0x4043f)
    #12 0x7f782c9ee4ef in __libc_start_main@GLIBC_2.2.5 (/lib64/libc.so.6+0x404ef)
    #13 0x41c4b4 in _start (/home/vagrant/dbus-broker/build/src/test-config+0x41c4b4)

SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior ../src/launch/config.c:995:49 in
------------------------------------------------------------------------------

24/46 dbus-broker / Directory Watch              OK              0.03s
00:15:39 MALLOC_PERTURB_=231 /home/vagrant/dbus-broker/build/src/test-dirwatch
----------------------------------- output -----------------------------------
------------------------------------------------------------------------------

25/46 dbus-broker / Event Dispatcher             OK              0.02s
00:15:39 MALLOC_PERTURB_=16 /home/vagrant/dbus-broker/build/src/test-dispatch
----------------------------------- output -----------------------------------
------------------------------------------------------------------------------

26/46 dbus-broker / Error Handling               OK              0.02s
00:15:39 MALLOC_PERTURB_=3 /home/vagrant/dbus-broker/build/src/test-error
----------------------------------- output -----------------------------------
stderr:
ERROR test_basic @ ../src/util/test-error.c +18: Operation not permitted
ERROR test_basic @ ../src/util/test-error.c +22: Return code 1
      test_basic @ ../src/util/test-error.c +30
      test_basic @ ../src/util/test-error.c +42
ERROR test_basic @ ../src/util/test-error.c +46: Return code 1
------------------------------------------------------------------------------

27/46 dbus-broker / Utility File-Desciptor Lists OK              0.02s
00:15:39 MALLOC_PERTURB_=164 /home/vagrant/dbus-broker/build/src/test-fdlist
----------------------------------- output -----------------------------------
------------------------------------------------------------------------------

28/46 dbus-broker / D-Bus Match Handling         FAIL            0.06s   exit status 1
00:15:40 MALLOC_PERTURB_=231 /home/vagrant/dbus-broker/build/src/test-match
----------------------------------- output -----------------------------------
stderr:
../src/bus/match.c:454:41: runtime error: member access within null pointer of type 'MatchRegistryByPath' (aka 'struct MatchRegistryByPath')
    #0 0x5088b8 in match_registry_by_path_compare /home/vagrant/dbus-broker/build/../src/bus/match.c:454:41
    #1 0x50c6c5 in c_rbtree_find_node /home/vagrant/dbus-broker/build/../subprojects/libcrbtree-3/src/c-rbtree.h:276:25
    #2 0x50cbca in match_registry_get_destinations /home/vagrant/dbus-broker/build/../src/bus/match.c:1074:28
    #3 0x50cb98 in match_registry_get_subscribers /home/vagrant/dbus-broker/build/../src/bus/match.c:1087:9
    #4 0x5062e8 in test_match /home/vagrant/dbus-broker/build/../src/bus/test-match.c:167:9
    #5 0x4ff8eb in test_individual_matches /home/vagrant/dbus-broker/build/../src/bus/test-match.c:182:9
    #6 0x4fd615 in main /home/vagrant/dbus-broker/build/../src/bus/test-match.c:360:9
    #7 0x7fe6495f543f in __libc_start_call_main (/lib64/libc.so.6+0x4043f)
    #8 0x7fe6495f54ef in __libc_start_main@GLIBC_2.2.5 (/lib64/libc.so.6+0x404ef)
    #9 0x41d404 in _start (/home/vagrant/dbus-broker/build/src/test-match+0x41d404)

SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior ../src/bus/match.c:454:41 in
------------------------------------------------------------------------------

29/46 dbus-broker / D-Bus Message Abstraction    FAIL            0.05s   exit status 1
00:15:40 MALLOC_PERTURB_=5 /home/vagrant/dbus-broker/build/src/test-message
----------------------------------- output -----------------------------------
stderr:
../src/dbus/message.c:144:28: runtime error: member access within null pointer of type 'Message' (aka 'struct Message')
    #0 0x502344 in message_free /home/vagrant/dbus-broker/build/../src/dbus/message.c:144:28
    #1 0x4fe3b4 in ref_sub /home/vagrant/dbus-broker/build/../src/util/ref.h:198:33
    #2 0x4fe279 in ref_dec /home/vagrant/dbus-broker/build/../src/util/ref.h:218:16
    #3 0x4fe244 in message_unref /home/vagrant/dbus-broker/build/../src/dbus/message.h:136:17
    #4 0x4fca39 in test_setup /home/vagrant/dbus-broker/build/../src/dbus/test-message.c:23:14
    #5 0x4fc47a in main /home/vagrant/dbus-broker/build/../src/dbus/test-message.c:66:9
    #6 0x7f39e555c43f in __libc_start_call_main (/lib64/libc.so.6+0x4043f)
    #7 0x7f39e555c4ef in __libc_start_main@GLIBC_2.2.5 (/lib64/libc.so.6+0x404ef)
    #8 0x41c3f4 in _start (/home/vagrant/dbus-broker/build/src/test-message+0x41c3f4)

SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior ../src/dbus/message.c:144:28 in
------------------------------------------------------------------------------

30/46 dbus-broker / Miscellaneous Helpers        OK              0.02s
00:15:40 MALLOC_PERTURB_=3 /home/vagrant/dbus-broker/build/src/test-misc
----------------------------------- output -----------------------------------
------------------------------------------------------------------------------

31/46 dbus-broker / Name Registry                FAIL            0.05s   exit status 1
00:15:40 MALLOC_PERTURB_=166 /home/vagrant/dbus-broker/build/src/test-name
----------------------------------- output -----------------------------------
stderr:
../src/bus/name.h:191:16: runtime error: member access within null pointer of type 'NameOwnership' (aka 'struct NameOwnership')
    #0 0x503c0a in name_primary /home/vagrant/dbus-broker/build/../src/bus/name.h:191:16
    #1 0x508fa4 in name_ownership_update /home/vagrant/dbus-broker/build/../src/bus/name.c:146:19
    #2 0x507ad3 in name_registry_request_name /home/vagrant/dbus-broker/build/../src/bus/name.c:418:13
    #3 0x4fd6b2 in test_setup /home/vagrant/dbus-broker/build/../src/bus/test-name.c:34:13
    #4 0x4fd51a in main /home/vagrant/dbus-broker/build/../src/bus/test-name.c:224:9
    #5 0x7fcd81ee043f in __libc_start_call_main (/lib64/libc.so.6+0x4043f)
    #6 0x7fcd81ee04ef in __libc_start_main@GLIBC_2.2.5 (/lib64/libc.so.6+0x404ef)
    #7 0x41d494 in _start (/home/vagrant/dbus-broker/build/src/test-name+0x41d494)

SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior ../src/bus/name.h:191:16 in
------------------------------------------------------------------------------

32/46 dbus-broker / NSS Cache                    OK              0.03s
00:15:40 MALLOC_PERTURB_=110 /home/vagrant/dbus-broker/build/src/test-nss-cache
----------------------------------- output -----------------------------------
stderr:
Looking up NSS user entry for 'com.example.InvalidUser'...
NSS returned no entry for 'com.example.InvalidUser'
Looking up NSS group entry for 'com.example.InvalidGroup'...
NSS returned no entry for 'com.example.InvalidGroup'
Looking up NSS user entry for 'root'...
NSS returned NAME 'root' and UID '0'
Looking up NSS group entry for 'root'...
NSS returned NAME 'root' and GID '0'
------------------------------------------------------------------------------

33/46 dbus-broker / SO_PEERSEC Queries           OK              0.02s
00:15:40 MALLOC_PERTURB_=224 /home/vagrant/dbus-broker/build/src/test-peersec
----------------------------------- output -----------------------------------
A:          socketpair(2): 53 'unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023'
B:          socketpair(2): 53 'unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023'
A: socketpair_fallback(2): 53 'unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023'
B: socketpair_fallback(2): 53 'unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023'
------------------------------------------------------------------------------

34/46 libcrbtree-3 / Basic API Behavior          OK              1.02s
00:15:39 MALLOC_PERTURB_=98 /home/vagrant/dbus-broker/build/subprojects/libcrbtree-3/src/test-basic
----------------------------------- output -----------------------------------
------------------------------------------------------------------------------

35/46 dbus-broker / Reply Tracking               FAIL            0.04s   exit status 1
00:15:40 MALLOC_PERTURB_=238 /home/vagrant/dbus-broker/build/src/test-reply
----------------------------------- output -----------------------------------
stderr:
../src/bus/reply.c:21:27: runtime error: member access within null pointer of type 'ReplySlot' (aka 'struct ReplySlot')
    #0 0x4fdd48 in reply_slot_compare /home/vagrant/dbus-broker/build/../src/bus/reply.c:21:27
    #1 0x4fda80 in c_rbtree_find_slot /home/vagrant/dbus-broker/build/../subprojects/libcrbtree-3/src/c-rbtree.h:341:25
    #2 0x4fcd5b in reply_slot_new /home/vagrant/dbus-broker/build/../src/bus/reply.c:46:16
    #3 0x4fc6a7 in test_basic /home/vagrant/dbus-broker/build/../src/bus/test-reply.c:24:13
    #4 0x4fc46a in main /home/vagrant/dbus-broker/build/../src/bus/test-reply.c:42:9
    #5 0x7fc217ca743f in __libc_start_call_main (/lib64/libc.so.6+0x4043f)
    #6 0x7fc217ca74ef in __libc_start_main@GLIBC_2.2.5 (/lib64/libc.so.6+0x404ef)
    #7 0x41c3e4 in _start (/home/vagrant/dbus-broker/build/src/test-reply+0x41c3e4)

SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior ../src/bus/reply.c:21:27 in
------------------------------------------------------------------------------

36/46 dbus-broker / D-Bus SASL Parser            OK              0.02s
00:15:40 MALLOC_PERTURB_=175 /home/vagrant/dbus-broker/build/src/test-sasl
----------------------------------- output -----------------------------------
------------------------------------------------------------------------------

37/46 dbus-broker / D-Bus Socket Abstraction     FAIL            0.05s   exit status 1
00:15:40 MALLOC_PERTURB_=33 /home/vagrant/dbus-broker/build/src/test-socket
----------------------------------- output -----------------------------------
stderr:
../src/dbus/message.c:144:28: runtime error: member access within null pointer of type 'Message' (aka 'struct Message')
    #0 0x5051a4 in message_free /home/vagrant/dbus-broker/build/../src/dbus/message.c:144:28
    #1 0x501224 in ref_sub /home/vagrant/dbus-broker/build/../src/util/ref.h:198:33
    #2 0x5010e9 in ref_dec /home/vagrant/dbus-broker/build/../src/util/ref.h:218:16
    #3 0x5010b4 in message_unref /home/vagrant/dbus-broker/build/../src/dbus/message.h:136:17
    #4 0x50103f in message_unrefp /home/vagrant/dbus-broker/build/../src/dbus/message.h:154:1
    #5 0x500ea2 in test_message /home/vagrant/dbus-broker/build/../src/dbus/test-socket.c:93:1
    #6 0x4fd4b4 in main /home/vagrant/dbus-broker/build/../src/dbus/test-socket.c:98:9
    #7 0x7f6b6c65c43f in __libc_start_call_main (/lib64/libc.so.6+0x4043f)
    #8 0x7f6b6c65c4ef in __libc_start_main@GLIBC_2.2.5 (/lib64/libc.so.6+0x404ef)
    #9 0x41d424 in _start (/home/vagrant/dbus-broker/build/src/test-socket+0x41d424)

SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior ../src/dbus/message.c:144:28 in
------------------------------------------------------------------------------

38/46 dbus-broker / Message Sender Stitching     FAIL            0.05s   exit status 1
00:15:40 MALLOC_PERTURB_=29 /home/vagrant/dbus-broker/build/src/test-stitching
----------------------------------- output -----------------------------------
stderr:
../subprojects/libcdvar-1/src/c-dvar-writer.c:45:29: runtime error: applying zero offset to null pointer
    #0 0x535788 in c_dvar_write_data /home/vagrant/dbus-broker/build/../subprojects/libcdvar-1/src/c-dvar-writer.c:45:29
    #1 0x5310e1 in c_dvar_try_vwrite /home/vagrant/dbus-broker/build/../subprojects/libcdvar-1/src/c-dvar-writer.c:131:29
    #2 0x52f51b in c_dvar_vwrite /home/vagrant/dbus-broker/build/../subprojects/libcdvar-1/src/c-dvar-writer.c:309:30
    #3 0x4fee6d in c_dvar_write /home/vagrant/dbus-broker/build/../subprojects/libcdvar-1/src/c-dvar.h:349:13
    #4 0x4fd529 in test_new_message /home/vagrant/dbus-broker/build/../src/dbus/test-stitching.c:50:9
    #5 0x4fd05d in test_stitching /home/vagrant/dbus-broker/build/../src/dbus/test-stitching.c:176:27
    #6 0x4fc47a in main /home/vagrant/dbus-broker/build/../src/dbus/test-stitching.c:187:9
    #7 0x7f2404ac243f in __libc_start_call_main (/lib64/libc.so.6+0x4043f)
    #8 0x7f2404ac24ef in __libc_start_main@GLIBC_2.2.5 (/lib64/libc.so.6+0x404ef)
    #9 0x41c3f4 in _start (/home/vagrant/dbus-broker/build/src/test-stitching+0x41c3f4)

SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior ../subprojects/libcdvar-1/src/c-dvar-writer.c:45:29 in
------------------------------------------------------------------------------

39/46 dbus-broker / Systemd Utilities            OK              0.02s
00:15:40 MALLOC_PERTURB_=218 /home/vagrant/dbus-broker/build/src/test-systemd
----------------------------------- output -----------------------------------
------------------------------------------------------------------------------

40/46 dbus-broker / User Accounting              FAIL            0.05s   exit status 1
00:15:40 MALLOC_PERTURB_=42 /home/vagrant/dbus-broker/build/src/test-user
----------------------------------- output -----------------------------------
stderr:
../src/util/user.c:354:22: runtime error: member access within null pointer of type 'User' (aka 'struct User')
    #0 0x504688 in user_compare /home/vagrant/dbus-broker/build/../src/util/user.c:354:22
    #1 0x5043c0 in c_rbtree_find_slot /home/vagrant/dbus-broker/build/../subprojects/libcrbtree-3/src/c-rbtree.h:341:25
    #2 0x503d4d in user_registry_ref_user /home/vagrant/dbus-broker/build/../src/util/user.c:428:16
    #3 0x4fc87f in test_setup /home/vagrant/dbus-broker/build/../src/util/test-user.c:22:13
    #4 0x4fc46a in main /home/vagrant/dbus-broker/build/../src/util/test-user.c:132:9
    #5 0x7f0d0a3d043f in __libc_start_call_main (/lib64/libc.so.6+0x4043f)
    #6 0x7f0d0a3d04ef in __libc_start_main@GLIBC_2.2.5 (/lib64/libc.so.6+0x404ef)
    #7 0x41c3e4 in _start (/home/vagrant/dbus-broker/build/src/test-user+0x41c3e4)

SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior ../src/util/user.c:354:22 in
------------------------------------------------------------------------------

41/46 dbus-broker / Broker API                   FAIL            0.16s   killed by signal 6 SIGABRT
00:15:40 MALLOC_PERTURB_=215 /home/vagrant/dbus-broker/build/test/dbus/test-broker
----------------------------------- output -----------------------------------
stderr:
../src/broker/controller.c:210:34: runtime error: member access within null pointer of type 'Controller' (aka 'struct Controller')
    #0 0x5076f5 in controller_dispatch_connection /home/vagrant/dbus-broker/build/../src/broker/controller.c:210:34
    #1 0x5c79fb in dispatch_context_dispatch /home/vagrant/dbus-broker/build/../src/util/dispatch.c:343:21
    #2 0x5045d0 in broker_run /home/vagrant/dbus-broker/build/../src/broker/broker.c:213:21
    #3 0x4ffb7a in run /home/vagrant/dbus-broker/build/../src/broker/main.c:259:21
    #4 0x4fd6c5 in main /home/vagrant/dbus-broker/build/../src/broker/main.c:289:13
    #5 0x7f579226943f in __libc_start_call_main (/lib64/libc.so.6+0x4043f)
    #6 0x7f57922694ef in __libc_start_main@GLIBC_2.2.5 (/lib64/libc.so.6+0x404ef)
    #7 0x41d4e4 in _start (/home/vagrant/dbus-broker/build/src/dbus-broker+0x41d4e4)

SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior ../src/broker/controller.c:210:34 in
test-broker: ../test/dbus/util-broker.c:260: void util_fork_broker(sd_bus **, sd_event *, int, pid_t *): Assertion `c_assert_result && "r >= 0"' failed.
------------------------------------------------------------------------------

42/46 dbus-broker / Driver API                   FAIL            0.18s   killed by signal 6 SIGABRT
00:15:40 MALLOC_PERTURB_=198 /home/vagrant/dbus-broker/build/test/dbus/test-driver
----------------------------------- output -----------------------------------
stderr:
../src/broker/controller.c:210:34: runtime error: member access within null pointer of type 'Controller' (aka 'struct Controller')
    #0 0x5076f5 in controller_dispatch_connection /home/vagrant/dbus-broker/build/../src/broker/controller.c:210:34
    #1 0x5c79fb in dispatch_context_dispatch /home/vagrant/dbus-broker/build/../src/util/dispatch.c:343:21
    #2 0x5045d0 in broker_run /home/vagrant/dbus-broker/build/../src/broker/broker.c:213:21
    #3 0x4ffb7a in run /home/vagrant/dbus-broker/build/../src/broker/main.c:259:21
    #4 0x4fd6c5 in main /home/vagrant/dbus-broker/build/../src/broker/main.c:289:13
    #5 0x7f399957343f in __libc_start_call_main (/lib64/libc.so.6+0x4043f)
    #6 0x7f39995734ef in __libc_start_main@GLIBC_2.2.5 (/lib64/libc.so.6+0x404ef)
    #7 0x41d4e4 in _start (/home/vagrant/dbus-broker/build/src/dbus-broker+0x41d4e4)

SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior ../src/broker/controller.c:210:34 in
test-driver: ../test/dbus/util-broker.c:260: void util_fork_broker(sd_bus **, sd_event *, int, pid_t *): Assertion `c_assert_result && "r >= 0"' failed.
------------------------------------------------------------------------------

43/46 dbus-broker / FD Stream Constraints        FAIL            0.17s   killed by signal 6 SIGABRT
00:15:41 MALLOC_PERTURB_=163 /home/vagrant/dbus-broker/build/test/dbus/test-fdstream
----------------------------------- output -----------------------------------
stderr:
../src/broker/controller.c:210:34: runtime error: member access within null pointer of type 'Controller' (aka 'struct Controller')
    #0 0x5076f5 in controller_dispatch_connection /home/vagrant/dbus-broker/build/../src/broker/controller.c:210:34
    #1 0x5c79fb in dispatch_context_dispatch /home/vagrant/dbus-broker/build/../src/util/dispatch.c:343:21
    #2 0x5045d0 in broker_run /home/vagrant/dbus-broker/build/../src/broker/broker.c:213:21
    #3 0x4ffb7a in run /home/vagrant/dbus-broker/build/../src/broker/main.c:259:21
    #4 0x4fd6c5 in main /home/vagrant/dbus-broker/build/../src/broker/main.c:289:13
    #5 0x7fa00e0e743f in __libc_start_call_main (/lib64/libc.so.6+0x4043f)
    #6 0x7fa00e0e74ef in __libc_start_main@GLIBC_2.2.5 (/lib64/libc.so.6+0x404ef)
    #7 0x41d4e4 in _start (/home/vagrant/dbus-broker/build/src/dbus-broker+0x41d4e4)

SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior ../src/broker/controller.c:210:34 in
test-fdstream: ../test/dbus/util-broker.c:260: void util_fork_broker(sd_bus **, sd_event *, int, pid_t *): Assertion `c_assert_result && "r >= 0"' failed.
------------------------------------------------------------------------------

44/46 dbus-broker / Client Lifetime              FAIL            0.18s   killed by signal 6 SIGABRT
00:15:41 MALLOC_PERTURB_=183 /home/vagrant/dbus-broker/build/test/dbus/test-lifetime
----------------------------------- output -----------------------------------
stderr:
../src/broker/controller.c:210:34: runtime error: member access within null pointer of type 'Controller' (aka 'struct Controller')
    #0 0x5076f5 in controller_dispatch_connection /home/vagrant/dbus-broker/build/../src/broker/controller.c:210:34
    #1 0x5c79fb in dispatch_context_dispatch /home/vagrant/dbus-broker/build/../src/util/dispatch.c:343:21
    #2 0x5045d0 in broker_run /home/vagrant/dbus-broker/build/../src/broker/broker.c:213:21
    #3 0x4ffb7a in run /home/vagrant/dbus-broker/build/../src/broker/main.c:259:21
    #4 0x4fd6c5 in main /home/vagrant/dbus-broker/build/../src/broker/main.c:289:13
    #5 0x7f18825fa43f in __libc_start_call_main (/lib64/libc.so.6+0x4043f)
    #6 0x7f18825fa4ef in __libc_start_main@GLIBC_2.2.5 (/lib64/libc.so.6+0x404ef)
    #7 0x41d4e4 in _start (/home/vagrant/dbus-broker/build/src/dbus-broker+0x41d4e4)

SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior ../src/broker/controller.c:210:34 in
test-lifetime: ../test/dbus/util-broker.c:260: void util_fork_broker(sd_bus **, sd_event *, int, pid_t *): Assertion `c_assert_result && "r >= 0"' failed.
------------------------------------------------------------------------------

45/46 dbus-broker / Signals and Matches          FAIL            0.18s   killed by signal 6 SIGABRT
00:15:41 MALLOC_PERTURB_=195 /home/vagrant/dbus-broker/build/test/dbus/test-matches
----------------------------------- output -----------------------------------
stderr:
../src/broker/controller.c:210:34: runtime error: member access within null pointer of type 'Controller' (aka 'struct Controller')
    #0 0x5076f5 in controller_dispatch_connection /home/vagrant/dbus-broker/build/../src/broker/controller.c:210:34
    #1 0x5c79fb in dispatch_context_dispatch /home/vagrant/dbus-broker/build/../src/util/dispatch.c:343:21
    #2 0x5045d0 in broker_run /home/vagrant/dbus-broker/build/../src/broker/broker.c:213:21
    #3 0x4ffb7a in run /home/vagrant/dbus-broker/build/../src/broker/main.c:259:21
    #4 0x4fd6c5 in main /home/vagrant/dbus-broker/build/../src/broker/main.c:289:13
    #5 0x7fcf7ab3c43f in __libc_start_call_main (/lib64/libc.so.6+0x4043f)
    #6 0x7fcf7ab3c4ef in __libc_start_main@GLIBC_2.2.5 (/lib64/libc.so.6+0x404ef)
    #7 0x41d4e4 in _start (/home/vagrant/dbus-broker/build/src/dbus-broker+0x41d4e4)

SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior ../src/broker/controller.c:210:34 in
test-matches: ../test/dbus/util-broker.c:260: void util_fork_broker(sd_bus **, sd_event *, int, pid_t *): Assertion `c_assert_result && "r >= 0"' failed.
------------------------------------------------------------------------------

46/46 dbus-broker / D-Bus I/O Queues             OK              2.58s
00:15:40 MALLOC_PERTURB_=137 /home/vagrant/dbus-broker/build/src/test-queue
----------------------------------- output -----------------------------------
------------------------------------------------------------------------------

Summary of Failures:

 1/46 libcstdaux-1 / API Symbol Visibility       FAIL            0.04s   exit status 1
 2/46 libcstdaux-1 / Basic API Behavior          FAIL            0.05s   exit status 1
 5/46 libcdvar-1 / Basic API Behavior            FAIL            0.05s   exit status 1
23/46 dbus-broker / Configuration Parser         FAIL            0.07s   exit status 1
28/46 dbus-broker / D-Bus Match Handling         FAIL            0.06s   exit status 1
29/46 dbus-broker / D-Bus Message Abstraction    FAIL            0.05s   exit status 1
31/46 dbus-broker / Name Registry                FAIL            0.05s   exit status 1
35/46 dbus-broker / Reply Tracking               FAIL            0.04s   exit status 1
37/46 dbus-broker / D-Bus Socket Abstraction     FAIL            0.05s   exit status 1
38/46 dbus-broker / Message Sender Stitching     FAIL            0.05s   exit status 1
40/46 dbus-broker / User Accounting              FAIL            0.05s   exit status 1
41/46 dbus-broker / Broker API                   FAIL            0.16s   killed by signal 6 SIGABRT
42/46 dbus-broker / Driver API                   FAIL            0.18s   killed by signal 6 SIGABRT
43/46 dbus-broker / FD Stream Constraints        FAIL            0.17s   killed by signal 6 SIGABRT
44/46 dbus-broker / Client Lifetime              FAIL            0.18s   killed by signal 6 SIGABRT
45/46 dbus-broker / Signals and Matches          FAIL            0.18s   killed by signal 6 SIGABRT
dvdhrm commented 2 years ago

I think there are 2 underlying issues and they are both fixed now in the respective c-util projects. I honestly believe both issues are harmless (they are effectively pointer arithmetic on NULL, which is technically UB, but iirc not used by gcc/llvm). But this should definitely be fixed. Thanks a lot for the report!

evverx commented 2 years ago

I can't seem to reproduce it anymore. Thanks!

I honestly believe both issues are harmless

Agreed. They would have prevented OSS-Fuzz (where clang is used) from discovering real issues though because the fuzz target would have failed as soon as it started. Now that those issues are gone it should make it possible for OSS-Fuzz to keep going.