summaryrefslogtreecommitdiff
path: root/mysys
Commit message (Collapse)AuthorAgeFilesLines
* Merge 10.5 into 10.6Marko Mäkelä2023-04-115-12/+17
|\
| * Merge branch '10.4' into 10.5Oleksandr Byelkin2023-04-031-3/+4
| |\
| | * Handle meaningless addr2line results and increase timeoutHugo Wen2023-04-011-3/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | MariaDB server prints the stack information if a crash happens. It traverses the stack frames in function `print_with_addr_resolve`. For *EACH* frame, it tries to parse the file name and line number of the frame using `addr2line`, or prints `backtrace_symbols_fd` if `addr2line` fails. 1. Logic in `addr_resolve` function uses addr2line to get the file name and line numbers. It has a timeout of 500ms to wait for the response from addr2line. However, that's not enough on small instances especially if the debug information is in a separate file or compressed. Increase the timeout to 5 seconds to support some edge cases, as experiments showed addr2line may take 2-3 seconds on some frames. 2. While parsing a frame inside of a shared library using `addr2line`, the file name and line numbers could be `??`, empty or `0` if the debug info is not loaded. It's easy to reproduce when glibc-debuginfo is not installed. Instead of printing a meaningless frame like: :0(__GI___poll)[0x1505e9197639] ... ??:0(__libc_start_main)[0x7ffff6c8913a] We want to print the frame information using `backtrace_symbols_fd`, with the shared library name and a hexadecimal offset. Stacktrace example on a real instance with this commit: /lib64/libc.so.6(__poll+0x49)[0x145cbf71a639] ... /lib64/libc.so.6(__libc_start_main+0xea)[0x7f4d0034d13a] `addr_resolve` has considered the case of meaningless combination of file name and line number returned by `addr2line`. e.g. `??:?` However, conditions like `:0` and `??:0` are not handled. So now the function will rollback to `backtrace_symbols_fd` in above cases. All new code of the whole pull request, including one or several files that are either new files or modified ones, are contributed under the BSD-new license. I am contributing on behalf of my employer Amazon Web Services, Inc.
| * | Merge remote-tracking branch '10.4' into 10.5Oleksandr Byelkin2023-03-314-9/+13
| |\ \ | | |/
| | * Minimize unsafe C functions usageChristian Gonzalez2023-03-084-9/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Replace calls to `sprintf` and `strcpy` by the safer options `snprintf` and `safe_strcpy` in the following directories: - libmysqld - mysys - sql-common - strings All new code of the whole pull request, including one or several files that are either new files or modified ones, are contributed under the BSD-new license. I am contributing on behalf of my employer Amazon Web Services, Inc.
* | | Merge 10.5 into 10.6Marko Mäkelä2023-02-282-0/+31
|\ \ \ | |/ /
| * | Added detection of memory overwrite with multi_mallocbb-10.5-montyMonty2023-02-272-0/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch also fixes some bugs detected by valgrind after this patch: - Not enough copy_func elements was allocated by Create_tmp_table() which causes an memory overwrite in Create_tmp_table::add_fields() I added an ASSERT() to be able to detect this also without valgrind. The bug was that TMP_TABLE_PARAM::copy_fields was not correctly set when calling create_tmp_table(). - Aria::empty_bits is not allocated if there is no varchar/char/blob fields in the table. Fixed code to take this into account. This cannot cause any issues as this is just a memory access into other Aria memory and the content of the memory would not be used. - Aria::last_key_buff was not allocated big enough. This may have caused issues with rtrees and ma_extra(HA_EXTRA_REMEMBER_POS) as they would use the same memory area. - Aria and MyISAM didn't take extended key parts into account, which caused problems when copying rec_per_key from engine to sql level. - Mark asan builds with 'asan' in version strihng to detect these in not_valgrind_build.inc. This is needed to not have main.sp-no-valgrind fail with asan.
* | | Merge 10.5 into 10.6Marko Mäkelä2023-02-102-1/+3
|\ \ \ | |/ /
| * | Merge 10.4 into 10.5Marko Mäkelä2023-02-101-0/+2
| |\ \ | | |/
| | * MDEV-30556 UPPER() returns an empty string for U+0251 in Unicode-5.2.0+ ↵Alexander Barkov2023-02-031-0/+2
| | | | | | | | | | | | collations for utf8
| * | MDEV-30572: my_large_malloc will only retry on ENOMEMDaniel Black2023-02-071-1/+1
| | | | | | | | | | | | | | | Correct error in to only say "continuing to smaller size" if it really is.
* | | MDEV-30573 Server doesn't build with GCOV by GCC 11+Daniel Black2023-02-061-4/+4
| | | | | | | | | | | | | | | | | | | | | __gcov_flush was never an external symbol in the documentation. It was removed in gcc-11. The correct function to use is __gcov_dump which is defined in the gcov.h header.
* | | Merge 10.5 into 10.6Marko Mäkelä2023-01-104-3/+7
|\ \ \ | |/ /
| * | Fix synopses in mysys APIsAlexander Kuleshov2023-01-064-3/+7
| | | | | | | | | | | | | | | | | | Since 7c58e97 the PSI_memory_key was added to some routines in the mysys/. This commit fixes synopses of functions that were updated with the PSI_memory_key parameter.
* | | Merge 10.5 into 10.6Marko Mäkelä2022-12-134-102/+175
|\ \ \ | |/ /
| * | Merge 10.4 into 10.5Marko Mäkelä2022-12-134-103/+176
| |\ \ | | |/
| | * Merge 10.3 into 10.4Marko Mäkelä2022-12-134-103/+176
| | |\
| | | * MDEV-30162 Fix occasional "Permission denied" on Windows caused by buggy 3rd ↵Vladislav Vaintroub2022-12-074-103/+176
| | | | | | | | | | | | | | | | | | | | | | | | | | | | party Add retry logic for CreateFile, DeleteFile, or MoveFile when GetLastError() is ERROR_SHARING_VIOLATION.
* | | | Merge 10.5 into 10.6Marko Mäkelä2022-11-141-1/+1
|\ \ \ \ | |/ / /
| * | | OS detection logic in my_gethwaddr.c is backwardsDominik Hassler2022-11-131-1/+1
| | | |
* | | | Merge 10.5 into 10.6Marko Mäkelä2022-11-082-3/+9
|\ \ \ \ | |/ / /
| * | | Merge 10.4 into 10.5Marko Mäkelä2022-11-082-2/+8
| |\ \ \ | | |/ /
| | * | Merge 10.3 into 10.4Marko Mäkelä2022-11-082-2/+8
| | |\ \ | | | |/
| | | * MDEV-29951 server hang in crash handlerVladislav Vaintroub2022-11-051-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When trying to output stacktrace, and addr2line is not installed, the child process forked by start_addr2line_fork() will fail to do exec(), and finish with exit(1). There is a problem with exit() though - it runs exit handlers, and for the forked copy of crashing process, it is a bad idea. In 10.5+ code for example, exit handlers include tpool::task_group static destructors, and it will hang infinitely waiting for completion of the outstanding tasks. The fix is to use _exit() instead, which skips the execution of exit handlers
| | | * Fix building my_gethwaddr() on OpenBSDBrad Smith2022-10-271-1/+7
| | | |
| * | | Fix building my_gethwaddr() on OpenBSD - part for 10.5 and newerBrad Smith2022-10-271-1/+1
| | | |
* | | | Fix AIX compulation (break addr resolution)Daniel Black2022-10-271-1/+9
| | | | | | | | | | | | | | | | | | | | | | | | Revert c92c1615852ecd4be2d04203600efd3eba578a02, casting to void* cannot fool gcc. The AIX address resolution was broken anyway, so just avoid the problem and make it compile well.
* | | | Merge 10.5 into 10.6Marko Mäkelä2022-10-252-2/+0
|\ \ \ \ | |/ / / | | | | | | | | | | | | | | | | To prevent ASAN heap-use-after-poison in the MDEV-16549 part of ./mtr --repeat=6 main.derived the initialization of Name_resolution_context was cleaned up.
| * | | Merge 10.4 into 10.5Marko Mäkelä2022-10-252-2/+0
| |\ \ \ | | |/ /
| | * | Merge 10.3 into 10.4Marko Mäkelä2022-10-253-3/+0
| | |\ \ | | | |/
| | | * MDEV-15795 Stack exceeded if pthread_attr_setstacksize(&thr_attr,8196) succeedsSergei Golubchik2022-10-223-3/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | on Linux this pthread_attr_setstacksize() fails with EINVAL "The stack size is less than PTHREAD_STACK_MIN (16384) bytes". But on FreeBSD it succeeds and causes a crash later, as 8196 is too little. Let's keep the stack at its default size in the timer thread.
* | | | Fixed compiler warning on AIXMonty2022-10-191-1/+1
| | | |
* | | | Merge 10.5 into 10.6Marko Mäkelä2022-09-261-3/+3
|\ \ \ \ | |/ / /
| * | | Merge 10.4 into 10.5Marko Mäkelä2022-09-261-3/+3
| |\ \ \ | | |/ /
| | * | MDEV-29613 Improve WITH_DBUG_TRACE=OFFMarko Mäkelä2022-09-231-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In commit 28325b08633372cc343dfcbc41fe252020cf6e6e a compile-time option was introduced to disable the macros DBUG_ENTER and DBUG_RETURN or DBUG_VOID_RETURN. The parameter name WITH_DBUG_TRACE would hint that it also covers DBUG_PRINT statements. Let us do that: WITH_DBUG_TRACE=OFF shall disable DBUG_PRINT() as well. A few InnoDB recovery tests used to check that some output from DBUG_PRINT("ib_log", ...) is present. We can live without those checks. Reviewed by: Vladislav Vaintroub
* | | | Merge 10.5 into 10.6Marko Mäkelä2022-09-051-1/+1
|\ \ \ \ | |/ / /
| * | | MDEV-29418 linux uuid implementation returning non-hwaddr based suffixDaniel Black2022-08-311-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Because of a define error the wrong value was being returned. Regression in MDEV-28243 Fixes: 607f9874679c3e4ef7edcd2c9d80120051af73cc
* | | | Ensure that source files contain only valid UTF8 encodings (#2188)anson10142022-08-301-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Modern software (including text editors, static analysis software, and web-based code review interfaces) often requires source code files to be interpretable via a consistent character encoding, with UTF-8 or ASCII (a strict subset of UTF-8) as the default. Several of the MariaDB source files contain bytes that are not valid in either the UTF-8 or ASCII encodings, but instead represent strings encoded in the ISO-8859-1/Latin-1 or ISO-8859-2/Latin-2 encodings. These inconsistent encodings may prevent software from correctly presenting or processing such files. Converting all source files to valid UTF8 characters will ensure correct handling. Comments written in Czech were replaced with lightly-corrected translations from Google Translate. Additionally, comments describing the proper handling of special characters were changed so that the comments are now purely UTF8. All new code of the whole pull request, including one or several files that are either new files or modified ones, are contributed under the BSD-new license. I am contributing on behalf of my employer Amazon Web Services, Inc. Co-authored-by: Andrew Hutchings <andrew@linuxjedi.co.uk>
* | | | Merge branch '10.5' into bb-10.6-releaseOleksandr Byelkin2022-08-032-11/+31
|\ \ \ \ | |/ / /
| * | | my_getopt --help for "bit" optionsSergei Golubchik2022-08-021-1/+2
| | | | | | | | | | | | | | | | print "Defaults to on" not only for GET_BOOL, but also for GET_BIT
| * | | Merge branch 'merge-perfschema-5.7' into 10.5Oleksandr Byelkin2022-08-021-10/+29
| | | |
* | | | Merge 10.5 into 10.6Marko Mäkelä2022-07-271-7/+6
|\ \ \ \ | |/ / /
| * | | Merge 10.4 into 10.5Marko Mäkelä2022-07-271-7/+6
| |\ \ \ | | |/ /
| | * | Merge branch '10.3' into 10.4Oleksandr Byelkin2022-07-271-7/+6
| | |\ \ | | | |/
| | | * MDEV-28746 Wrong error code ER_BAD_DB_ERROR for long filenamesVladislav Vaintroub2022-07-071-7/+6
| | | | | | | | | | | | | | | | Add check for path length if CreateFile fails with ERROR_PATH_NOT_FOUND.
* | | | Merge 10.5 into 10.6Marko Mäkelä2022-06-271-1/+1
|\ \ \ \ | |/ / /
| * | | Merge 10.4 into 10.5Marko Mäkelä2022-06-271-1/+1
| |\ \ \ | | |/ /
| | * | Merge 10.3 into 10.4Marko Mäkelä2022-06-271-1/+1
| | |\ \ | | | |/
| | | * MDEV-22590 SIGSEGV in flush_all_key_blocks when changing key_buffer_size / ↵Oleksandr Byelkin2022-06-241-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ASAN: heap-use-after-free in flush_all_key_blocks Take into account that in preparation of a simple key cache for resizing no disk blocks might be assigned to it. Reviewer: IgorBabaev <igor@mariadb.com>
* | | | MDEV-28836: Memory alignment cleanupMarko Mäkelä2022-06-211-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Table_cache_instance: Define the structure aligned at the CPU cache line, and remove a pad[] data member. Krunal Bauskar reported this to improve performance on ARMv8. aligned_malloc(): Wrapper for the Microsoft _aligned_malloc() and the ISO/IEC 9899:2011 <stdlib.h> aligned_alloc(). Note: The parameters are in the Microsoft order (size, alignment), opposite of aligned_alloc(alignment, size). Note: The standard defines that size must be an integer multiple of alignment. It is enforced by AddressSanitizer but not by GNU libc on Linux. aligned_free(): Wrapper for the Microsoft _aligned_free() and the standard free(). HAVE_ALIGNED_ALLOC: A new test. Unfortunately, support for aligned_alloc() may still be missing on some platforms. We will fall back to posix_memalign() for those cases. HAVE_MEMALIGN: Remove, along with any use of the nonstandard memalign(). PFS_ALIGNEMENT (sic): Removed; we will use CPU_LEVEL1_DCACHE_LINESIZE. PFS_ALIGNED: Defined using the C++11 keyword alignas. buf_pool_t::page_hash_table::create(), lock_sys_t::hash_table::create(): lock_sys_t::hash_table::resize(): Pad the allocation size to an integer multiple of the alignment. Reviewed by: Vladislav Vaintroub