Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-7967

segfault after (re-)moving audit log file

    Details

      Description

      if an external program will move or remove the audit log, a segmentation fault will occur. this error will not happen, if the audit log file exist while mysql is started. if flush logs is executed after file has been moved but before stop+start of audit is triggered (via setting the file path or setting audit=OFF and audit=ON, see logrotate config), the probability of getting a segfault will be reduced.

      problem will occur with audit plugin (file rotation disabled) + mysql 5.6 + ubuntu 14.04 on git commit cc84ac3be41d9d6ac480d55449d5bf4e324cca10

      gdb output: http://pastebin.com/ccs2Fug7
      logrotate script: http://pastebin.com/CnLANyEm
      mysql error log: http://pastebin.com/P51NsFxs

      my naive solution would be to call stop_logging/start_logging on rotate() if file rotations are set to 0. this will trigger the needed reopen of the logfile

        Gliffy Diagrams

          Attachments

            Activity

            Hide
            elenst Elena Stepanova added a comment -

            Hi,

            Are you really also getting the crash on MariaDB 5.5, 10.0, 10.1.1 as the 'Affects Version/s' field states?
            And which exact version of MySQL 5.6 are you using?

            I can reproduce it on MySQL 5.6.23, but so far only there. Couldn't reproduce on MariaDB, or on MySQL 5.5, or on MySQL 5.6.24.
            It's possible though it's just the matter of "luck"...

            Show
            elenst Elena Stepanova added a comment - Hi, Are you really also getting the crash on MariaDB 5.5, 10.0, 10.1.1 as the 'Affects Version/s' field states? And which exact version of MySQL 5.6 are you using? I can reproduce it on MySQL 5.6.23, but so far only there. Couldn't reproduce on MariaDB, or on MySQL 5.5, or on MySQL 5.6.24. It's possible though it's just the matter of "luck"...
            Hide
            h0nIg Hans-Joachim Kliemeck added a comment -

            i added the versions because there is no mysql/audit version available and i'm using the current trunk version of audit plugin. i'm using ubuntu 14.04 LTS and my mysql version is 5.6.19. could you find the reason for 5.6.23?

            removed affected versions

            Show
            h0nIg Hans-Joachim Kliemeck added a comment - i added the versions because there is no mysql/audit version available and i'm using the current trunk version of audit plugin. i'm using ubuntu 14.04 LTS and my mysql version is 5.6.19. could you find the reason for 5.6.23? removed affected versions
            Hide
            elenst Elena Stepanova added a comment -

            Apparently, it was this commit on MySQL 5.6 after which the problem disappeared:

            commit 38dcb9fb00d5cb1a398977edc56fa0f454037498
            Author: Kristofer Pettersson <kristofer.pettersson@oracle.com>
            Date:   Tue Mar 17 13:59:31 2015 +0100
            
                Bug #20536590: BACKPORT BUG #12368204 AND BUG #16953758 TO MYSQL-5.6
                
                Backported the fixes.
                Partially backported the fix for bug #19463877 too :
                the part about different audit events count for the different
                protocols.
                Changed the strategy of the original fix to account for the lack
                of the changes done in WL#6613 as follows:
                Instead of mixing the calls to the audit log API by calling them
                both outside of the general log hooks and inside some
                moved all audit log API calls inside the general log hooks but
                before any checks to the general log options. Made sure that the
                general log hooks are called regardless of the value of the
                general log option and moved all checking of it inside the
                hooks.
                Changed the binary log calles used by the prepared statement
                code to use the convenience hooks instead of directly calling the
                LOGGER functions. Ensured that prepared statements pass down the
                query text.
                Getting it from the THD is not correct for prepared statements.
                ** Added an extra test file that tests firewall with general log off.
            
            

            Still, Alexey Botchkov, could you please double-check that there is nothing to do/fix on the audit plugin side?

            Show
            elenst Elena Stepanova added a comment - Apparently, it was this commit on MySQL 5.6 after which the problem disappeared: commit 38dcb9fb00d5cb1a398977edc56fa0f454037498 Author: Kristofer Pettersson <kristofer.pettersson@oracle.com> Date: Tue Mar 17 13:59:31 2015 +0100 Bug #20536590: BACKPORT BUG #12368204 AND BUG #16953758 TO MYSQL-5.6 Backported the fixes. Partially backported the fix for bug #19463877 too : the part about different audit events count for the different protocols. Changed the strategy of the original fix to account for the lack of the changes done in WL#6613 as follows: Instead of mixing the calls to the audit log API by calling them both outside of the general log hooks and inside some moved all audit log API calls inside the general log hooks but before any checks to the general log options. Made sure that the general log hooks are called regardless of the value of the general log option and moved all checking of it inside the hooks. Changed the binary log calles used by the prepared statement code to use the convenience hooks instead of directly calling the LOGGER functions. Ensured that prepared statements pass down the query text. Getting it from the THD is not correct for prepared statements. ** Added an extra test file that tests firewall with general log off. Still, Alexey Botchkov , could you please double-check that there is nothing to do/fix on the audit plugin side?
            Hide
            h0nIg Hans-Joachim Kliemeck added a comment -

            i can confirm that this commit will fix the issue. i created a backport patch for current mysql-server-5.6 version on trusty: https://bugs.launchpad.net/ubuntu/+source/mysql-5.6/+bug/1444904

            Show
            h0nIg Hans-Joachim Kliemeck added a comment - i can confirm that this commit will fix the issue. i created a backport patch for current mysql-server-5.6 version on trusty: https://bugs.launchpad.net/ubuntu/+source/mysql-5.6/+bug/1444904
            Hide
            h0nIg Hans-Joachim Kliemeck added a comment -

            i was able to fix this problem for mysql on plugin level too. could you please take a look at the attached patch?

            Show
            h0nIg Hans-Joachim Kliemeck added a comment - i was able to fix this problem for mysql on plugin level too. could you please take a look at the attached patch?
            Hide
            h0nIg Hans-Joachim Kliemeck added a comment -
            Show
            h0nIg Hans-Joachim Kliemeck added a comment - created pull request https://github.com/MariaDB/server/pull/46
            Hide
            h0nIg Hans-Joachim Kliemeck added a comment -

            any progress on this issue?

            Show
            h0nIg Hans-Joachim Kliemeck added a comment - any progress on this issue?

              People

              • Assignee:
                holyfoot Alexey Botchkov
                Reporter:
                h0nIg Hans-Joachim Kliemeck
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated: