Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
bfba2bce
Commit
bfba2bce
authored
Aug 20, 2020
by
Marko Mäkelä
Browse files
Options
Browse Files
Download
Plain Diff
Merge 10.1 into 10.2
parents
309302a3
ece0b062
Changes
11
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
117 additions
and
130 deletions
+117
-130
client/mysqltest.cc
client/mysqltest.cc
+0
-4
include/my_stacktrace.h
include/my_stacktrace.h
+0
-3
mysql-test/r/mysql_tzinfo_to_sql_symlink.result
mysql-test/r/mysql_tzinfo_to_sql_symlink.result
+6
-0
mysql-test/suite/wsrep/r/mysql_tzinfo_to_sql_symlink.result
mysql-test/suite/wsrep/r/mysql_tzinfo_to_sql_symlink.result
+4
-0
mysql-test/suite/wsrep/r/mysql_tzinfo_to_sql_symlink_skip.result
...est/suite/wsrep/r/mysql_tzinfo_to_sql_symlink_skip.result
+4
-0
mysys/stacktrace.c
mysys/stacktrace.c
+16
-117
scripts/mysqld_safe.sh
scripts/mysqld_safe.sh
+16
-4
sql/mysqld.cc
sql/mysqld.cc
+0
-1
sql/tztime.cc
sql/tztime.cc
+3
-0
unittest/mysys/CMakeLists.txt
unittest/mysys/CMakeLists.txt
+1
-1
unittest/mysys/stacktrace-t.c
unittest/mysys/stacktrace-t.c
+67
-0
No files found.
client/mysqltest.cc
View file @
bfba2bce
...
...
@@ -9062,10 +9062,6 @@ static void init_signal_handling(void)
struct
sigaction
sa
;
DBUG_ENTER
(
"init_signal_handling"
);
#ifdef HAVE_STACKTRACE
my_init_stacktrace
();
#endif
sa
.
sa_flags
=
SA_RESETHAND
|
SA_NODEFER
;
sigemptyset
(
&
sa
.
sa_mask
);
sigprocmask
(
SIG_SETMASK
,
&
sa
.
sa_mask
,
NULL
);
...
...
include/my_stacktrace.h
View file @
bfba2bce
...
...
@@ -43,7 +43,6 @@
C_MODE_START
#if defined(HAVE_STACKTRACE) || defined(HAVE_BACKTRACE)
void
my_init_stacktrace
();
void
my_print_stacktrace
(
uchar
*
stack_bottom
,
ulong
thread_stack
);
int
my_safe_print_str
(
const
char
*
val
,
int
max_len
);
void
my_write_core
(
int
sig
);
...
...
@@ -53,8 +52,6 @@ char *my_demangle(const char *mangled_name, int *status);
#ifdef __WIN__
void
my_set_exception_pointers
(
EXCEPTION_POINTERS
*
ep
);
#endif
/* __WIN__ */
#else
#define my_init_stacktrace() do { } while(0)
#endif
/* ! (defined(HAVE_STACKTRACE) || defined(HAVE_BACKTRACE)) */
#ifndef _WIN32
...
...
mysql-test/r/mysql_tzinfo_to_sql_symlink.result
View file @
bfba2bce
...
...
@@ -15,6 +15,7 @@ TRUNCATE TABLE time_zone;
TRUNCATE TABLE time_zone_name;
TRUNCATE TABLE time_zone_transition;
TRUNCATE TABLE time_zone_transition_type;
START TRANSACTION;
INSERT INTO time_zone (Use_leap_seconds) VALUES ('N');
SET @time_zone_id= LAST_INSERT_ID();
INSERT INTO time_zone_name (Name, Time_zone_id) VALUES ('GMT', @time_zone_id);
...
...
@@ -32,6 +33,7 @@ INSERT INTO time_zone_transition_type (Time_zone_id, Transition_type_id, Offset,
Warning: Unable to load 'MYSQLTEST_VARDIR/zoneinfo/posix/garbage' as time zone. Skipping it.
Warning: Unable to load 'MYSQLTEST_VARDIR/zoneinfo/posix/ignored.tab' as time zone. Skipping it.
Warning: Skipping directory 'MYSQLTEST_VARDIR/zoneinfo/posix/posix': to avoid infinite symlink recursion.
COMMIT;
ALTER TABLE time_zone_transition ORDER BY Time_zone_id, Transition_time;
ALTER TABLE time_zone_transition_type ORDER BY Time_zone_id, Transition_type_id;
\d |
...
...
@@ -57,6 +59,7 @@ TRUNCATE TABLE time_zone;
TRUNCATE TABLE time_zone_name;
TRUNCATE TABLE time_zone_transition;
TRUNCATE TABLE time_zone_transition_type;
START TRANSACTION;
INSERT INTO time_zone (Use_leap_seconds) VALUES ('N');
SET @time_zone_id= LAST_INSERT_ID();
INSERT INTO time_zone_name (Name, Time_zone_id) VALUES ('GMT', @time_zone_id);
...
...
@@ -71,6 +74,7 @@ INSERT INTO time_zone_transition_type (Time_zone_id, Transition_type_id, Offset,
(@time_zone_id, 0, 0, 0, 'GMT')
;
Warning: Unable to load 'MYSQLTEST_VARDIR/zoneinfo/posix/garbage' as time zone. Skipping it.
COMMIT;
ALTER TABLE time_zone_transition ORDER BY Time_zone_id, Transition_time;
ALTER TABLE time_zone_transition_type ORDER BY Time_zone_id, Transition_type_id;
\d |
...
...
@@ -160,6 +164,8 @@ TRUNCATE TABLE time_zone;
TRUNCATE TABLE time_zone_name;
TRUNCATE TABLE time_zone_transition;
TRUNCATE TABLE time_zone_transition_type;
START TRANSACTION;
COMMIT;
ALTER TABLE time_zone_transition ORDER BY Time_zone_id, Transition_time;
ALTER TABLE time_zone_transition_type ORDER BY Time_zone_id, Transition_type_id;
\d |
...
...
mysql-test/suite/wsrep/r/mysql_tzinfo_to_sql_symlink.result
View file @
bfba2bce
...
...
@@ -15,6 +15,7 @@ TRUNCATE TABLE time_zone;
TRUNCATE TABLE time_zone_name;
TRUNCATE TABLE time_zone_transition;
TRUNCATE TABLE time_zone_transition_type;
START TRANSACTION;
INSERT INTO time_zone (Use_leap_seconds) VALUES ('N');
SET @time_zone_id= LAST_INSERT_ID();
INSERT INTO time_zone_name (Name, Time_zone_id) VALUES ('GMT', @time_zone_id);
...
...
@@ -32,6 +33,7 @@ INSERT INTO time_zone_transition_type (Time_zone_id, Transition_type_id, Offset,
Warning: Unable to load 'MYSQLTEST_VARDIR/zoneinfo/posix/garbage' as time zone. Skipping it.
Warning: Unable to load 'MYSQLTEST_VARDIR/zoneinfo/posix/ignored.tab' as time zone. Skipping it.
Warning: Skipping directory 'MYSQLTEST_VARDIR/zoneinfo/posix/posix': to avoid infinite symlink recursion.
COMMIT;
ALTER TABLE time_zone_transition ORDER BY Time_zone_id, Transition_time;
ALTER TABLE time_zone_transition_type ORDER BY Time_zone_id, Transition_type_id;
\d |
...
...
@@ -57,6 +59,7 @@ TRUNCATE TABLE time_zone;
TRUNCATE TABLE time_zone_name;
TRUNCATE TABLE time_zone_transition;
TRUNCATE TABLE time_zone_transition_type;
START TRANSACTION;
INSERT INTO time_zone (Use_leap_seconds) VALUES ('N');
SET @time_zone_id= LAST_INSERT_ID();
INSERT INTO time_zone_name (Name, Time_zone_id) VALUES ('GMT', @time_zone_id);
...
...
@@ -71,6 +74,7 @@ INSERT INTO time_zone_transition_type (Time_zone_id, Transition_type_id, Offset,
(@time_zone_id, 0, 0, 0, 'GMT')
;
Warning: Unable to load 'MYSQLTEST_VARDIR/zoneinfo/posix/garbage' as time zone. Skipping it.
COMMIT;
ALTER TABLE time_zone_transition ORDER BY Time_zone_id, Transition_time;
ALTER TABLE time_zone_transition_type ORDER BY Time_zone_id, Transition_type_id;
\d |
...
...
mysql-test/suite/wsrep/r/mysql_tzinfo_to_sql_symlink_skip.result
View file @
bfba2bce
...
...
@@ -9,6 +9,7 @@ TRUNCATE TABLE time_zone;
TRUNCATE TABLE time_zone_name;
TRUNCATE TABLE time_zone_transition;
TRUNCATE TABLE time_zone_transition_type;
START TRANSACTION;
INSERT INTO time_zone (Use_leap_seconds) VALUES ('N');
SET @time_zone_id= LAST_INSERT_ID();
INSERT INTO time_zone_name (Name, Time_zone_id) VALUES ('GMT', @time_zone_id);
...
...
@@ -26,6 +27,7 @@ INSERT INTO time_zone_transition_type (Time_zone_id, Transition_type_id, Offset,
Warning: Unable to load 'MYSQLTEST_VARDIR/zoneinfo/posix/garbage' as time zone. Skipping it.
Warning: Unable to load 'MYSQLTEST_VARDIR/zoneinfo/posix/ignored.tab' as time zone. Skipping it.
Warning: Skipping directory 'MYSQLTEST_VARDIR/zoneinfo/posix/posix': to avoid infinite symlink recursion.
COMMIT;
ALTER TABLE time_zone_transition ORDER BY Time_zone_id, Transition_time;
ALTER TABLE time_zone_transition_type ORDER BY Time_zone_id, Transition_type_id;
# Silent run
...
...
@@ -36,6 +38,7 @@ TRUNCATE TABLE time_zone;
TRUNCATE TABLE time_zone_name;
TRUNCATE TABLE time_zone_transition;
TRUNCATE TABLE time_zone_transition_type;
START TRANSACTION;
INSERT INTO time_zone (Use_leap_seconds) VALUES ('N');
SET @time_zone_id= LAST_INSERT_ID();
INSERT INTO time_zone_name (Name, Time_zone_id) VALUES ('GMT', @time_zone_id);
...
...
@@ -50,6 +53,7 @@ INSERT INTO time_zone_transition_type (Time_zone_id, Transition_type_id, Offset,
(@time_zone_id, 0, 0, 0, 'GMT')
;
Warning: Unable to load 'MYSQLTEST_VARDIR/zoneinfo/posix/garbage' as time zone. Skipping it.
COMMIT;
ALTER TABLE time_zone_transition ORDER BY Time_zone_id, Transition_time;
ALTER TABLE time_zone_transition_type ORDER BY Time_zone_id, Transition_type_id;
#
...
...
mysys/stacktrace.c
View file @
bfba2bce
...
...
@@ -34,108 +34,11 @@
#include <execinfo.h>
#endif
#ifdef __linux__
#define PTR_SANE(p) ((p) && (char*)(p) >= heap_start && (char*)(p) <= heap_end)
static
char
*
heap_start
;
char
*
__bss_start
;
#else
#define PTR_SANE(p) (p)
#endif
/* __linux */
void
my_init_stacktrace
()
{
#ifdef __linux__
heap_start
=
(
char
*
)
&
__bss_start
;
#endif
/* __linux */
}
#ifdef __linux__
static
void
print_buffer
(
char
*
buffer
,
size_t
count
)
{
const
char
s
[]
=
" "
;
for
(;
count
&&
*
buffer
;
--
count
)
{
my_write_stderr
(
isprint
(
*
buffer
)
?
buffer
:
s
,
1
);
++
buffer
;
}
}
/**
Access the pages of this process through /proc/self/task/<tid>/mem
in order to safely print the contents of a memory address range.
@param addr The address at the start of the memory region.
@param max_len The length of the memory region.
@return Zero on success.
*/
static
int
safe_print_str
(
const
char
*
addr
,
int
max_len
)
{
int
fd
;
pid_t
tid
;
off_t
offset
;
ssize_t
nbytes
=
0
;
size_t
total
,
count
;
char
buf
[
256
];
tid
=
(
pid_t
)
syscall
(
SYS_gettid
);
sprintf
(
buf
,
"/proc/self/task/%d/mem"
,
tid
);
if
((
fd
=
open
(
buf
,
O_RDONLY
))
<
0
)
return
-
1
;
/* Ensure that off_t can hold a pointer. */
compile_time_assert
(
sizeof
(
off_t
)
>=
sizeof
(
intptr
));
total
=
max_len
;
offset
=
(
intptr
)
addr
;
/* Read up to the maximum number of bytes. */
while
(
total
)
{
count
=
MY_MIN
(
sizeof
(
buf
),
total
);
if
((
nbytes
=
pread
(
fd
,
buf
,
count
,
offset
))
<
0
)
{
/* Just in case... */
if
(
errno
==
EINTR
)
continue
;
else
break
;
}
/* Advance offset into memory. */
total
-=
nbytes
;
offset
+=
nbytes
;
addr
+=
nbytes
;
/* Output the printable characters. */
print_buffer
(
buf
,
nbytes
);
/* Break if less than requested... */
if
((
count
-
nbytes
))
break
;
}
if
(
nbytes
==
-
1
)
my_safe_printf_stderr
(
"Can't read from address %p"
,
addr
);
close
(
fd
);
return
0
;
}
#endif
/*
Attempt to print a char * pointer as a string.
SYNOPSIS
Prints either until the end of string ('\0'), or max_len characters have
been printed.
Prints until max_len characters have been printed.
RETURN VALUE
0 Pointer was within the heap address space.
...
...
@@ -150,24 +53,25 @@ static int safe_print_str(const char *addr, int max_len)
int
my_safe_print_str
(
const
char
*
val
,
int
max_len
)
{
#ifdef __linux__
char
*
heap_end
;
// Try and make use of /proc filesystem to safely print memory contents.
if
(
!
safe_print_str
(
val
,
max_len
))
return
0
;
heap_end
=
(
char
*
)
sbrk
(
0
);
#endif
if
(
!
PTR_SANE
(
val
))
const
char
*
orig_val
=
val
;
if
(
!
val
)
{
my_safe_printf_stderr
(
"%s"
,
"
is an invalid pointer
"
);
my_safe_printf_stderr
(
"%s"
,
"
(null)
"
);
return
1
;
}
for
(;
max_len
&&
PTR_SANE
(
val
)
&&
*
val
;
--
max_len
)
my_write_stderr
((
val
++
),
1
);
for
(;
max_len
;
--
max_len
)
{
if
(
my_write_stderr
((
val
++
),
1
)
!=
1
)
{
if
((
errno
==
EFAULT
)
&&
(
val
==
orig_val
+
1
))
{
// We can not read the address from very beginning
my_safe_printf_stderr
(
"Can't access address %p"
,
orig_val
);
}
break
;
}
}
my_safe_printf_stderr
(
"%s"
,
"
\n
"
);
return
0
;
...
...
@@ -507,11 +411,6 @@ static EXCEPTION_POINTERS *exception_ptrs;
#define MODULE64_SIZE_WINXP 576
#define STACKWALK_MAX_FRAMES 64
void
my_init_stacktrace
()
{
}
void
my_set_exception_pointers
(
EXCEPTION_POINTERS
*
ep
)
{
exception_ptrs
=
ep
;
...
...
scripts/mysqld_safe.sh
View file @
bfba2bce
...
...
@@ -23,6 +23,7 @@ numa_interleave=0
wsrep_on
=
0
dry_run
=
0
defaults_group_suffix
=
ignore_unknown
=
1
# Initial logging status: error log is not open, and not using syslog
logging
=
init
...
...
@@ -389,11 +390,22 @@ parse_arguments() {
--help
)
usage
;;
--ignore-unknown
)
ignore_unknown
=
1
;;
--no-ignore-unknown
|
--not-ignore-unknown
)
ignore_unknown
=
0
;;
*
)
if
test
$ignore_unknown
-eq
0
then
case
"
$unrecognized_handling
"
in
collect
)
append_arg_to_args
"
$arg
"
;;
complain
)
log_error
"unknown option '
$arg
'"
;;
complain
)
log_error
"unknown option '
$arg
'"
esac
else
case
"
$arg
"
in
"--loose-"
*
)
append_arg_to_args
"
$arg
"
;;
*
)
append_arg_to_args
"--loose-
$arg
"
esac
fi
esac
done
}
...
...
sql/mysqld.cc
View file @
bfba2bce
...
...
@@ -3357,7 +3357,6 @@ void init_signals(void)
sigemptyset
(
&
sa
.
sa_mask
);
sigprocmask
(
SIG_SETMASK
,
&
sa
.
sa_mask
,
NULL
);
my_init_stacktrace
();
#if defined(__amiga__)
sa
.
sa_handler
=
(
void
(
*
)())
handle_fatal_signal
;
#else
...
...
sql/tztime.cc
View file @
bfba2bce
...
...
@@ -2747,9 +2747,11 @@ main(int argc, char **argv)
printf
(
"TRUNCATE TABLE time_zone_name;
\n
"
);
printf
(
"TRUNCATE TABLE time_zone_transition;
\n
"
);
printf
(
"TRUNCATE TABLE time_zone_transition_type;
\n
"
);
printf
(
"START TRANSACTION;
\n
"
);
if
(
scan_tz_dir
(
root_name_end
,
0
,
opt_verbose
))
{
printf
(
"ROLLBACK;
\n
"
);
fflush
(
stdout
);
fprintf
(
stderr
,
"There were fatal errors during processing "
...
...
@@ -2757,6 +2759,7 @@ main(int argc, char **argv)
return
1
;
}
printf
(
"COMMIT;
\n
"
);
printf
(
"ALTER TABLE time_zone_transition "
"ORDER BY Time_zone_id, Transition_time;
\n
"
);
printf
(
"ALTER TABLE time_zone_transition_type "
...
...
unittest/mysys/CMakeLists.txt
View file @
bfba2bce
...
...
@@ -15,7 +15,7 @@
MY_ADD_TESTS
(
bitmap base64 my_atomic my_rdtsc lf my_malloc my_getopt dynstring
byte_order
queues LINK_LIBRARIES mysys
)
queues
stacktrace
LINK_LIBRARIES mysys
)
MY_ADD_TESTS
(
my_vsnprintf LINK_LIBRARIES strings mysys
)
MY_ADD_TESTS
(
aes LINK_LIBRARIES mysys mysys_ssl
)
ADD_DEFINITIONS
(
${
SSL_DEFINES
}
)
...
...
unittest/mysys/stacktrace-t.c
0 → 100644
View file @
bfba2bce
/* Copyright (c) 2020, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA */
#include <my_global.h>
#include <my_sys.h>
#include <stdio.h>
#include <my_stacktrace.h>
#include <tap.h>
char
b_bss
[
10
];
void
test_my_safe_print_str
()
{
char
b_stack
[
10
];
char
*
b_heap
=
strdup
(
"LEGAL"
);
memcpy
(
b_stack
,
"LEGAL"
,
6
);
memcpy
(
b_bss
,
"LEGAL"
,
6
);
#ifndef __SANITIZE_ADDRESS__
fprintf
(
stderr
,
"
\n
===== stack =====
\n
"
);
my_safe_print_str
(
b_stack
,
65535
);
fprintf
(
stderr
,
"
\n
===== heap =====
\n
"
);
my_safe_print_str
(
b_heap
,
65535
);
fprintf
(
stderr
,
"
\n
===== BSS =====
\n
"
);
my_safe_print_str
(
b_bss
,
65535
);
fprintf
(
stderr
,
"
\n
===== data =====
\n
"
);
my_safe_print_str
(
"LEGAL"
,
65535
);
fprintf
(
stderr
,
"
\n
===== Above is a junk, but it is expected. =====
\n
"
);
#endif
/*__SANITIZE_ADDRESS__*/
fprintf
(
stderr
,
"
\n
===== Nornal length test =====
\n
"
);
my_safe_print_str
(
"LEGAL"
,
5
);
fprintf
(
stderr
,
"
\n
===== NULL =====
\n
"
);
my_safe_print_str
(
0
,
5
);
#ifndef __SANITIZE_ADDRESS__
fprintf
(
stderr
,
"
\n
===== (const char*) 1 =====
\n
"
);
my_safe_print_str
((
const
char
*
)
1
,
5
);
#endif
/*__SANITIZE_ADDRESS__*/
free
(
b_heap
);
ok
(
1
,
"test_my_safe_print_str"
);
}
int
main
(
int
argc
__attribute__
((
unused
)),
char
**
argv
)
{
MY_INIT
(
argv
[
0
]);
plan
(
1
);
test_my_safe_print_str
();
my_end
(
0
);
return
exit_status
();
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment