Skip to content

Commit

Permalink
Bug#24493829 SETTING THE NULL_AUDIT_EVENT_RECORD CAUSES SEGMENTATION …
Browse files Browse the repository at this point in the history
…FAULT

Problem:
========

null_audit_event_record variable is not intended to be modified outside
of the null_audit plugin. null_audit_event_record buffer must be allocated/deallocated
from within a plugin.

Fix:
====

null_audit_event_record is read only variable.

Reviewed-by:
============

Arun Kuruvila <arun.kuruvila@oracle.com>
Georgi Kodinov <georgi.kodinov@oracle.com>
  • Loading branch information
maras007 committed Nov 30, 2016
1 parent 7655951 commit b8c4bfd
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 0 deletions.
14 changes: 14 additions & 0 deletions mysql-test/r/audit_plugin_2.result
Expand Up @@ -1840,6 +1840,20 @@ SELECT @@null_audit_event_order_check;
@@null_audit_event_order_check
EVENT-ORDER-ABORT
## CUSTOM ERROR MESSAGE - END ##
##################
## Event record ##
##################
SET @@null_audit_event_record_def = 'MYSQL_AUDIT_GENERAL_RESULT;MYSQL_AUDIT_COMMAND_END';
SELECT 1;
1
1
SELECT @@null_audit_event_record;
@@null_audit_event_record
MYSQL_AUDIT_GENERAL_RESULT;;
MYSQL_AUDIT_GENERAL_STATUS;;
MYSQL_AUDIT_COMMAND_END;command_id="<expected_command_id>";
SET @@null_audit_event_record = '';
ERROR HY000: Variable 'null_audit_event_record' is a read only variable
UNINSTALL PLUGIN null_audit;
Warnings:
Warning 1620 Plugin is busy and will be uninstalled on shutdown
11 changes: 11 additions & 0 deletions mysql-test/t/audit_plugin_2.test
Expand Up @@ -1828,4 +1828,15 @@ SELECT 1;
SELECT @@null_audit_event_order_check;
--echo ## CUSTOM ERROR MESSAGE - END ##

--echo ##################
--echo ## Event record ##
--echo ##################
SET @@null_audit_event_record_def = 'MYSQL_AUDIT_GENERAL_RESULT;MYSQL_AUDIT_COMMAND_END';
SELECT 1;
--replace_regex /;command_id="[0-9]+"/;command_id="<expected_command_id>"/
SELECT @@null_audit_event_record;

--error ER_INCORRECT_GLOBAL_LOCAL_VAR
SET @@null_audit_event_record = '';

eval UNINSTALL PLUGIN null_audit;
1 change: 1 addition & 0 deletions plugin/audit_null/audit_null.c
Expand Up @@ -148,6 +148,7 @@ static MYSQL_THDVAR_STR(event_record_def,
"Event recording definition", NULL, NULL, NULL);

static MYSQL_THDVAR_STR(event_record,
PLUGIN_VAR_READONLY |
PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_MEMALLOC,
"Event recording", NULL, NULL, NULL);
/*
Expand Down

0 comments on commit b8c4bfd

Please sign in to comment.