Merge 10.5 into 10.6

This commit is contained in:
Marko Mäkelä 2024-12-11 14:46:43 +02:00
commit 69e20cab28
24 changed files with 55 additions and 69 deletions

View file

@ -653,7 +653,6 @@ error:
pthread_cond_signal(&count_threshhold);
pthread_mutex_unlock(&counter_mutex);
mysql_thread_end();
pthread_exit(0);
return 0;
}

View file

@ -990,7 +990,6 @@ end_thread:
cn->mysql= 0;
cn->query_done= 1;
mysql_thread_end();
pthread_exit(0);
DBUG_RETURN(0);
}

View file

@ -255,9 +255,9 @@ extern void (*my_sigtstp_cleanup)(void),
/* Executed before jump to shell */
(*my_sigtstp_restart)(void);
/* Executed when coming from shell */
extern MYSQL_PLUGIN_IMPORT int my_umask; /* Default creation mask */
extern int my_umask_dir,
my_recived_signals, /* Signals we have got */
extern MYSQL_PLUGIN_IMPORT mode_t my_umask; /* Default creation mask */
extern mode_t my_umask_dir;
extern int my_recived_signals, /* Signals we have got */
my_safe_to_handle_signal, /* Set when allowed to SIGTSTP */
my_dont_interrupt; /* call remember_intr when set */
#ifdef _WIN32
@ -622,7 +622,7 @@ extern File my_open(const char *FileName,int Flags,myf MyFlags);
extern File my_register_filename(File fd, const char *FileName,
enum file_type type_of_file,
uint error_message_number, myf MyFlags);
extern File my_create(const char *FileName,int CreateFlags,
extern File my_create(const char *FileName, mode_t CreateFlags,
int AccessFlags, myf MyFlags);
extern int my_close(File Filedes,myf MyFlags);
extern int my_mkdir(const char *dir, int Flags, myf MyFlags);
@ -630,7 +630,7 @@ extern int my_readlink(char *to, const char *filename, myf MyFlags);
extern int my_is_symlink(const char *filename);
extern int my_realpath(char *to, const char *filename, myf MyFlags);
extern File my_create_with_symlink(const char *linkname, const char *filename,
int createflags, int access_flags,
mode_t createflags, int access_flags,
myf MyFlags);
extern int my_rename_with_symlink(const char *from,const char *to,myf MyFlags);
extern int my_symlink(const char *content, const char *linkname, myf MyFlags);

View file

@ -30,4 +30,13 @@ DROP USER u2;
set global server_audit_logging=off;
UNINSTALL PLUGIN ed25519;
UNINSTALL PLUGIN server_audit;
#
# MDEV-35604: SIGSEGV in filter_query_type | log_statement_ex / auditing
#
INSTALL PLUGIN server_audit SONAME 'server_audit';
SET GLOBAL server_audit_logging=ON;
SET STATEMENT max_error_count=1 SELECT 1;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'SELECT 1' at line 1
SET GLOBAL server_audit_logging=OFF;
UNINSTALL SONAME 'server_audit';
# end of 10.5 tests

View file

@ -56,4 +56,20 @@ UNINSTALL PLUGIN ed25519;
UNINSTALL PLUGIN server_audit;
--enable_warnings
--echo #
--echo # MDEV-35604: SIGSEGV in filter_query_type | log_statement_ex / auditing
--echo #
INSTALL PLUGIN server_audit SONAME 'server_audit';
SET GLOBAL server_audit_logging=ON;
--ERROR ER_PARSE_ERROR
SET STATEMENT max_error_count=1 SELECT 1;
# Cleanup
SET GLOBAL server_audit_logging=OFF;
--disable_warnings
UNINSTALL SONAME 'server_audit';
--enable_warnings
--echo # end of 10.5 tests

View file

@ -33,12 +33,12 @@
*/
File my_create(const char *FileName, int CreateFlags, int access_flags,
File my_create(const char *FileName, mode_t CreateFlags, int access_flags,
myf MyFlags)
{
int fd;
DBUG_ENTER("my_create");
DBUG_PRINT("my",("Name: '%s' CreateFlags: %d AccessFlags: %d MyFlags: %lu",
DBUG_PRINT("my",("Name: '%s' CreateFlags: %u AccessFlags: %d MyFlags: %lu",
FileName, CreateFlags, access_flags, MyFlags));
#if defined(_WIN32)
fd= my_win_open(FileName, access_flags | O_CREAT);

View file

@ -45,7 +45,7 @@ uint mysys_usage_id= 0; /* Incremented for each my_init() */
ulonglong my_thread_stack_size= (sizeof(void*) <= 4)? 65536: ((256-16)*1024);
static ulong atoi_octal(const char *str)
static mode_t atoi_octal(const char *str)
{
long int tmp;
while (*str && my_isspace(&my_charset_latin1, *str))
@ -53,7 +53,7 @@ static ulong atoi_octal(const char *str)
str2int(str,
(*str == '0' ? 8 : 10), /* Octalt or decimalt */
0, INT_MAX, &tmp);
return (ulong) tmp;
return (mode_t) tmp;
}
MYSQL_FILE *mysql_stdin= NULL;
@ -82,10 +82,10 @@ my_bool my_init(void)
/* Default creation of new files */
if ((str= getenv("UMASK")) != 0)
my_umask= (int) (atoi_octal(str) | 0600);
my_umask= atoi_octal(str) | 0600;
/* Default creation of new dir's */
if ((str= getenv("UMASK_DIR")) != 0)
my_umask_dir= (int) (atoi_octal(str) | 0700);
my_umask_dir= atoi_octal(str) | 0700;
init_glob_errs();

View file

@ -20,7 +20,7 @@
#include "my_atomic.h"
CREATE_NOSYMLINK_FUNCTION(
open_nosymlinks(const char *pathname, int flags, int mode),
open_nosymlinks(const char *pathname, int flags, mode_t mode),
openat(dfd, filename, O_NOFOLLOW | flags, mode),
open(pathname, O_NOFOLLOW | flags, mode)
);

View file

@ -64,7 +64,7 @@ char curr_dir[FN_REFLEN]= {0},
home_dir_buff[FN_REFLEN]= {0};
ulong my_stream_opened=0,my_tmp_file_created=0;
ulong my_file_total_opened= 0;
int my_umask=0664, my_umask_dir=0777;
mode_t my_umask=0664, my_umask_dir=0777;
#ifdef _WIN32
SECURITY_ATTRIBUTES my_dir_security_attributes= {sizeof(SECURITY_ATTRIBUTES),NULL,FALSE};
#endif

View file

@ -26,7 +26,7 @@
#include <m_string.h>
File my_create_with_symlink(const char *linkname, const char *filename,
int createflags, int access_flags, myf MyFlags)
mode_t createflags, int access_flags, myf MyFlags)
{
File file;
int tmp_errno;

View file

@ -566,8 +566,7 @@ static void *alarm_handler(void *arg __attribute__((unused)))
alarm_thread_running= 0;
mysql_cond_signal(&COND_alarm);
mysql_mutex_unlock(&LOCK_alarm);
pthread_exit(0);
return 0; /* Impossible */
return 0;
}
#endif /* USE_ALARM_THREAD */
#endif

View file

@ -330,8 +330,7 @@ static void *timer_handler(void *arg __attribute__((unused)))
}
mysql_mutex_unlock(&LOCK_timer);
my_thread_end();
pthread_exit(0);
return 0; /* Impossible */
return 0;
}

View file

@ -290,7 +290,6 @@ pthread_handler_t background_thread(void *arg __attribute__((unused)))
}
my_thread_end();
pthread_exit(0);
return 0;
}

View file

@ -1782,6 +1782,8 @@ static int filter_query_type(const char *query, struct sa_keyword *kwd)
char fword[MAX_KEYWORD + 1], nword[MAX_KEYWORD + 1];
int len, nlen= 0;
const struct sa_keyword *l_keywords;
if (!query)
return SQLCOM_NOTHING;
while (*query && (is_space(*query) || *query == '(' || *query == '/'))
{

View file

@ -3103,7 +3103,6 @@ pthread_handler_t signal_hand(void *)
sigset_t set;
int sig;
my_thread_init(); // Init new thread
DBUG_ENTER("signal_hand");
signal_thread_in_use= 1;
/*
@ -3169,7 +3168,6 @@ pthread_handler_t signal_hand(void *)
/* switch to the old log message processing */
logger.set_handlers(global_system_variables.sql_log_slow ? LOG_FILE:LOG_NONE,
opt_log ? LOG_FILE:LOG_NONE);
DBUG_PRINT("info",("Got signal: %d abort_loop: %d",sig,abort_loop));
break_connect_loop();
DBUG_ASSERT(abort_loop);
@ -3205,12 +3203,9 @@ pthread_handler_t signal_hand(void *)
break; /* purecov: tested */
}
}
DBUG_PRINT("quit", ("signal_handler: calling my_thread_end()"));
my_thread_end();
DBUG_LEAVE; // Must match DBUG_ENTER()
signal_thread_in_use= 0;
pthread_exit(0); // Safety
return(0); /* purecov: deadcode */
return nullptr;
}
static void check_data_home(const char *path)

