Skip to content

Commit 2584762

Browse files
committed
Merge branch 'mysql-8.0' into mysql-trunk
Change-Id: Ia8239440d583500f67107745d8cb721c722c4112
2 parents ebffbc0 + 9cb1b99 commit 2584762

File tree

4 files changed

+12
-35
lines changed

4 files changed

+12
-35
lines changed

sql/auth/sha2_password.cc

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -936,11 +936,6 @@ static int caching_sha2_password_authenticate(MYSQL_PLUGIN_VIO *vio,
936936
RSA *public_key = nullptr;
937937
#endif /* OPENSSL_VERSION_NUMBER >= 0x30000000L */
938938

939-
DBUG_EXECUTE_IF("in_caching_sha2_password_authenticate", {
940-
DBUG_SET("+d,wait_until_thread_kill");
941-
const char act[] = "now SIGNAL acl_auth_reached";
942-
assert(!debug_sync_set_action(current_thd, STRING_WITH_LEN(act)));
943-
});
944939
generate_user_salt(scramble, SCRAMBLE_LENGTH + 1);
945940

946941
/*

sql/auth/sql_authentication.cc

Lines changed: 9 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -3833,14 +3833,6 @@ int acl_authenticate(THD *thd, enum_server_command command) {
38333833
static_assert(MYSQL_USERNAME_LENGTH == USERNAME_LENGTH, "");
38343834
assert(command == COM_CONNECT || command == COM_CHANGE_USER);
38353835

3836-
mysql_mutex_lock(&thd->LOCK_thd_data);
3837-
3838-
DBUG_EXECUTE_IF("before_server_mpvio_initialize", {
3839-
DBUG_SET("+d,wait_until_thread_kill");
3840-
const char act[] = "now SIGNAL acl_auth_reached";
3841-
assert(!debug_sync_set_action(current_thd, STRING_WITH_LEN(act)));
3842-
});
3843-
38443836
server_mpvio_initialize(thd, &mpvio, &charset_adapter);
38453837
/*
38463838
Clear thd->db as it points to something, that will be freed when
@@ -3867,7 +3859,6 @@ int acl_authenticate(THD *thd, enum_server_command command) {
38673859
mpvio.protocol->get_packet_length())) {
38683860
login_failed_error(thd, &mpvio, mpvio.auth_info.password_used);
38693861
server_mpvio_update_thd(thd, &mpvio);
3870-
mysql_mutex_unlock(&thd->LOCK_thd_data);
38713862
goto end;
38723863
}
38733864

@@ -3904,21 +3895,13 @@ int acl_authenticate(THD *thd, enum_server_command command) {
39043895
res = do_multi_factor_auth(thd, &mpvio);
39053896
}
39063897

3907-
DBUG_EXECUTE_IF("before_server_mpvio_update_thd", {
3908-
DBUG_SET("+d,wait_until_thread_kill");
3909-
const char act[] = "now SIGNAL acl_auth_reached";
3910-
assert(!debug_sync_set_action(current_thd, STRING_WITH_LEN(act)));
3911-
});
3912-
39133898
server_mpvio_update_thd(thd, &mpvio);
39143899

39153900
check_and_update_password_lock_state(mpvio, thd, res);
39163901
#ifdef HAVE_PSI_THREAD_INTERFACE
39173902
PSI_THREAD_CALL(set_connection_type)(thd->get_vio_type());
39183903
#endif /* HAVE_PSI_THREAD_INTERFACE */
39193904

3920-
mysql_mutex_unlock(&thd->LOCK_thd_data);
3921-
39223905
{
39233906
Security_context *sctx = thd->security_context();
39243907
const ACL_USER *acl_user = mpvio.acl_user;
@@ -4119,20 +4102,22 @@ int acl_authenticate(THD *thd, enum_server_command command) {
41194102
goto end;
41204103
}
41214104

4122-
mysql_mutex_lock(&thd->LOCK_thd_data);
41234105
DBUG_EXECUTE_IF("before_secure_transport_check", {
4124-
DBUG_SET("+d,wait_until_thread_kill");
4125-
const char act[] = "now SIGNAL acl_auth_reached";
4106+
const char act[] = "now SIGNAL kill_now WAIT_FOR killed";
41264107
assert(!debug_sync_set_action(current_thd, STRING_WITH_LEN(act)));
41274108
});
41284109

4129-
if (opt_require_secure_transport && thd->active_vio != nullptr &&
4130-
!is_secure_transport(thd->active_vio->type)) {
4131-
mysql_mutex_unlock(&thd->LOCK_thd_data);
4110+
/*
4111+
The assumption here is that thd->active_vio and thd->net.vio are both
4112+
the same at this point. We should not use thd->active_vio at any cost,
4113+
as a KILL command can shutdown the active_vio i.e., making it a nullptr
4114+
which would cause issues. Instead we check the net.vio type.
4115+
*/
4116+
if (opt_require_secure_transport && thd->get_net()->vio != nullptr &&
4117+
!is_secure_transport(thd->get_net()->vio->type)) {
41324118
my_error(ER_SECURE_TRANSPORT_REQUIRED, MYF(0));
41334119
goto end;
41344120
}
4135-
mysql_mutex_unlock(&thd->LOCK_thd_data);
41364121

41374122
/* checking password_time_expire for connecting user */
41384123
password_time_expired = check_password_lifetime(thd, mpvio.acl_user);
@@ -4215,11 +4200,6 @@ int acl_authenticate(THD *thd, enum_server_command command) {
42154200
goto end;
42164201
}
42174202

4218-
DBUG_EXECUTE_IF("wait_until_thread_kill", {
4219-
DBUG_SET("-d,wait_until_thread_kill");
4220-
const char act[] = "now WAIT_FOR killed";
4221-
assert(!debug_sync_set_action(current_thd, STRING_WITH_LEN(act)));
4222-
});
42234203
/*
42244204
This is the default access rights for the current database. It's
42254205
set to 0 here because we don't have an active database yet (and we

sql/sql_class.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1887,6 +1887,8 @@ class THD : public MDL_context_owner,
18871887
NET net; // client connection descriptor
18881888
String packet; // dynamic buffer for network I/O
18891889
public:
1890+
const NET *get_net() const { return &net; }
1891+
18901892
void set_skip_readonly_check() { skip_readonly_check = true; }
18911893

18921894
bool is_cmd_skip_readonly() const { return skip_readonly_check; }

sql/sql_parse.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2462,7 +2462,6 @@ bool dispatch_command(THD *thd, const COM_DATA *com_data,
24622462
thd->set_proc_info(nullptr);
24632463
thd->lex->sql_command = SQLCOM_END;
24642464

2465-
DEBUG_SYNC(thd, "processlist_wait");
24662465
/* Performance Schema Interface instrumentation, end */
24672466
MYSQL_END_STATEMENT(thd->m_statement_psi, thd->get_stmt_da());
24682467
thd->m_statement_psi = nullptr;
@@ -6395,6 +6394,7 @@ static uint kill_one_thread(THD *thd, my_thread_id id, bool only_kill_query) {
63956394

63966395
DBUG_TRACE;
63976396
DBUG_PRINT("enter", ("id=%u only_kill=%d", id, only_kill_query));
6397+
DEBUG_SYNC(thd, "kill_thd_begin");
63986398
THD_ptr tmp = Global_THD_manager::get_instance()->find_thd(&find_thd_with_id);
63996399
Security_context *sctx = thd->security_context();
64006400
if (tmp) {

0 commit comments

Comments
 (0)