Added info on offset extraction for Debian distros.

master
Guy Lichtman 2014-01-31 12:08:49 -08:00
parent 5ad88ef041
commit 1e0099a33f
1 changed files with 24 additions and 1 deletions

@ -75,4 +75,27 @@ Then try installing the AUDIT plugin either via plugin-load configuration option
./offset-extract.sh /usr/sbin/mysqld /usr/lib/debug/usr/sbin/mysqld.debug
Notice that the mysqld debug symbols may be named also: `/usr/lib/debug/usr/sbin/mysqld` (no `.debug`). Make sure not to confuse this with `mysqld-debug`, which is a separate executable.
Notice that the mysqld debug symbols may be named also: `/usr/lib/debug/usr/sbin/mysqld` (no `.debug`). Make sure not to confuse this with `mysqld-debug`, which is a separate executable.
**Offsets on Debian distributions:** On Debian (and Ubuntu) distributions debug symbols are not shipped with the mysql server distribution. There is need to compile from source in order to extract the offsets. Example steps for compiling from source with debug symbols:
* Download source code by running: `apt-get source mysql-server`
* Extract source: `dpkg-source -x mysql-<version>.dsc`
* Change into extract dir: `mysql-<version>`
* Modify `debian/rules` file to add "-g" flag to CFLAGS and CXXFLAGS passed to cmake. Example diff of modifications:
```
#diff debian/rules debian/rules.org
93c93
< CFLAGS=$${MYSQL_BUILD_CFLAGS:-"-g -O2 -DBIG_JOINS=1 ${FORCE_FPIC_CFLAGS} -fno-strict-aliasing"} \
---
> CFLAGS=$${MYSQL_BUILD_CFLAGS:-"-O2 -DBIG_JOINS=1 ${FORCE_FPIC_CFLAGS} -fno-strict-aliasing"} \
95c95
< CXXFLAGS=$${MYSQL_BUILD_CXXFLAGS:-"-g -O3 -DBIG_JOINS=1 -felide-constructors -fno-exceptions -fno-rtti ${FORCE_FPIC_CFLAGS} -fno-strict-aliasing"} \
---
> CXXFLAGS=$${MYSQL_BUILD_CXXFLAGS:-"-O3 -DBIG_JOINS=1 -felide-constructors -fno-exceptions -fno-rtti ${FORCE_FPIC_CFLAGS} -fno-strict-aliasing"} \
```
* Build mysql with "nostrip" option: `DEB_BUILD_OPTIONS="nostrip" dpkg-buildpackage -b -uc`
* Resulting mysqld file available at: `builddir/sql/mysqld` now contains debug symbols and you can extract the offsets from this binary.