<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/118150>118150</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
More granular UBSAN Frame based filtering
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
mariadb-RoelVandePaar
</td>
</tr>
</table>
<pre>
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. What would be much 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?
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJykVk2P2zgS_TX0hbBBkfo8-KDeHmNy6MlgMtnFngSKLFncUJSHpLrb--sXRdlxdyebzEwAA7IoVr2qV8V6lCGYowPYk-KOFPcbucRx9vtJeiN1v_1tBvtP6TT8KqXf9LM-79sQlgnoE9BRPgINUapP1JpPQONoAiW8nvsojQNNl2DckZKSwfNp9pF-vPvQ_tK9__X3d-9_-UDE_ckbF7vkIXqpgIj7jIjWA-7uwPvZd_F8WtdLRnhDREtY-pXs8mMt4YcIIRJ-yNiu7HR_7IJ0hB-mczgHfA7dJzgrqUbYKSLaoikYEW2GYNQvLpoJaILDBSWtpXGmw-JUNLOjxpnYBTOdLKCfLjmicfTzchzpaTYugkcL49TsPah4s8XwKeGVcRGpIbzFLHj9OBtN09s_6OJSDTQ1Lr56t7M7fnPDV98bwqu_w0peIynUzRHw-fWsNQyptCN4IKyllFLCBaPsuSjzvi5kryqhqLmw9tmwSyQ5aekPVIu1CJa9AOtVmX0J9tcxSpYlDHbLiV9hMqhkzVJOo-z-LFL4wxJ-GKXTFvxOJZBMFJjPDUNcMKqBVZyXA2Kc_KwghBtGILx-2z5qlJ6q2SFy6qHwIqjLErbY1eDl2_divhIT1qiz1BYZv0Wd36LmvBmqzwUI4B_Bd2qeTrMDF0MK-buA0zn8YfWKVmS5IKIVN7TihpaVsmeItlp0kzRuJQczRE5Shn8myVeYNSuJaKsbZ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