summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorSergey Vojtovich <sergey.vojtovich@oracle.com>2011-06-03 11:27:11 +0400
committerSergey Vojtovich <sergey.vojtovich@oracle.com>2011-06-03 11:27:11 +0400
commit95963dd20a06d034844b216b2260bfc15be3a75f (patch)
tree97873a52ebb2bbad7163dd1f540943a267995794 /include
parent9e2b7fa7d5f0cbe4920be5567314b6de1af660a4 (diff)
downloadmariadb-git-95963dd20a06d034844b216b2260bfc15be3a75f.tar.gz
BUG#12611785 - AUDIT INTERFACE STRICT-ALIASING WARNINGS
The types mysql_event_general/mysql_event_connection are being cast to the incompatible type mysql_event. The way mysql_event and the other types are designed are prone to strict aliasing violations and can break things depending on how compilers optimizes this code. This patch fixes audit interface, so it confirms to strict- aliasing rules. It introduces incompatible changes to audit interface: - mysql_event type has been removed; - event_class has been removed from mysql_event_generic and mysql_event_connection types; - st_mysql_audit::event_notify() second argument is event_class; - st_mysql_audit::event_notify() third argument is event of type (const void *). "Writing Audit Plugins" section of manual should be updated: http://dev.mysql.com/doc/refman/5.5/en/writing-audit-plugins.html include/mysql/plugin_audit.h: event_class has been moved out of mysql_event types. include/mysql/plugin_audit.h.pp: event_class has been moved out of mysql_event types. plugin/audit_null/audit_null.c: event_class has been moved out of mysql_event types. sql/sql_audit.cc: event_class has been moved out of mysql_event types.
Diffstat (limited to 'include')
-rw-r--r--include/mysql/plugin_audit.h21
-rw-r--r--include/mysql/plugin_audit.h.pp10
2 files changed, 7 insertions, 24 deletions
diff --git a/include/mysql/plugin_audit.h b/include/mysql/plugin_audit.h
index 8811c832949..5072ad2b44c 100644
--- a/include/mysql/plugin_audit.h
+++ b/include/mysql/plugin_audit.h
@@ -24,16 +24,7 @@
#define MYSQL_AUDIT_CLASS_MASK_SIZE 1
-#define MYSQL_AUDIT_INTERFACE_VERSION 0x0200
-
-/*
- The first word in every event class struct indicates the specific
- class of the event.
-*/
-struct mysql_event
-{
- unsigned int event_class;
-};
+#define MYSQL_AUDIT_INTERFACE_VERSION 0x0300
/*************************************************************************
@@ -55,7 +46,6 @@ struct mysql_event
struct mysql_event_general
{
- unsigned int event_class;
unsigned int event_subclass;
int general_error_code;
unsigned long general_thread_id;
@@ -87,7 +77,6 @@ struct mysql_event_general
struct mysql_event_connection
{
- unsigned int event_class;
unsigned int event_subclass;
int status;
unsigned long thread_id;
@@ -118,9 +107,9 @@ struct mysql_event_connection
waiting for the next query from the client.
event_notify() is invoked whenever an event occurs which is of any
- class for which the plugin has interest. The first word of the
- mysql_event argument indicates the specific event class and the
- remainder of the structure is as required for that class.
+ class for which the plugin has interest. The second argument
+ indicates the specific event class and the third argument is data
+ as required for that class.
class_mask is an array of bits used to indicate what event classes
that this plugin wants to receive.
@@ -130,7 +119,7 @@ struct st_mysql_audit
{
int interface_version;
void (*release_thd)(MYSQL_THD);
- void (*event_notify)(MYSQL_THD, const struct mysql_event *);
+ void (*event_notify)(MYSQL_THD, unsigned int, const void *);
unsigned long class_mask[MYSQL_AUDIT_CLASS_MASK_SIZE];
};
diff --git a/include/mysql/plugin_audit.h.pp b/include/mysql/plugin_audit.h.pp
index 732503e176a..16aaeab21c3 100644
--- a/include/mysql/plugin_audit.h.pp
+++ b/include/mysql/plugin_audit.h.pp
@@ -43,7 +43,7 @@ typedef enum _thd_wait_type_e {
THD_WAIT_BINLOG= 8,
THD_WAIT_GROUP_COMMIT= 9,
THD_WAIT_SYNC= 10,
- THD_WAIT_LAST= 11
+ THD_WAIT_LAST= 11
} thd_wait_type;
extern struct thd_wait_service_st {
void (*thd_wait_begin_func)(void*, int);
@@ -195,13 +195,8 @@ void mysql_query_cache_invalidate4(void* thd,
void *thd_get_ha_data(const void* thd, const struct handlerton *hton);
void thd_set_ha_data(void* thd, const struct handlerton *hton,
const void *ha_data);
-struct mysql_event
-{
- unsigned int event_class;
-};
struct mysql_event_general
{
- unsigned int event_class;
unsigned int event_subclass;
int general_error_code;
unsigned long general_thread_id;
@@ -217,7 +212,6 @@ struct mysql_event_general
};
struct mysql_event_connection
{
- unsigned int event_class;
unsigned int event_subclass;
int status;
unsigned long thread_id;
@@ -240,6 +234,6 @@ struct st_mysql_audit
{
int interface_version;
void (*release_thd)(void*);
- void (*event_notify)(void*, const struct mysql_event *);
+ void (*event_notify)(void*, unsigned int, const void *);
unsigned long class_mask[1];
};