New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error install plugin via plugin-load #2

Closed
kvendi opened this Issue Apr 11, 2012 · 7 comments

Comments

Projects
None yet
2 participants
@kvendi

kvendi commented Apr 11, 2012

root@mysql-slave:/home/pdobryakov/audit# mysql --version
mysql Ver 14.14 Distrib 5.5.22, for debian-linux-gnu (x86_64) using readline 6.1
root@mysql-slave:/home/pdobryakov/audit# uname -a
Linux mysql-slave.test1.alpari-ru.dom 3.2.0-1-amd64 #1 SMP Fri Feb 17 05:17:36 UTC 2012 x86_64 GNU/Linux
root@mysql-slave:/home/pdobryakov/audit# cat /etc/mysql/my.cnf
[mysqld]
.....................
audit_json_log_file=/var/lib/mysql/audit.log
audit_json_file=ON
audit_json_socket=OFF
audit_validate_checksum=OFF
plugin-load=AUDIT=libaudit_plugin.so

use audit-plugin-mysql-5.5-1.0.1-320-linux-x86_64.zip plugin

lines in error log

120411 14:10:37 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
120411 14:10:37 [Note] Plugin 'FEDERATED' is disabled.
120411 14:10:37 [Note] Audit Plugin: Set interface version to: 12933632 (50522)
120411 14:10:37 InnoDB: The InnoDB memory heap is disabled
120411 14:10:37 InnoDB: Mutexes and rw_locks use GCC atomic builtins
120411 14:10:37 InnoDB: Compressed tables use zlib 1.2.3.4
120411 14:10:37 InnoDB: Using Linux native AIO
120411 14:10:37 InnoDB: Initializing buffer pool, size = 128.0M
120411 14:10:37 InnoDB: Completed initialization of buffer pool
120411 14:10:37 InnoDB: highest supported file format is Barracuda.
120411 14:10:37 InnoDB: Waiting for the background threads to start
120411 14:10:38 InnoDB: 1.1.8 started; log sequence number 3923220777367
120411 14:10:38 [Note] Audit Plugin: starting up. Version: 1.0.1, Revision: 320. AUDIT plugin interface version: 50522. MySQL Server version: 5.5.22-1dotdeb.0-log.
120411 14:10:38 [Note] Audit Plugin: setup_offsets offsets_string (null)
120411 14:10:38 [Note] Audit Plugin: Couldn't find proper THD offsets for: 5.5.22-1
dotdeb.0-log
120411 14:10:38 [ERROR] Plugin 'AUDIT' init function returned error.
120411 14:10:38 [Note] Audit Plugin: removing hot patching function: 0x5c7a2070
120411 14:10:38 [Note] Audit Plugin: targetPage: 0x5c7a2000 targetFunction: 0x5c7a2070
120411 14:10:38 [Note] Audit Plugin: removing hot patching function: 0x5c75c520
120411 14:10:38 [Note] Audit Plugin: targetPage: 0x5c75c000 targetFunction: 0x5c75c520
120411 14:10:38 [Note] Audit Plugin: removing hot patching function: 0x5c76cfe0
120411 14:10:38 [Note] Audit Plugin: targetPage: 0x5c76c000 targetFunction: 0x5c76cfe0
120411 14:10:38 [Note] Audit Plugin: removing hot patching function: 0x5c774160
120411 14:10:38 [Note] Audit Plugin: targetPage: 0x5c774000 targetFunction: 0x5c774160
120411 14:10:38 [Note] Audit Plugin: removing hot patching function: 0x5c7a1d70
120411 14:10:38 [Note] Audit Plugin: targetPage: 0x5c7a1000 targetFunction: 0x5c7a1d70
120411 14:10:38 [Note] Audit Plugin: removing hot patching function: 0x5c7a6d70
120411 14:10:38 [Note] Audit Plugin: targetPage: 0x5c7a6000 targetFunction: 0x5c7a6d70
120411 14:10:39 [Note] Event Scheduler: Loaded 168 events
120411 14:10:39 [Note] /usr/sbin/mysqld: ready for connections.

@ghost ghost assigned glicht Apr 11, 2012

@glicht

This comment has been minimized.

Show comment
Hide comment
@glicht

glicht Apr 11, 2012

Contributor

We still didn't add offsets for 5.5.22 into our code. The best option is to extract the offsets and then configure the audit plugin to use the extracted offsets.

