Skip to content

More granular UBSAN Frame based filtering #118150

Open
@mariadb-RoelVandePaar

Description

@mariadb-RoelVandePaar

Assume we have stack like this (obtained using export UBSAN_OPTIONS=print_stacktrace=1:report_error_type=1):

/test/10.6_dbg_san/mysys/mf_keycache.c:5950:11: runtime error: call to function init_simple_key_cache through pointer to incorrect function type 'int (*)(void *, unsigned int, unsigned long, unsigned int, unsigned int, unsigned int)'
/test/10.6_dbg_san/mysys/mf_keycache.c:480: note: init_simple_key_cache defined here
    #0 0x564b85abc73c in init_key_cache_internal /test/10.6_dbg_san/mysys/mf_keycache.c:5950:11
    #1 0x564b85abbc61 in init_key_cache /test/10.6_dbg_san/mysys/mf_keycache.c:6010:10
    #2 0x564b81e7a80c in ha_init_key_cache /test/10.6_dbg_san/sql/handler.cc:6135:5
    #3 0x564b7f07226f in process_key_caches(int (*)(char const*, st_key_cache*, void*), void*) /test/10.6_dbg_san/sql/keycaches.cc:180:12
    #4 0x564b7f0229f7 in init_server_components() /test/10.6_dbg_san/sql/mysqld.cc:5143:3
    #5 0x564b7f016ab0 in mysqld_main(int, char**) /test/10.6_dbg_san/sql/mysqld.cc:5806:7
    #6 0x564b7f001863 in main /test/10.6_dbg_san/sql/main.cc:34:10
    #7 0x14f7dde2a1c9 in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16
    #8 0x14f7dde2a28a in __libc_start_main csu/../csu/libc-start.c:360:3
    #9 0x564b7ef26034 in _start (/test/UBASAN_MD271124-mariadb-10.6.21-linux-x86_64-dbg/bin/mariadbd+0x3eb8034) (BuildId: 3cd87cd3953ac9cf3a930328b34dbd55d44c8146)
 
SUMMARY: UndefinedBehaviorSanitizer: function-type-mismatch /test/10.6_dbg_san/mysys/mf_keycache.c:5950:11 

Then we can add a function:init_key_cache_internal UBSAN runtime supression in some text file like UBSAN.filter and use the same with export UBSAN_OPTIONS=suppressions=${HOME}/UBSAN.filter:print_stacktrace=1:report_error_type=1; etc.

However, this will filter all stacks which have any reference to init_key_cache_internal and as such the filter is significantly too wide.

Note also that the current suppressing/filtering is significantly self-limiting. Over time, functions which occur frequently in stack traces and which were previously suppressed can hide many (or all) issues, even when they are unrelated to the original bug in a more specific frame.

What would be significantly more helpful is something like:

function:init_key_cache_internal->init_key_cache->ha_init_key_cache

Or similar. However, there seems to be no way to currently do this. Is there a way to do this, and if not - can it be added please?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions