← Back to team overview

maria-developers team mailing list archive

Re: b29ec61724d: MDEV-25906: SIGSEGV in flush_tables_with_read_lock on FTWRL or FTFE | SIGSEGV in ha_maria::extra

 

Hi, Oleksandr!

On Jul 01, Oleksandr Byelkin wrote:
> revision-id: b29ec61724d (mariadb-10.6.2-41-gb29ec61724d)
> parent(s): 83684fc9a4d
> author: Oleksandr Byelkin <sanja@xxxxxxxxxxx>
> committer: Oleksandr Byelkin <sanja@xxxxxxxxxxx>
> timestamp: 2021-07-01 11:20:29 +0200
> message:
> 
> MDEV-25906: SIGSEGV in flush_tables_with_read_lock on FTWRL or FTFE | SIGSEGV in ha_maria::extra
> 
> Fixed check of derived tables of all kinds (view, derived, information schema).
> 
> diff --git a/sql/sql_reload.cc b/sql/sql_reload.cc
> index 0fa2fa10df8..e41da9680b0 100644
> --- a/sql/sql_reload.cc
> +++ b/sql/sql_reload.cc
> @@ -592,10 +592,19 @@ bool flush_tables_with_read_lock(THD *thd, TABLE_LIST *all_tables)
>      for (TABLE_LIST *table_list= all_tables; table_list;
>           table_list= table_list->next_global)
>      {
> -      if (!(table_list->is_view() ||
> -            table_list->table->file->ha_table_flags() & HA_CAN_EXPORT))
> +      /*
> +        We allow all deriveds and view here, but prohibit information_schema
> +        tables (explicitly) and performance_schema tables (implicetly:
> +        engine do not suport export)
> +      */
> +      if (table_list->is_non_derived() &&
> +          (!table_list->is_base_table() ||
> +           !(table_list->table->file->ha_table_flags() & HA_CAN_EXPORT)))
>        {
> -        my_error(ER_ILLEGAL_HA, MYF(0),table_list->table->file->table_type(),
> +        my_error(ER_ILLEGAL_HA, MYF(0),
> +                 (table_list->is_base_table() ?
> +                  table_list->table->file->table_type():
> +                  "information_schema"),

I'd say if you want to detect I_S tables, you should test for
table_list->schema_table. It's not clear what your condition actually
does.

And there is no such engine "information_schema", so the message is
misleading.

In fact, this should be access denied. For both. Like:

  mysqltest: At line 12: query 'flush table information_schema.collations for export' failed: ER_DBACCESS_DENIED_ERROR (1044): Access denied for user 'foo'@'localhost' to database 'information_schema'

this is from a test file that only does

  flush table information_schema.collations for export.

>                   table_list->db.str, table_list->table_name.str);
>          goto error_reset_bits;
>        }
> @@ -607,7 +616,8 @@ bool flush_tables_with_read_lock(THD *thd, TABLE_LIST *all_tables)
>      for (auto table_list= all_tables; table_list;
>           table_list= table_list->next_global)
>      {
> -      if (!table_list->is_view() &&
> +      if (table_list->table &&

why do you check for table_list->table ?
Can it happen that table_list->table == NULL and
table_list->is_base_table() == true?

> +          table_list->is_base_table() &&
>            table_list->table->file->extra(HA_EXTRA_FLUSH))
>          goto error_reset_bits;
>      }

Regards,
Sergei
VP of MariaDB Server Engineering
and security@xxxxxxxxxxx