Download the offset-extract.sh script from: https://github.com/mcafee/mysql-audit/blob/master/offset-extract/offset-extract.sh

Change the permission of the file to executable:

chmod +x offset-extract.sh

Then run the following:

./offset-extract.sh <path to mysqld>

From the output you will need to use the number offsets later on.

Sample output:

~# ./offset-extract.sh /usr/sbin/mysqld
//offsets for: /usr/sbin/mysqld (5.1.41-community)
{"5.1.41-community","6ccf4357688d8e46bfcb4443966970b0", 6200, 6264, 3672, 3944, 88, 2048},

Then add to the mysqld configuration file (usually /etc/my.cnf) the following under the [mysqld] section:

audit_offsets=<offsets extracted above>

The offset section for example should look like this:

audit_offsets=6200, 6264, 3672, 3944, 88, 2048

Then try installing the AUDIT plugin.

Please update if things worked out.

Contributor

glicht commented Apr 11, 2012

We still didn't add offsets for 5.5.22 into our code. The best option is to extract the offsets and then configure the audit plugin to use the extracted offsets.

Download the offset-extract.sh script from: https://github.com/mcafee/mysql-audit/blob/master/offset-extract/offset-extract.sh

Change the permission of the file to executable:

chmod +x offset-extract.sh

Then run the following:

./offset-extract.sh <path to mysqld>

From the output you will need to use the number offsets later on.

Sample output:

~# ./offset-extract.sh /usr/sbin/mysqld
//offsets for: /usr/sbin/mysqld (5.1.41-community)
{"5.1.41-community","6ccf4357688d8e46bfcb4443966970b0", 6200, 6264, 3672, 3944, 88, 2048},

Then add to the mysqld configuration file (usually /etc/my.cnf) the following under the [mysqld] section:

audit_offsets=<offsets extracted above>

The offset section for example should look like this:

audit_offsets=6200, 6264, 3672, 3944, 88, 2048

Then try installing the AUDIT plugin.

Please update if things worked out.

@kvendi

This comment has been minimized.

Show comment
Hide comment
@kvendi

kvendi Apr 11, 2012

offset-extract.sh /usr/sbin/mysqld
GDB failed!!!

cat ./offsets.gdb
set logging on
printf "{"5.5.22-1","f1cd2158515d760d769ec89fcb16bff5", %d, %d, %d, %d, %d, %d}", ((size_t)&((THD )log_slow_statement)->query_id) - (size_t)log_slow_statement, ((size_t)&((THD *)log_slow_statement)->thread_id) - (size_t)log_slow_statement, ((size_t)&((THD *)log_slow_statement)->main_security_ctx) - (size_t)log_slow_statement, ((size_t)&((THD *)log_slow_statement)->command) - (size_t)log_slow_statement, ((size_t)&((THD *)log_slow_statement)->lex) - (size_t)log_slow_statement, (size_t)&((LEX)log_slow_statement)->comment - (size_t) log_slow_statement

kvendi commented Apr 11, 2012

offset-extract.sh /usr/sbin/mysqld
GDB failed!!!

cat ./offsets.gdb
set logging on
printf "{"5.5.22-1","f1cd2158515d760d769ec89fcb16bff5", %d, %d, %d, %d, %d, %d}", ((size_t)&((THD )log_slow_statement)->query_id) - (size_t)log_slow_statement, ((size_t)&((THD *)log_slow_statement)->thread_id) - (size_t)log_slow_statement, ((size_t)&((THD *)log_slow_statement)->main_security_ctx) - (size_t)log_slow_statement, ((size_t)&((THD *)log_slow_statement)->command) - (size_t)log_slow_statement, ((size_t)&((THD *)log_slow_statement)->lex) - (size_t)log_slow_statement, (size_t)&((LEX)log_slow_statement)->comment - (size_t) log_slow_statement

@kvendi

This comment has been minimized.

Show comment
Hide comment
@kvendi

kvendi Apr 11, 2012

I'm sorry. I forgot to install gdb
root@mysql-slave:/home/pdobryakov/mysql-audit/offset-extract# ./offset-extract.sh /usr/sbin/mysqld
//offsets for: /usr/sbin/mysqld (5.5.22-1)
/home/pdobryakov/mysql-audit/offset-extract/offsets.gdb:2: Error in sourced command file:
No symbol table is loaded. Use the "file" command.,
Apparently this is due to required mysqld symbols. That I do not understand, do not tell me what kind of package is meant?

kvendi commented Apr 11, 2012

