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

main.failed_auth_unixsocket fails on arm

Details

    Description

      While importing MariaDB 10.5 to Debian, I noticed that the test main.failed_auth_unixsocket fails on arch armhf and 386 (but arm64 or amd64) when the Debian autopkgtests run.

      The test failure:

      main.failed_auth_unixsocket              w4 [ fail ]
              Test ended at 2020-10-09 20:55:21
       
      CURRENT_TEST: main.failed_auth_unixsocket
      mysqltest: At line 18: query 'connect  fail,localhost,$USER' failed with wrong errno 1045: 'Access denied for user 'debci'@'localhost' (using password: NO)', instead of 1698...
       
      The result from queries just before the failure was:
      update mysql.global_priv set priv=json_insert(priv, '$.plugin', 'unix_socket')  where user='root';
      flush privileges;
      connect(localhost,USER,,test,MASTER_PORT,MASTER_SOCKET);
      

      Full logs:

      This did not occur with previous MariaDB 10.3 in Debian.

      What are Debian autopkgtests?

      See https://wiki.debian.org/ContinuousIntegration/autopkgtest

      Debian has this massive CI system where each upload of a package triggers CI testing of other packages that depend on it: https://ci.debian.net/status/

      The tests mariadb-10.5 runs are in the path debian/tests.

      In MariaDB 10.5 we run mtr from the debian/tests/upstream test to re-use the existing test suite. Why this seems to end differently on debci from when run in post-build armhf and i386 builds is unknown.

      On Debian buildd post-build mtr passes on main.failed_auth_unixsocket fine, e.g.

      Debci regressions are also automatically listed on the package tracker page and prevents unstable->testing migration:

      https://tracker.debian.org/pkg/mariadb-10.5

      Potential solutions

      Maybe the error code 1045 is just fine and test can be extended to accept it?

      Or we can in Debian skip this one test in the autopkgtests to ignore it.

      Previous work

      The test ./mysql-test/main/failed_auth_unixsocket.* has been touched in the past by sanja and serg

      Attachments

        1. image-2020-10-10-22-09-38-762.png
          51 kB
          Otto Kekäläinen
        2. strace.log
          398 kB
          Daniel Black

        Activity

          I will now try https://salsa.debian.org/mariadb-team/mariadb-10.5/-/commit/f452db78a6b0df2f8003b2d75e7d8b2a48a34a2a

          --- a/sql/sql_acl.h
          +++ b/sql/sql_acl.h
          @@ -66,7 +66,7 @@ static inline int access_denied_error_co
             return 0;
           #else
             return passwd_used == 2 ? ER_ACCESS_DENIED_NO_PASSWORD_ERROR
          -                          : ER_ACCESS_DENIED_ERROR;
          +                          : ER_ACCESS_DENIED_NO_PASSWORD_ERROR;
           #endif
           }
           
          --- a/sql/table.cc
          +++ b/sql/table.cc
          @@ -6376,7 +6376,7 @@ bool TABLE_LIST::prepare_view_security_c
                                thd->security_ctx->priv_user,
                                thd->security_ctx->priv_host);
                     else
          -            my_error(ER_ACCESS_DENIED_ERROR, MYF(0),
          +            my_error(ER_ACCESS_DENIED_NO_PASSWORD_ERROR, MYF(0),
                                thd->security_ctx->priv_user,
                                thd->security_ctx->priv_host,
                                (thd->password ?  ER_THD(thd, ER_YES) :
          

          otto Otto Kekäläinen added a comment - I will now try https://salsa.debian.org/mariadb-team/mariadb-10.5/-/commit/f452db78a6b0df2f8003b2d75e7d8b2a48a34a2a --- a/sql/sql_acl.h +++ b/sql/sql_acl.h @@ -66,7 +66,7 @@ static inline int access_denied_error_co return 0; #else return passwd_used == 2 ? ER_ACCESS_DENIED_NO_PASSWORD_ERROR - : ER_ACCESS_DENIED_ERROR; + : ER_ACCESS_DENIED_NO_PASSWORD_ERROR; #endif } --- a/sql/table.cc +++ b/sql/table.cc @@ -6376,7 +6376,7 @@ bool TABLE_LIST::prepare_view_security_c thd->security_ctx->priv_user, thd->security_ctx->priv_host); else - my_error(ER_ACCESS_DENIED_ERROR, MYF(0), + my_error(ER_ACCESS_DENIED_NO_PASSWORD_ERROR, MYF(0), thd->security_ctx->priv_user, thd->security_ctx->priv_host, (thd->password ? ER_THD(thd, ER_YES) :

          Nope, the approach above does will not work. Next, looking at wrapper:

          /**
            a helper function to report an access denied error in most proper places
          */
          static void login_failed_error(THD *thd)
          {
            my_error(access_denied_error_code(thd->password), MYF(0),
                     thd->main_security_ctx.user,
                     thd->main_security_ctx.host_or_ip,
                     thd->password ? ER_THD(thd, ER_YES) : ER_THD(thd, ER_NO));
            general_log_print(thd, COM_CONNECT,
                              ER_THD(thd, access_denied_error_code(thd->password)),
                              thd->main_security_ctx.user,
                              thd->main_security_ctx.host_or_ip,
                              thd->password ? ER_THD(thd, ER_YES) : ER_THD(thd, ER_NO));
            status_var_increment(thd->status_var.access_denied_errors);
            /*
              Log access denied messages to the error log when log-warnings = 2
              so that the overhead of the general query log is not required to track
              failed connections.
            */
            if (global_system_variables.log_warnings > 1)
            {
              sql_print_warning(ER_THD(thd, access_denied_error_code(thd->password)),
                                thd->main_security_ctx.user,
                                thd->main_security_ctx.host_or_ip,
                                thd->password ? ER_THD(thd, ER_YES) : ER_THD(thd, ER_NO));
            }
          }
          

          Could the code above have something that behaves differently in armhf/i386 on debci vs amd64 on debci?

          Or maybe this? At least the comment field looks fishy:

          if (!mpvio->acl_user)
            {
              /*
                A matching user was not found. Fake it. Take any user, make the
                authentication fail later.
                This way we get a realistically looking failure, with occasional
                "change auth plugin" requests even for nonexistent users. The ratio
                of "change auth plugin" request will be the same for real and
                nonexistent users.
                Note, that we cannot pick any user at random, it must always be
                the same user account for the incoming sctx->user name.
              */
              ulong nr1=1, nr2=4;
              CHARSET_INFO *cs= &my_charset_latin1;
              cs->hash_sort((uchar*) sctx->user, strlen(sctx->user), &nr1, &nr2);
           
              mysql_mutex_lock(&acl_cache->lock);
              if (!acl_users.elements)
              {
                mysql_mutex_unlock(&acl_cache->lock);
                login_failed_error(mpvio->auth_info.thd);
                DBUG_RETURN(1);
              }
          

          otto Otto Kekäläinen added a comment - Nope, the approach above does will not work. Next, looking at wrapper: /** a helper function to report an access denied error in most proper places */ static void login_failed_error(THD *thd) { my_error(access_denied_error_code(thd->password), MYF(0), thd->main_security_ctx.user, thd->main_security_ctx.host_or_ip, thd->password ? ER_THD(thd, ER_YES) : ER_THD(thd, ER_NO)); general_log_print(thd, COM_CONNECT, ER_THD(thd, access_denied_error_code(thd->password)), thd->main_security_ctx.user, thd->main_security_ctx.host_or_ip, thd->password ? ER_THD(thd, ER_YES) : ER_THD(thd, ER_NO)); status_var_increment(thd->status_var.access_denied_errors); /* Log access denied messages to the error log when log-warnings = 2 so that the overhead of the general query log is not required to track failed connections. */ if (global_system_variables.log_warnings > 1) { sql_print_warning(ER_THD(thd, access_denied_error_code(thd->password)), thd->main_security_ctx.user, thd->main_security_ctx.host_or_ip, thd->password ? ER_THD(thd, ER_YES) : ER_THD(thd, ER_NO)); } } Could the code above have something that behaves differently in armhf/i386 on debci vs amd64 on debci? Or maybe this? At least the comment field looks fishy: if (!mpvio->acl_user) { /* A matching user was not found. Fake it. Take any user, make the authentication fail later. This way we get a realistically looking failure, with occasional "change auth plugin" requests even for nonexistent users. The ratio of "change auth plugin" request will be the same for real and nonexistent users. Note, that we cannot pick any user at random, it must always be the same user account for the incoming sctx->user name. */ ulong nr1=1, nr2=4; CHARSET_INFO *cs= &my_charset_latin1; cs->hash_sort((uchar*) sctx->user, strlen(sctx->user), &nr1, &nr2);   mysql_mutex_lock(&acl_cache->lock); if (!acl_users.elements) { mysql_mutex_unlock(&acl_cache->lock); login_failed_error(mpvio->auth_info.thd); DBUG_RETURN(1); }

          This has not been assigned to anybody, and unlikely to be fixed in a reasonable amount of time, so I'll try to hack around the issue by selectively disabling this test in https://salsa.debian.org/mariadb-team/mariadb-10.5/-/commit/74601f8b31a6c59e825089c52a1ca21545062813

          otto Otto Kekäläinen added a comment - This has not been assigned to anybody, and unlikely to be fixed in a reasonable amount of time, so I'll try to hack around the issue by selectively disabling this test in https://salsa.debian.org/mariadb-team/mariadb-10.5/-/commit/74601f8b31a6c59e825089c52a1ca21545062813
          danblack Daniel Black added a comment -

          strace form nikitamalyavin (Arch)

          The strace shows it doesn't lookup the unix socket user using a syscall before issuing the denial. Odd.
          SO_PEERCRED (getsockopt)
          FYI eworm

          danblack Daniel Black added a comment - strace form nikitamalyavin (Arch) The strace shows it doesn't lookup the unix socket user using a syscall before issuing the denial. Odd. SO_PEERCRED (getsockopt) FYI eworm

          This is still unsolved and unassigned. Maybe julien.fritsch wants to decide if it needs to be fixed or not?

          otto Otto Kekäläinen added a comment - This is still unsolved and unassigned. Maybe julien.fritsch wants to decide if it needs to be fixed or not?

          People

            serg Sergei Golubchik
            otto Otto Kekäläinen
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Git Integration

                Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.