View file

@ -4266,8 +4266,6 @@ static int innodb_init(void* p)
test_filename));
#endif /* DBUG_OFF */
os_file_set_umask(my_umask);
/* Setup the memory alloc/free tracing mechanisms before calling
any functions that could possibly allocate memory. */
ut_new_boot();

View file

@ -1070,11 +1070,6 @@ os_file_get_status(
bool check_rw_perm,
bool read_only);
/** Set the file create umask
@param[in] umask The umask to use for file creation. */
void
os_file_set_umask(ulint umask);
#ifdef _WIN32
/**

View file

@ -143,18 +143,6 @@ static io_slots *write_slots;
/** Number of retries for partial I/O's */
constexpr ulint NUM_RETRIES_ON_PARTIAL_IO = 10;
/* This specifies the file permissions InnoDB uses when it creates files in
Unix; the value of os_innodb_umask is initialized in ha_innodb.cc to
my_umask */
#ifndef _WIN32
/** Umask for creating files */
static ulint os_innodb_umask = S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP;
#else
/** Umask for creating files */
static ulint os_innodb_umask = 0;
#endif /* _WIN32 */
Atomic_counter<ulint> os_n_file_reads;
static ulint os_bytes_read_since_printout;
Atomic_counter<size_t> os_n_file_writes;
@ -1030,7 +1018,7 @@ os_file_create_simple_func(
bool retry;
do {
file = open(name, create_flag | O_CLOEXEC, os_innodb_umask);
file = open(name, create_flag | O_CLOEXEC, my_umask);
if (file == -1) {
*success = false;
@ -1198,7 +1186,7 @@ os_file_create_func(
bool retry;
do {
file = open(name, create_flag | O_CLOEXEC, os_innodb_umask);
file = open(name, create_flag | O_CLOEXEC, my_umask);
if (file == -1) {
const char* operation;
@ -1330,7 +1318,7 @@ os_file_create_simple_no_error_handling_func(
return(OS_FILE_CLOSED);
}
file = open(name, create_flag | O_CLOEXEC, os_innodb_umask);
file = open(name, create_flag | O_CLOEXEC, my_umask);
*success = (file != -1);
@ -3773,16 +3761,6 @@ os_aio_refresh_stats()
os_last_printout = time(NULL);
}
/**
Set the file create umask
@param[in] umask The umask to use for file creation. */
void
os_file_set_umask(ulint umask)
{
os_innodb_umask = umask;
}
#ifdef _WIN32
/* Checks whether physical drive is on SSD.*/

View file

@ -271,12 +271,7 @@ error_exit_in_thread(intptr_t code)
CRITICAL_SECTION_ENTER(grntest_cs);
grntest_stop_flag = 1;
CRITICAL_SECTION_LEAVE(grntest_cs);
#ifdef WIN32
_endthreadex(code);
#else
pthread_exit((void *)code);
#endif /* WIN32 */
return 0;
return code;
}

View file

@ -70,7 +70,6 @@ end:
thread_count--;
pthread_cond_signal(&COND_thread_count); /* Tell main we are ready */
pthread_mutex_unlock(&LOCK_thread_count);
pthread_exit(0);
return 0;
}

View file

@ -26,8 +26,10 @@ static void check(const char *res)
str1.length= 0;
}
int main(void)
int main(int argc, char** argv)
{
MY_INIT(argv[0]);
plan(23);
IF_WIN(skip_all("Test of POSIX shell escaping rules, not for CMD.EXE\n"), );
@ -69,6 +71,7 @@ int main(void)
dynstr_free(&str1);
my_end(MY_CHECK_ERROR);
return exit_status();
}

View file

@ -91,7 +91,6 @@ pthread_handler_t thread_stack_check(void *arg __attribute__((unused)))
test_stack_detection(1, STACK_ALLOC_SMALL_BLOCK_SIZE-1);
test_stack_detection(2, STACK_ALLOC_SMALL_BLOCK_SIZE+1);
my_thread_end();
pthread_exit(0);
return 0;
}

View file

@ -108,7 +108,6 @@ void *test_apc_service_thread(void *ptr)
apc_target.destroy();
mysql_mutex_destroy(&target_mutex);
my_thread_end();
pthread_exit(0);
return NULL;
}

View file

@ -51,6 +51,8 @@ public:
int main(int args, char **argv)
{
MY_INIT(argv[0]);
plan(NO_PLAN);
diag("Testing Json_writer checks");
@ -123,6 +125,7 @@ int main(int args, char **argv)
diag("Done");
my_end(MY_CHECK_ERROR);
return exit_status();
}