Details
Description
Now that MDEV-26272 was finally fixed, I thought that I would give clang-16 a try with cmake -DWITH_UBSAN=ON. One of the many errors (a function pointer type mismatch) would be fixed by the following:
diff --git a/sql/wsrep_plugin.cc b/sql/wsrep_plugin.cc
|
index 743b8a593b8..3fa5f7b7ef4 100644
|
--- a/sql/wsrep_plugin.cc
|
+++ b/sql/wsrep_plugin.cc
|
@@ -18,18 +18,6 @@
|
|
#include <mysql/plugin.h>
|
|
-static int wsrep_plugin_init(void *p)
|
-{
|
- WSREP_DEBUG("wsrep_plugin_init()");
|
- return 0;
|
-}
|
-
|
-static int wsrep_plugin_deinit(void *p)
|
-{
|
- WSREP_DEBUG("wsrep_plugin_deinit()");
|
- return 0;
|
-}
|
-
|
struct Mysql_replication wsrep_plugin= {
|
MYSQL_REPLICATION_INTERFACE_VERSION
|
};
|
@@ -42,8 +30,8 @@ maria_declare_plugin(wsrep)
|
"Codership Oy",
|
"Wsrep replication plugin",
|
PLUGIN_LICENSE_GPL,
|
- wsrep_plugin_init,
|
- wsrep_plugin_deinit,
|
+ NULL,
|
+ NULL,
|
0x0100,
|
NULL, /* Status variables */
|
NULL, /* System variables */ |
Attachments
Issue Links
- blocks
-
MDEV-33160 show_status_array() calls various functions via incompatible pointer
-
- Closed
-
- is blocked by
-
MDEV-26272 The macro MASTER_INFO_VAR invokes undefined behaviour
-
- Closed
-
- relates to
-
MDEV-25454 Make MariaDB server UBSAN safe
-
- Confirmed
-
I tested clang 15.0.7 as well, and it too is complaining about function pointer type mismatch. Here are two more examples:
10.4 9695974e4b212aa4820e0ccfeb164f5444c0d58e
/mariadb/10.4/sql/sql_show.cc:3843:7: runtime error: call to function wsrep_show_bf_aborts(THD*, st_mysql_show_var*, char*, enum_var_type) through pointer to incorrect function type 'int (*)(THD *, st_mysql_show_var *, void *, system_status_var *, enum_var_type)'
/mariadb/10.4/sql/sql_show.cc:3843:7: runtime error: call to function wsrep_show_ready(THD*, st_mysql_show_var*, char*) through pointer to incorrect function type 'int (*)(THD *, st_mysql_show_var *, void *, system_status_var *, enum_var_type)'
Because the mismatching parameters are at the end of the functions and unused, this may not result in an actual bug, depending on the ABI. For example, in the System-V AMD64 ABI, the first 6 function parameters would be passed in registers. It should not matter if the callee is ignoring some of these registers.