Commit 6ae8c575 authored by Marko Mäkelä's avatar Marko Mäkelä

Bug#59307 Valgrind: uninitialized value in rw_lock_set_writer_id_and_recursion_flag()

rw_lock_create_func(): Initialize lock->writer_thread, so that Valgrind
will not complain even when Valgrind instrumentation is not enabled.
Flag lock->writer_thread uninitialized, so that Valgrind can complain
when it is used uninitialized.

rw_lock_set_writer_id_and_recursion_flag(): Revert the bogus Valgrind
instrumentation that was pushed in the first attempt to fix this bug.
parent d06bb27f
CREATE TABLE t1 (
t1_int INT,
t1_time TIME
) ENGINE=innodb;
CREATE TABLE t2 (
t2_int int PRIMARY KEY,
t2_int2 INT
) ENGINE=INNODB;
INSERT INTO t2 VALUES ();
Warnings:
Warning 1364 Field 't2_int' doesn't have a default value
INSERT INTO t1 VALUES ();
SELECT *
FROM t1 AS t1a
WHERE NOT EXISTS
(SELECT *
FROM t1 AS t1b
WHERE t1b.t1_int NOT IN
(SELECT t2.t2_int
FROM t2
WHERE t1b.t1_time LIKE t1b.t1_int
OR t1b.t1_time <> t2.t2_int2
AND 6=7
)
)
;
t1_int t1_time
DROP TABLE t1,t2;
-- source include/have_innodb_plugin.inc
# Bug #59307 uninitialized value in rw_lock_set_writer_id_and_recursion_flag()
# when Valgrind instrumentation (UNIV_DEBUG_VALGRIND) is not enabled
CREATE TABLE t1 (
t1_int INT,
t1_time TIME
) ENGINE=innodb;
CREATE TABLE t2 (
t2_int int PRIMARY KEY,
t2_int2 INT
) ENGINE=INNODB;
INSERT INTO t2 VALUES ();
INSERT INTO t1 VALUES ();
SELECT *
FROM t1 AS t1a
WHERE NOT EXISTS
(SELECT *
FROM t1 AS t1b
WHERE t1b.t1_int NOT IN
(SELECT t2.t2_int
FROM t2
WHERE t1b.t1_time LIKE t1b.t1_int
OR t1b.t1_time <> t2.t2_int2
AND 6=7
)
)
;
DROP TABLE t1,t2;
2011-02-15 The InnoDB Team
* sync/sync0rw.c, innodb_bug59307.test:
Bug#59307 Valgrind: uninitialized value in
rw_lock_set_writer_id_and_recursion_flag()
2011-02-14 The InnoDB Team 2011-02-14 The InnoDB Team
* handler/handler0alter.cc: * handler/handler0alter.cc:
......
...@@ -280,7 +280,6 @@ rw_lock_set_writer_id_and_recursion_flag( ...@@ -280,7 +280,6 @@ rw_lock_set_writer_id_and_recursion_flag(
local_thread = lock->writer_thread; local_thread = lock->writer_thread;
success = os_compare_and_swap_thread_id( success = os_compare_and_swap_thread_id(
&lock->writer_thread, local_thread, curr_thread); &lock->writer_thread, local_thread, curr_thread);
UNIV_MEM_VALID(&success, sizeof(success));
ut_a(success); ut_a(success);
lock->recursive = recursive; lock->recursive = recursive;
......
...@@ -260,6 +260,9 @@ rw_lock_create_func( ...@@ -260,6 +260,9 @@ rw_lock_create_func(
contains garbage at initialization and cannot be used for contains garbage at initialization and cannot be used for
recursive x-locking. */ recursive x-locking. */
lock->recursive = FALSE; lock->recursive = FALSE;
/* Silence Valgrind when UNIV_DEBUG_VALGRIND is not enabled. */
memset((void*) &lock->writer_thread, 0, sizeof lock->writer_thread);
UNIV_MEM_INVALID(&lock->writer_thread, sizeof lock->writer_thread);
#ifdef UNIV_SYNC_DEBUG #ifdef UNIV_SYNC_DEBUG
UT_LIST_INIT(lock->debug_list); UT_LIST_INIT(lock->debug_list);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment