HI, Sergei!

On Sat, Oct 10, 2020 at 11:16 PM Sergei Golubchik <serg@mariadb.org> wrote:
Hi, Oleksandr!

Mostly ok, one problem below:

On Oct 10, Oleksandr Byelkin wrote:
> revision-id: 2792940391a (mariadb-10.2.31-343-g2792940391a)
> parent(s): 2107e3bb9c0
> author: Oleksandr Byelkin <sanja@mariadb.com>
> committer: Oleksandr Byelkin <sanja@mariadb.com>
> timestamp: 2020-07-29 21:54:24 +0200
> message:
>
> MDEV-23327 Can't uninstall UDF if the implementation library file doesn't exist
>
> Made cleanup of DROP (udf) FUNCTION procedure and also check of mysql.func (not only loaded udf).
>
> @@ -606,43 +648,54 @@ int mysql_create_function(THD *thd,udf_func *udf)
>  }


> -int mysql_drop_function(THD *thd,const LEX_STRING *udf_name)
> +enum drop_udf_result mysql_drop_function(THD *thd, const LEX_STRING *udf_name)
>  {
>    TABLE *table;
> -  TABLE_LIST tables;
>    udf_func *udf;
>    DBUG_ENTER("mysql_drop_function");

> +  if (!(table= open_udf_func_table(thd)))
> +    DBUG_RETURN(UDF_DEL_RESULT_ERROR);
> +
> +  // Pre-check without protection
> +  if (!find_udf_everywhere(thd, udf_name->str, udf_name->length, table))

you cannot check the udf_hash without a lock

I made an attempt of a fast check under read protection (because it looks like old code had pre-check).


> +  {
> +    close_mysql_tables(thd);

Regards,
Sergei
VP of MariaDB Server Engineering
and security@mariadb.org