I'm sorry. I forgot to install gdb
root@mysql-slave:/home/pdobryakov/mysql-audit/offset-extract# ./offset-extract.sh /usr/sbin/mysqld
//offsets for: /usr/sbin/mysqld (5.5.22-1)
/home/pdobryakov/mysql-audit/offset-extract/offsets.gdb:2: Error in sourced command file:
No symbol table is loaded. Use the "file" command.,
Apparently this is due to required mysqld symbols. That I do not understand, do not tell me what kind of package is meant?

@glicht

This comment has been minimized.

Show comment
Hide comment
@glicht

glicht Apr 11, 2012

Contributor

You are correct. The mysqld symbols are missing. It could be that this is part of another package or that this specific distribution doesn't have them.

Send a link to the exact mysql distribution you are using and we'll check what can be done.

Guy

------Original Message------
From: Pavel
To: Guy Lichtman
Subject: Re: [mysql-audit] error install plugin via plugin-load (#2)
Sent: Apr 11, 2012 5:01 PM

I'm sorry. I forgot to install gdb
root@mysql-slave:/home/pdobryakov/mysql-audit/offset-extract# ./offset-extract.sh /usr/sbin/mysqld
//offsets for: /usr/sbin/mysqld (5.5.22-1)
/home/pdobryakov/mysql-audit/offset-extract/offsets.gdb:2: Error in sourced command file:
No symbol table is loaded.  Use the "file" command.,
Apparently this is due to required mysqld symbols. That I do not understand, do not tell me what kind of package is meant?


Reply to this email directly or view it on GitHub:
#2 (comment)


Sent from my mobile deviceSent from my mobile device

Contributor

glicht commented Apr 11, 2012

You are correct. The mysqld symbols are missing. It could be that this is part of another package or that this specific distribution doesn't have them.

Send a link to the exact mysql distribution you are using and we'll check what can be done.

Guy

------Original Message------
From: Pavel
To: Guy Lichtman
Subject: Re: [mysql-audit] error install plugin via plugin-load (#2)
Sent: Apr 11, 2012 5:01 PM

I'm sorry. I forgot to install gdb
root@mysql-slave:/home/pdobryakov/mysql-audit/offset-extract# ./offset-extract.sh /usr/sbin/mysqld
//offsets for: /usr/sbin/mysqld (5.5.22-1)
/home/pdobryakov/mysql-audit/offset-extract/offsets.gdb:2: Error in sourced command file:
No symbol table is loaded.  Use the "file" command.,
Apparently this is due to required mysqld symbols. That I do not understand, do not tell me what kind of package is meant?


Reply to this email directly or view it on GitHub:
#2 (comment)


Sent from my mobile deviceSent from my mobile device

@glicht

This comment has been minimized.

Show comment
Hide comment
@glicht

glicht Apr 16, 2012

Contributor

From what I've seen the dotdeb distribution doesn't include debug symbols and they don't have a separate file with the symbols (as is done with other distributions). The only option is to download the source code and compile it to get the symbols. Once compiled from source code you can run the offset-extract.sh script on the compiled mysqld binary.

I did a short local test and the offsets I've got for the dotdeb 5.5.22 distribution are:

6024, 6072, 3776, 4200, 88, 2560

So you should add to the mysqld configuration file (usually /etc/my.cnf or /etc/mysql/my.cnf) the following under the [mysqld] section:

audit_offsets=6024, 6072, 3776, 4200, 88, 2560

Then try installing the AUDIT plugin.

Please update if things worked out.

Contributor

glicht commented Apr 16, 2012

From what I've seen the dotdeb distribution doesn't include debug symbols and they don't have a separate file with the symbols (as is done with other distributions). The only option is to download the source code and compile it to get the symbols. Once compiled from source code you can run the offset-extract.sh script on the compiled mysqld binary.

I did a short local test and the offsets I've got for the dotdeb 5.5.22 distribution are:

6024, 6072, 3776, 4200, 88, 2560

So you should add to the mysqld configuration file (usually /etc/my.cnf or /etc/mysql/my.cnf) the following under the [mysqld] section:

audit_offsets=6024, 6072, 3776, 4200, 88, 2560

Then try installing the AUDIT plugin.

Please update if things worked out.

@kvendi

This comment has been minimized.

Show comment
Hide comment
@kvendi

kvendi Apr 17, 2012

thank you, it works for me

kvendi commented Apr 17, 2012

thank you, it works for me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment