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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
b1d951d4
Commit
b1d951d4
authored
Nov 23, 2005
by
konstantin@mysql.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Always initialize THD::thread_stack: it's used in
check_stack_overrun().
parent
83d692da
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
17 additions
and
2 deletions
+17
-2
sql/slave.cc
sql/slave.cc
+1
-1
sql/sql_acl.cc
sql/sql_acl.cc
+2
-0
sql/sql_class.cc
sql/sql_class.cc
+6
-0
sql/sql_insert.cc
sql/sql_insert.cc
+1
-0
sql/sql_parse.cc
sql/sql_parse.cc
+5
-1
sql/sql_udf.cc
sql/sql_udf.cc
+1
-0
sql/tztime.cc
sql/tztime.cc
+1
-0
No files found.
sql/slave.cc
View file @
b1d951d4
...
@@ -3446,6 +3446,7 @@ slave_begin:
...
@@ -3446,6 +3446,7 @@ slave_begin:
THD_CHECK_SENTRY
(
thd
);
THD_CHECK_SENTRY
(
thd
);
pthread_detach_this_thread
();
pthread_detach_this_thread
();
thd
->
thread_stack
=
(
char
*
)
&
thd
;
// remember where our stack is
if
(
init_slave_thread
(
thd
,
SLAVE_THD_IO
))
if
(
init_slave_thread
(
thd
,
SLAVE_THD_IO
))
{
{
pthread_cond_broadcast
(
&
mi
->
start_cond
);
pthread_cond_broadcast
(
&
mi
->
start_cond
);
...
@@ -3454,7 +3455,6 @@ slave_begin:
...
@@ -3454,7 +3455,6 @@ slave_begin:
goto
err
;
goto
err
;
}
}
mi
->
io_thd
=
thd
;
mi
->
io_thd
=
thd
;
thd
->
thread_stack
=
(
char
*
)
&
thd
;
// remember where our stack is
pthread_mutex_lock
(
&
LOCK_thread_count
);
pthread_mutex_lock
(
&
LOCK_thread_count
);
threads
.
append
(
thd
);
threads
.
append
(
thd
);
pthread_mutex_unlock
(
&
LOCK_thread_count
);
pthread_mutex_unlock
(
&
LOCK_thread_count
);
...
...
sql/sql_acl.cc
View file @
b1d951d4
...
@@ -158,6 +158,7 @@ my_bool acl_init(bool dont_read_acl_tables)
...
@@ -158,6 +158,7 @@ my_bool acl_init(bool dont_read_acl_tables)
*/
*/
if
(
!
(
thd
=
new
THD
))
if
(
!
(
thd
=
new
THD
))
DBUG_RETURN
(
1
);
/* purecov: inspected */
DBUG_RETURN
(
1
);
/* purecov: inspected */
thd
->
thread_stack
=
(
char
*
)
&
thd
;
thd
->
store_globals
();
thd
->
store_globals
();
/*
/*
It is safe to call acl_reload() since acl_* arrays and hashes which
It is safe to call acl_reload() since acl_* arrays and hashes which
...
@@ -3263,6 +3264,7 @@ my_bool grant_init()
...
@@ -3263,6 +3264,7 @@ my_bool grant_init()
if
(
!
(
thd
=
new
THD
))
if
(
!
(
thd
=
new
THD
))
DBUG_RETURN
(
1
);
/* purecov: deadcode */
DBUG_RETURN
(
1
);
/* purecov: deadcode */
thd
->
thread_stack
=
(
char
*
)
&
thd
;
thd
->
store_globals
();
thd
->
store_globals
();
return_val
=
grant_reload
(
thd
);
return_val
=
grant_reload
(
thd
);
delete
thd
;
delete
thd
;
...
...
sql/sql_class.cc
View file @
b1d951d4
...
@@ -517,6 +517,12 @@ void THD::awake(THD::killed_state state_to_set)
...
@@ -517,6 +517,12 @@ void THD::awake(THD::killed_state state_to_set)
bool
THD
::
store_globals
()
bool
THD
::
store_globals
()
{
{
/*
Assert that thread_stack is initialized: it's necessary to be able
to track stack overrun.
*/
DBUG_ASSERT
(
this
->
thread_stack
);
if
(
my_pthread_setspecific_ptr
(
THR_THD
,
this
)
||
if
(
my_pthread_setspecific_ptr
(
THR_THD
,
this
)
||
my_pthread_setspecific_ptr
(
THR_MALLOC
,
&
mem_root
))
my_pthread_setspecific_ptr
(
THR_MALLOC
,
&
mem_root
))
return
1
;
return
1
;
...
...
sql/sql_insert.cc
View file @
b1d951d4
...
@@ -1723,6 +1723,7 @@ pthread_handler_t handle_delayed_insert(void *arg)
...
@@ -1723,6 +1723,7 @@ pthread_handler_t handle_delayed_insert(void *arg)
#endif
#endif
DBUG_ENTER
(
"handle_delayed_insert"
);
DBUG_ENTER
(
"handle_delayed_insert"
);
thd
->
thread_stack
=
(
char
*
)
&
thd
;
if
(
init_thr_lock
()
||
thd
->
store_globals
())
if
(
init_thr_lock
()
||
thd
->
store_globals
())
{
{
thd
->
fatal_error
();
thd
->
fatal_error
();
...
...
sql/sql_parse.cc
View file @
b1d951d4
...
@@ -1097,6 +1097,7 @@ pthread_handler_t handle_one_connection(void *arg)
...
@@ -1097,6 +1097,7 @@ pthread_handler_t handle_one_connection(void *arg)
VOID
(
sigemptyset
(
&
set
));
// Get mask in use
VOID
(
sigemptyset
(
&
set
));
// Get mask in use
VOID
(
pthread_sigmask
(
SIG_UNBLOCK
,
&
set
,
&
thd
->
block_signals
));
VOID
(
pthread_sigmask
(
SIG_UNBLOCK
,
&
set
,
&
thd
->
block_signals
));
#endif
#endif
thd
->
thread_stack
=
(
char
*
)
&
thd
;
if
(
thd
->
store_globals
())
if
(
thd
->
store_globals
())
{
{
close_connection
(
thd
,
ER_OUT_OF_RESOURCES
,
1
);
close_connection
(
thd
,
ER_OUT_OF_RESOURCES
,
1
);
...
@@ -1110,7 +1111,6 @@ pthread_handler_t handle_one_connection(void *arg)
...
@@ -1110,7 +1111,6 @@ pthread_handler_t handle_one_connection(void *arg)
int
error
;
int
error
;
NET
*
net
=
&
thd
->
net
;
NET
*
net
=
&
thd
->
net
;
Security_context
*
sctx
=
thd
->
security_ctx
;
Security_context
*
sctx
=
thd
->
security_ctx
;
thd
->
thread_stack
=
(
char
*
)
&
thd
;
net
->
no_send_error
=
0
;
net
->
no_send_error
=
0
;
if
((
error
=
check_connection
(
thd
)))
if
((
error
=
check_connection
(
thd
)))
...
@@ -5288,6 +5288,7 @@ bool check_stack_overrun(THD *thd, long margin,
...
@@ -5288,6 +5288,7 @@ bool check_stack_overrun(THD *thd, long margin,
char
*
buf
__attribute__
((
unused
)))
char
*
buf
__attribute__
((
unused
)))
{
{
long
stack_used
;
long
stack_used
;
DBUG_ASSERT
(
thd
==
current_thd
);
if
((
stack_used
=
used_stack
(
thd
->
thread_stack
,(
char
*
)
&
stack_used
))
>=
if
((
stack_used
=
used_stack
(
thd
->
thread_stack
,(
char
*
)
&
stack_used
))
>=
(
long
)
(
thread_stack
-
margin
))
(
long
)
(
thread_stack
-
margin
))
{
{
...
@@ -6737,7 +6738,10 @@ bool reload_acl_and_cache(THD *thd, ulong options, TABLE_LIST *tables,
...
@@ -6737,7 +6738,10 @@ bool reload_acl_and_cache(THD *thd, ulong options, TABLE_LIST *tables,
allocate temporary THD for execution of acl_reload()/grant_reload().
allocate temporary THD for execution of acl_reload()/grant_reload().
*/
*/
if
(
!
thd
&&
(
thd
=
(
tmp_thd
=
new
THD
)))
if
(
!
thd
&&
(
thd
=
(
tmp_thd
=
new
THD
)))
{
thd
->
thread_stack
=
(
char
*
)
&
tmp_thd
;
thd
->
store_globals
();
thd
->
store_globals
();
}
if
(
thd
)
if
(
thd
)
{
{
(
void
)
acl_reload
(
thd
);
(
void
)
acl_reload
(
thd
);
...
...
sql/sql_udf.cc
View file @
b1d951d4
...
@@ -159,6 +159,7 @@ void udf_init()
...
@@ -159,6 +159,7 @@ void udf_init()
DBUG_VOID_RETURN
;
DBUG_VOID_RETURN
;
}
}
initialized
=
1
;
initialized
=
1
;
new_thd
->
thread_stack
=
(
char
*
)
&
new_thd
;
new_thd
->
store_globals
();
new_thd
->
store_globals
();
new_thd
->
db
=
my_strdup
(
"mysql"
,
MYF
(
0
));
new_thd
->
db
=
my_strdup
(
"mysql"
,
MYF
(
0
));
new_thd
->
db_length
=
5
;
new_thd
->
db_length
=
5
;
...
...
sql/tztime.cc
View file @
b1d951d4
...
@@ -1532,6 +1532,7 @@ my_tz_init(THD *org_thd, const char *default_tzname, my_bool bootstrap)
...
@@ -1532,6 +1532,7 @@ my_tz_init(THD *org_thd, const char *default_tzname, my_bool bootstrap)
*/
*/
if
(
!
(
thd
=
new
THD
))
if
(
!
(
thd
=
new
THD
))
DBUG_RETURN
(
1
);
DBUG_RETURN
(
1
);
thd
->
thread_stack
=
(
char
*
)
&
thd
;
thd
->
store_globals
();
thd
->
store_globals
();
/* Init all memory structures that require explicit destruction */
/* Init all memory structures that require explicit destruction */
...
...
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