summaryrefslogtreecommitdiff
path: root/mysys
Commit message (Collapse)AuthorAgeFilesLines
* Merge branch '5.5' into 10.0Sergei Golubchik2018-04-202-8/+11
|\
| * Merge branch 'mysql/5.5' into 5.5Sergei Golubchik2018-04-191-4/+5
| |\
| | * BUG#26502135: MYSQLD SEGFAULTS INKarthik Kamath2017-11-271-3/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | MDL_CONTEXT::TRY_ACQUIRE_LOCK_IMPL ANALYSIS: ========= Server sometimes exited when multiple threads tried to acquire and release metadata locks simultaneously (for example, necessary to access a table). The same problem could have occurred when new objects were registered/ deregistered in Performance Schema. The problem was caused by a bug in LF_HASH - our lock free hash implementation which is used by metadata locking subsystem in 5.7 branch. In 5.5 and 5.6 we only use LF_HASH in Performance Schema Instrumentation implementation. So for these versions, the problem was limited to P_S. The problem was in my_lfind() function, which searches for the specific hash element by going through the elements list. During this search it loads information about element checked such as key pointer and hash value into local variables. Then it confirms that they are not corrupted by concurrent delete operation (which will set pointer to 0) by checking if element is still in the list. The latter check did not take into account that compiler (and processor) can reorder reads in such a way that load of key pointer will happen after it, making result of the check invalid. FIX: ==== This patch fixes the problem by ensuring that no such reordering can take place. This is achieved by using my_atomic_loadptr() which contains compiler and processor memory barriers for the check mentioned above and other similar places. The default (for non-Windows systems) implementation of my_atomic*() relies on old __sync intrisics and implements my_atomic_loadptr() as read-modify operation. To avoid scalability/performance penalty associated with addition of my_atomic_loadptr()'s we change the my_atomic*() to use newer __atomic intrisics when available. This new default implementation doesn't have such a drawback.
| * | defaults-group-suffix in print_defaultsDaniel Black2018-04-131-4/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Also clarify which --{no-,}default* options, must be first. Sample output: $ client/mysql --help client/mysql Ver 15.1 Distrib 5.5.59-MariaDB, for Linux (x86_64) using readline 5.1 Copyright (c) 2000, 2017, Oracle, MariaDB Corporation Ab and others. Usage: client/mysql [OPTIONS] [database] Default options are read from the following files in the given order: /etc/my.cnf /etc/mysql/my.cnf ~/.my.cnf The following groups are read: mysql client client-server client-mariadb The following options may be given as the first argument: --print-defaults Print the program argument list and exit. --no-defaults Don't read default options from any option file. The following specify which files/groups are read (specified before other options): --defaults-file=# Only read default options from the given file #. --defaults-extra-file=# Read this file after the global files are read. --defaults-group-suffix=# Additionally read default groups with # appended as a suffix. tests running from build directory: TEST: print defaults ignored as not first $ sql/mysqld --no-defaults --print-defaults --lc-messages-dir=${PWD}/sql/share TEST: no startup occurs as --print-defaults specified $ sql/mysqld --print-defaults --lc-messages-dir=${PWD}/sql/share sql/mysqld would have been started with the following arguments: --lc-messages-dir=/home/dan/repos/build-mariadb-5.5/sql/share TEST: default args can't be anywhere $ client/mysql --user=bob --defaults-file=/etc/my.cnf client/mysql: unknown variable 'defaults-file=/etc/my.cnf' $ client/mysql --user=bob --defaults-group-suffix=.group client/mysql: unknown variable 'defaults-group-suffix=.group' /etc/my.cnf: [client-server.group] socket=/var/lib/mysql-multi/group/mysqld.sock user=bob /etc/my.other.cnf: socket=/var/lib/mysql-other/mysqld.sock TEST: defaults file read and suffix also applied $ client/mysql --defaults-file=/etc/my.other.cnf --defaults-group-suffix=.group ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql-other/mysqld.sock' (2) TEST: defaults extra file $ client/mysql --defaults-extra-file=/etc/my.other.cnf --defaults-group-suffix=.group ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql-other/mysqld.sock' (2)
* | | Merge branch '5.5' into 10.0Vicențiu Ciorbaru2018-04-031-1/+1
|\ \ \ | |/ /
| * | compiler warningSergei Golubchik2018-04-031-1/+1
| | | | | | | | | | | | warning: format '%p' expects argument of type 'void *', but argument 4 has type 'long int'
* | | MDEV-15230: column_json breaks cyrillic in 10.1.31Oleksandr Byelkin2018-02-071-1/+1
| | | | | | | | | | | | Use unsigned comparison.
* | | Merge remote-tracking branch 'origin/5.5' into 10.0Vicențiu Ciorbaru2018-02-021-1/+1
|\ \ \ | |/ /
| * | Fix an out of scope bzeroVicențiu Ciorbaru2018-01-301-1/+1
| | |
* | | Merge remote-tracking branch '5.5' into 10.0Vicențiu Ciorbaru2018-01-246-49/+77
|\ \ \ | |/ /
| * | improve ASAN instrumentation: MEM_ROOTSergei Golubchik2018-01-221-3/+6
| | | | | | | | | | | | more complete TRASH-ing of memroots
| * | Correct TRASH() macro usageSergei Golubchik2018-01-222-3/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | TRASH was mapped to TRASH_FREE and was supposed to be used for memory that should not be accessed anymore, while TRASH_ALLOC() is to be used for uninitialized but to-be-used memory. But sometimes TRASH() was used in the latter sense. Remove TRASH() macro, always use explicit TRASH_ALLOC() or TRASH_FREE().
| * | MDEV-14229: Stack trace is not resolved for shared objectsVicențiu Ciorbaru2018-01-192-32/+67
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Resolving a stacktrace including functions in dynamic libraries requires us to look inside the libraries for the symbols. Addr2line needs to be started with the correct binary for each address on the stack. To do this, figure out which library it is using dladdr, then if the addr2line binary was started with a different binary, fork it again with the correct one. We only have one addr2line process running at any point during the stacktrace resolving step. The maximum number of forks for addr2line should generally be around 6. One for server stacktrace code, one for plugin code, one when going back into server code, one for pthread library, one for libc, one for the _start function in the server. More can come up if plugin calls server function which goes back to a plugin, etc.
| * | Merge branch 'mysql/5.5' into 5.5Sergei Golubchik2018-01-181-2/+3
| |\ \ | | |/
| | * Bug#23072792 MYSQL_GROUP_SUFFIX DOES NOT WORKTor Didriksen2017-09-081-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | Reintroduce environment variable MYSQL_GROUP_SUFFIX to be used as --default-group-suffix value if not already set. The environment variable was accidentally renamed to DEFAULT_GROUP_SUFFIX_ENV in MySQL server 5.5.
| | * BUG#25451091:CREATE TABLE DATA DIRECTORY / INDEX DIRECTORYNisha Gopalakrishnan2017-05-121-3/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | SYMLINK CHECK RACE CONDITIONS ANALYSIS: ========= A potential defect exists in the handling of CREATE TABLE .. DATA DIRECTORY/ INDEX DIRECTORY which gives way to the user to gain access to another user table or a system table. FIX: ==== The lstat and fstat output of the target files are now stored which help in determining the identity of the target files thus preventing the unauthorized access to other files.
| | * Bug#24388746: PRIVILEGE ESCALATION AND RACE CONDITION USING CREATE TABLEJon Olav Hauglid2016-08-191-3/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | During REPAIR TABLE of a MyISAM table, a temporary data file (.TMD) is created. When repair finishes, this file is renamed to the original .MYD file. The problem was that during this rename, we copied the stats from the old file to the new file with chmod/chown. If a user managed to replace the temporary file before chmod/chown was executed, it was possible to get an arbitrary file with the privileges of the mysql user. This patch fixes the problem by not copying stats from the old file to the new file. This is not needed as the new file was created with the correct stats. This fix only changes server behavior - external utilities such as myisamchk still does chmod/chown. No test case provided since the problem involves synchronization with file system operations.
| | * Bug#23251517: SEMISYNC REPLICATION HANGINGSujatha Sivakumar2016-05-132-16/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Revert following bug fix: Bug#20685029: SLAVE IO THREAD SHOULD STOP WHEN DISK IS FULL Bug#21753696: MAKE SHOW SLAVE STATUS NON BLOCKING IF IO THREAD WAITS FOR DISK SPACE This fix results in a deadlock between slave IO thread and SQL thread.
| * | MDEV-14469 build with cmake -DMYSQL_MAINTAINER_MODE=ON fails: 'readdir_r' is ↵Sergei Golubchik2018-01-151-10/+0
| | | | | | | | | | | | | | | | | | | | | | | | deprecated 1. test readdir_r() availability under -Werror 2. don't protect readdir() with mutexes, it's not needed for the way we use readdir()
* | | MDEV-7533: COLUMN_JSON() doesn't escape control characters in string valuesOleksandr Byelkin2018-01-231-2/+58
| | | | | | | | | | | | | | | escape all charecters less or equal 0x1F (control symbols) (shorter sequence are not used to make code simple, long encoding is always legal according to the rfc4627)
* | | MDEV-8949: COLUMN_CREATE unicode name breakageOleksandr Byelkin2017-11-141-2/+1
| | | | | | | | | | | | Use utf-mb4 if it is possible.
* | | Merge branch '5.5' into 10.0Sergei Golubchik2017-10-181-0/+10
|\ \ \ | |/ /
| * | MDEV-13459 Warnings, when compiling with gcc-7.xSergei Golubchik2017-10-171-0/+10
| | | | | | | | | | | | mostly caused by -Wimplicit-fallthrough
* | | MDEV-13691 : my_write() sets inappropriate errno for ERROR_FILE_SYSTEM_LIMITATONVladislav Vaintroub2017-08-311-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ERROR_FILE_SYSTEM_LIMITATION was seen by support when backing up large file. However mariabackup error message was not very helpful, since it mapped the error to generic catch-all EINVAL. With the patch, ERROR_FILE_SYSTEM_LIMITATION will be mapped to more appropriate EFBIG. Also add mapping from ERROR_NO_SYSTEM_RESOURCES to ENOMEM.
* | | Windows : Do not use CRT routine to dump memory leaks.Vladislav Vaintroub2017-08-241-1/+0
| | | | | | | | | | | | | | | Its output is useless,and, in case of large output, it also may prevent with search_pattern_in_file.inc from working.
* | | Merge remote-tracking branch 'origin/5.5' into 10.0Vicențiu Ciorbaru2017-07-252-2/+2
|\ \ \ | |/ /
| * | MDEV-8692 prefschema test failures on ARM (on Debian build system)Alexander Barkov2017-07-171-0/+25
| | | | | | | | | | | | | | | | | | A few tests assumes that the CYCLE timer is always available, which is not true on some platforms (e.g. ARM). Fixing the tests not to reply on the CYCLE availability.
| * | MDEV-12144 Signal 6 crash corrupts ibd filesSergei Golubchik2017-07-152-2/+2
| | | | | | | | | | | | | | | Avoid using STDERR_FILENO. The server uses freopen(stderr), so stderr can be on any file descriptor.
* | | Merge remote-tracking branch '5.5' into 10.0Vicențiu Ciorbaru2017-06-202-2/+11
|\ \ \ | |/ /
| * | MDEV-12778 mariadb-10.1 FTBFS on GNU/Hurd due to use of PATH_MAXSergei Golubchik2017-06-192-2/+11
| | |
* | | MDEV-6262 analyze the coverity report on mariadbSergei Golubchik2017-05-193-1/+5
| | | | | | | | | | | | | | | uploaded 10.0, analyzed everything with the Impact=High (and a couple of Medium)
* | | Fixed typo in the case operator.Oleksandr Byelkin2017-05-181-0/+1
| | |
* | | MDEV-12420 max_recursive_iterations did not prevent a stack-overflow and ↵Sergei Golubchik2017-05-152-8/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | segfault post-review fixes * move pcre-specific variable out of mysys * don't use current_thd * move a commonly used macro to my_sys.h * remove new sysvar
* | | WIP: global readonly variable pcre_frame_sizeDaniel Black2017-05-151-0/+2
| | |
* | | Merge branch '5.5' into 10.0Sergei Golubchik2017-04-211-1/+5
|\ \ \ | |/ /
| * | MDEV-12230 include/my_sys.h:600:43: error: unknown type name ↵Sergei Golubchik2017-04-201-8/+6
| | | | | | | | | | | | | | | | | | ‘PSI_file_key’" when -DWITHOUT_SERVER=1 cherry-pick 2c2bd8c155 (MDEV-12261 build failure without P_S) from 10.0
| * | MDEV-12310 openat(<directory>, ...O_EXEC) fails on Illumos / SolarisSergei Golubchik2017-04-201-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | it could be * O_SEARCH on Illumos * O_EXEC on FreeBSD * O_PATH on Linux ugh
* | | MDEV-12261 build failure without P_SSergei Golubchik2017-03-151-8/+6
| | | | | | | | | | | | | | | restore mysql_file_delete_with_symlink() but let it use new my_handler_delete_with_symlink() mysys helper.
* | | Merge branch '5.5' into 10.0Vicențiu Ciorbaru2017-03-081-1/+2
|\ \ \ | |/ /
| * | mysql_client_test_nonblock fails when compiled with clangVicențiu Ciorbaru2017-03-081-1/+2
| | | | | | | | | | | | | | | | | | | | | mysql_client uses some inline assembly code to switch thread stacks. This works, however tools that perform backtrace get confused to fix this we write a specific constant to signify bottom of stack. This constant is needed when compiling with CLang as well.
* | | Post MDEV-11902 Fix test failures in maria and myisam storage enginesVicențiu Ciorbaru2017-03-031-1/+9
| | | | | | | | | | | | | | | | | | my_readline can fail due to missing file. Make my_readline report this condition separately so that we can catch it and report an appropriate error message to the user.
* | | Merge branch '5.5' into 10.0Vicențiu Ciorbaru2017-03-0312-83/+194
|\ \ \ | |/ /
| * | bugfix: remove my_delete_with_symlink()Sergei Golubchik2017-02-271-21/+0
| | | | | | | | | | | | | | | | | | it was race condition prone. instead use either a pair of my_delete() calls with already resolved paths, or a safe high-level function my_handler_delete_with_symlink(), like MyISAM and Aria already do.
| * | race-condition safe implementation of mi_delete_table/maria_delete_tableSergei Golubchik2017-02-272-1/+29
| | |
| * | support MY_NOSYMLINKS in my_delete()Sergei Golubchik2017-02-274-84/+118
| | |
| * | MDEV-11902 mi_open race conditionSergei Golubchik2017-02-271-2/+88
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | TOCTOU bug. The path is checked to be valid, symlinks are resolved. Then the resolved path is opened. Between the check and the open, there's a window when one can replace some path component with a symlink, bypassing validity checks. Fix: after we resolved all symlinks in the path, don't allow open() to resolve symlinks, there should be none. Compared to the old MyISAM/Aria code: * fastpath. Opening of not-symlinked files is just one open(), no fn_format() and lstat() anymore. * opening of symlinked tables doesn't do fn_format() and lstat() either. it also doesn't to realpath() (which was lstat-ing every path component), instead if opens every path component with O_PATH. * share->data_file_name stores realpath(path) not readlink(path). So, SHOW CREATE TABLE needs to do lstat/readlink() now (see ::info()), and certain error messages (cannot open file "XXX") show the real file path with all symlinks resolved.
| * | cleanup: NO_OPEN_3 was never definedSergei Golubchik2017-02-271-3/+1
| | |
| * | cleanup: mysys_test_invalid_symlinkSergei Golubchik2017-02-271-0/+9
| | | | | | | | | | | | | | | Remove maria_test_invalid_symlink() and myisam_test_invalid_symlink(), introduce mysys_test_invalid_symlink(). Other engines might need it too
| * | cleanup: my_register_filename()Sergei Golubchik2017-02-274-48/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | Don't let my_register_filename() fail because strdup() failed. Better to have NULL for a filename, then to fail the already successful open(). Filenames are only used for error reporting and there was already code to ignore OOMs (my_fdopen()) and to cope with missing filenames (my_filename()).
| * | cleanup: fn_format, remove dead codeSergei Golubchik2017-02-271-6/+1
| | | | | | | | | | | | my_realpath() ignores MY_xxx flags anyway