Skip to content

Commit

Permalink
Merge branch 'bb-10.0-serg' into 10.0
Browse files Browse the repository at this point in the history
  • Loading branch information
vuvova committed Feb 17, 2016
2 parents 09b5865 + 3eb8b11 commit a4b2714
Show file tree
Hide file tree
Showing 202 changed files with 6,508 additions and 3,663 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@ include/mysql_version.h
include/mysqld_ername.h
include/mysqld_error.h
include/sql_state.h
include/probes_mysql.d
include/probes_mysql_dtrace.h
include/probes_mysql_nodtrace.h
info_macros.cmake
libmysql*/libmysql*_exports_file.cc
libmysql*/merge_archives_mysql*.cmake
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
MYSQL_VERSION_MAJOR=10
MYSQL_VERSION_MINOR=0
MYSQL_VERSION_PATCH=23
MYSQL_VERSION_PATCH=24
4 changes: 2 additions & 2 deletions client/mysql_upgrade.c
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,8 @@ static const char *load_default_groups[]=
static void free_used_memory(void)
{
/* Free memory allocated by 'load_defaults' */
free_defaults(defaults_argv);
if (defaults_argv)
free_defaults(defaults_argv);

dynstr_free(&ds_args);
dynstr_free(&conn_args);
Expand Down Expand Up @@ -1096,7 +1097,6 @@ int main(int argc, char **argv)
if (opt_systables_only && !opt_silent)
printf("The --upgrade-system-tables option was used, user tables won't be touched.\n");


/*
Read the mysql_upgrade_info file to check if mysql_upgrade
already has been run for this installation of MySQL
Expand Down
3 changes: 3 additions & 0 deletions cmake/dtrace.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,9 @@ IF(ENABLE_DTRACE)
${CMAKE_BINARY_DIR}/include/probes_mysql_dtrace.h
${CMAKE_BINARY_DIR}/include/probes_mysql_nodtrace.h
)
ELSE()
CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/include/probes_mysql_nodtrace.h.in
${CMAKE_BINARY_DIR}/include/probes_mysql_nodtrace.h COPYONLY)
ENDIF()

FUNCTION(DTRACE_INSTRUMENT target)
Expand Down
18 changes: 11 additions & 7 deletions cmake/jemalloc.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,22 @@ MACRO (CHECK_JEMALLOC)
SET(CMAKE_REQUIRED_LIBRARIES pthread dl m)
SET(what bundled)
ELSE()
SET(libname jemalloc)
SET(libname jemalloc c)
SET(what system)
ENDIF()

CHECK_LIBRARY_EXISTS(${libname} malloc_stats_print "" HAVE_JEMALLOC)
FOREACH(lib ${libname})
CHECK_LIBRARY_EXISTS(${lib} malloc_stats_print "" HAVE_JEMALLOC_IN_${lib})
IF (HAVE_JEMALLOC_IN_${lib})
SET(LIBJEMALLOC ${lib})
SET(MALLOC_LIBRARY "${what} jemalloc")
BREAK()
ENDIF()
ENDFOREACH()
SET(CMAKE_REQUIRED_LIBRARIES)

IF (HAVE_JEMALLOC)
SET(LIBJEMALLOC ${libname})
SET(MALLOC_LIBRARY "${what} jemalloc")
ELSEIF (NOT WITH_JEMALLOC STREQUAL "auto")
MESSAGE(FATAL_ERROR "${libname} is not found")
IF (NOT LIBJEMALLOC AND NOT WITH_JEMALLOC STREQUAL "auto")
MESSAGE(FATAL_ERROR "jemalloc is not found")
ENDIF()
ENDIF()
ENDMACRO()
2 changes: 1 addition & 1 deletion cmake/plugin.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ MACRO(MYSQL_ADD_PLUGIN)

SET(WITH_${plugin} 1)
ELSEIF(WITHOUT_${plugin} OR WITHOUT_${plugin}_STORAGE_ENGINE OR
WITH_NONE OR ${plugin}_DISABLED)
WITH_NONE OR ARG_DISABLED)
SET(WITHOUT_${plugin} 1)
SET(WITH_${plugin}_STORAGE_ENGINE 0)
SET(WITH_${plugin} 0)
Expand Down
26 changes: 23 additions & 3 deletions configure.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -790,16 +790,36 @@ ENDIF()
#
# Test for how the C compiler does inline, if at all
#
# SunPro is weird, apparently it only supports inline at -xO3 or -xO4.
# And if CMAKE_C_FLAGS has -xO4 but CMAKE_C_FLAGS_${CMAKE_BUILD_TYPE} has -xO2
# then CHECK_C_SOURCE_COMPILES will succeed but the built will fail.
# We must test all flags here.
# XXX actually, we can do this for all compilers, not only SunPro
IF (CMAKE_CXX_COMPILER_ID MATCHES "SunPro" AND
CMAKE_GENERATOR MATCHES "Makefiles")
STRING(TOUPPER "CMAKE_C_FLAGS_${CMAKE_BUILD_TYPE}" flags)
SET(CMAKE_REQUIRED_FLAGS "${${flags}}")
ENDIF()
CHECK_C_SOURCE_COMPILES("
static inline int foo(){return 0;}
extern int bar(int x);
static inline int foo(){return bar(1);}
int main(int argc, char *argv[]){return 0;}"
C_HAS_inline)
IF(NOT C_HAS_inline)
CHECK_C_SOURCE_COMPILES("
static __inline int foo(){return 0;}
extern int bar(int x);
static __inline int foo(){return bar(1);}
int main(int argc, char *argv[]){return 0;}"
C_HAS___inline)
SET(C_INLINE __inline)
IF(C_HAS___inline)
SET(C_INLINE __inline)
ElSE()
SET(C_INLINE)
MESSAGE(WARNING "C compiler does not support funcion inlining")
IF(NOT NOINLINE)
MESSAGE(FATAL_ERROR "Use -DNOINLINE=TRUE to allow compilation without inlining")
ENDIF()
ENDIF()
ENDIF()

IF(NOT CMAKE_CROSSCOMPILING AND NOT MSVC)
Expand Down
11 changes: 11 additions & 0 deletions extra/yassl/README
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,17 @@ before calling SSL_new();

*** end Note ***

yaSSL Release notes, version 2.3.9 (12/01/2015)
This release of yaSSL fixes two client side Diffie-Hellman problems.
yaSSL was only handling the cases of zero or one leading zeros for the key
agreement instead of potentially any number. This caused about 1 in 50,000
connections to fail when using DHE cipher suites. The second problem was
the case where a server would send a public value shorter than the prime
value, causing about 1 in 128 client connections to fail, and also
caused the yaSSL client to read off the end of memory. All client side
DHE cipher suite users should update.
Thanks to Adam Langely ([email protected]) for the detailed report!

yaSSL Release notes, version 2.3.8 (9/17/2015)
This release of yaSSL fixes a high security vulnerability. All users
SHOULD update. If using yaSSL for TLS on the server side with private
Expand Down
1 change: 1 addition & 0 deletions extra/yassl/include/crypto_wrapper.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,7 @@ class DiffieHellman {

uint get_agreedKeyLength() const;
const byte* get_agreedKey() const;
uint get_publicKeyLength() const;
const byte* get_publicKey() const;
void makeAgreement(const byte*, unsigned int);

Expand Down
2 changes: 1 addition & 1 deletion extra/yassl/include/openssl/ssl.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
#include "rsa.h"


#define YASSL_VERSION "2.3.8"
#define YASSL_VERSION "2.3.9"


#if defined(__cplusplus)
Expand Down
11 changes: 8 additions & 3 deletions extra/yassl/src/crypto_wrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -751,9 +751,10 @@ struct DiffieHellman::DHImpl {
byte* publicKey_;
byte* privateKey_;
byte* agreedKey_;
uint pubKeyLength_;

DHImpl(TaoCrypt::RandomNumberGenerator& r) : ranPool_(r), publicKey_(0),
privateKey_(0), agreedKey_(0) {}
privateKey_(0), agreedKey_(0), pubKeyLength_(0) {}
~DHImpl()
{
ysArrayDelete(agreedKey_);
Expand All @@ -762,7 +763,7 @@ struct DiffieHellman::DHImpl {
}

DHImpl(const DHImpl& that) : dh_(that.dh_), ranPool_(that.ranPool_),
publicKey_(0), privateKey_(0), agreedKey_(0)
publicKey_(0), privateKey_(0), agreedKey_(0), pubKeyLength_(0)
{
uint length = dh_.GetByteLength();
AllocKeys(length, length, length);
Expand Down Expand Up @@ -810,7 +811,7 @@ DiffieHellman::DiffieHellman(const byte* p, unsigned int pSz, const byte* g,
using TaoCrypt::Integer;

pimpl_->dh_.Initialize(Integer(p, pSz).Ref(), Integer(g, gSz).Ref());
pimpl_->publicKey_ = NEW_YS opaque[pubSz];
pimpl_->publicKey_ = NEW_YS opaque[pimpl_->pubKeyLength_ = pubSz];
memcpy(pimpl_->publicKey_, pub, pubSz);
}

Expand Down Expand Up @@ -869,6 +870,10 @@ const byte* DiffieHellman::get_agreedKey() const
return pimpl_->agreedKey_;
}

uint DiffieHellman::get_publicKeyLength() const
{
return pimpl_->pubKeyLength_;
}

const byte* DiffieHellman::get_publicKey() const
{
Expand Down
15 changes: 4 additions & 11 deletions extra/yassl/src/yassl_imp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,15 +109,12 @@ void ClientDiffieHellmanPublic::build(SSL& ssl)
uint keyLength = dhClient.get_agreedKeyLength(); // pub and agree same

alloc(keyLength, true);
dhClient.makeAgreement(dhServer.get_publicKey(), keyLength);
dhClient.makeAgreement(dhServer.get_publicKey(),
dhServer.get_publicKeyLength());
c16toa(keyLength, Yc_);
memcpy(Yc_ + KEY_OFFSET, dhClient.get_publicKey(), keyLength);

// because of encoding first byte might be zero, don't use it for preMaster
if (*dhClient.get_agreedKey() == 0)
ssl.set_preMaster(dhClient.get_agreedKey() + 1, keyLength - 1);
else
ssl.set_preMaster(dhClient.get_agreedKey(), keyLength);
ssl.set_preMaster(dhClient.get_agreedKey(), keyLength);
}


Expand Down Expand Up @@ -321,11 +318,7 @@ void ClientDiffieHellmanPublic::read(SSL& ssl, input_buffer& input)
}
dh.makeAgreement(Yc_, keyLength);

// because of encoding, first byte might be 0, don't use for preMaster
if (*dh.get_agreedKey() == 0)
ssl.set_preMaster(dh.get_agreedKey() + 1, dh.get_agreedKeyLength() - 1);
else
ssl.set_preMaster(dh.get_agreedKey(), dh.get_agreedKeyLength());
ssl.set_preMaster(dh.get_agreedKey(), dh.get_agreedKeyLength());
ssl.makeMasterSecret();
}

Expand Down
15 changes: 15 additions & 0 deletions extra/yassl/src/yassl_int.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -807,6 +807,19 @@ void SSL::set_random(const opaque* random, ConnectionEnd sender)
// store client pre master secret
void SSL::set_preMaster(const opaque* pre, uint sz)
{
uint i(0); // trim leading zeros
uint fullSz(sz);

while (i++ < fullSz && *pre == 0) {
sz--;
pre++;
}

if (sz == 0) {
SetError(bad_input);
return;
}

secure_.use_connection().AllocPreSecret(sz);
memcpy(secure_.use_connection().pre_master_secret_, pre, sz);
}
Expand Down Expand Up @@ -924,6 +937,8 @@ void SSL::order_error()
// Create and store the master secret see page 32, 6.1
void SSL::makeMasterSecret()
{
if (GetError()) return;

if (isTLS())
makeTLSMasterSecret();
else {
Expand Down
19 changes: 4 additions & 15 deletions include/my_global.h
Original file line number Diff line number Diff line change
Expand Up @@ -200,20 +200,6 @@
#define likely(x) __builtin_expect(((x) != 0),1)
#define unlikely(x) __builtin_expect(((x) != 0),0)

/*
now let's figure out if inline functions are supported
autoconf defines 'inline' to be empty, if not
*/
#define inline_test_1(X) X ## 1
#define inline_test_2(X) inline_test_1(X)
#if inline_test_2(inline) != 1
#define HAVE_INLINE
#else
#error Compiler does not support inline!
#endif
#undef inline_test_2
#undef inline_test_1

/* Fix problem with S_ISLNK() on Linux */
#if defined(TARGET_OS_LINUX) || defined(__GLIBC__)
#undef _GNU_SOURCE
Expand Down Expand Up @@ -454,7 +440,7 @@ extern "C" int madvise(void *addr, size_t len, int behav);
#endif

#ifndef STDERR_FILENO
#define STDERR_FILENO 2
#define STDERR_FILENO fileno(stderr)
#endif

/*
Expand Down Expand Up @@ -827,6 +813,9 @@ inline unsigned long long my_double2ulonglong(double d)
#else
#define finite(x) (1.0 / fabs(x) > 0.0)
#endif /* HAVE_FINITE */
#elif (__cplusplus >= 201103L)
#include <cmath>
static inline bool isfinite(double x) { return std::isfinite(x); }
#endif /* isfinite */

#ifndef HAVE_ISNAN
Expand Down
File renamed without changes.
6 changes: 3 additions & 3 deletions include/welcome_copyright_notice.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* Copyright (c) 2011, 2015, Oracle and/or its affiliates.
Copyright (c) 2011, 2015, MariaDB
/* Copyright (c) 2011, 2016, Oracle and/or its affiliates.
Copyright (c) 2011, 2016, MariaDB
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
Expand All @@ -17,7 +17,7 @@
#ifndef _welcome_copyright_notice_h_
#define _welcome_copyright_notice_h_

#define COPYRIGHT_NOTICE_CURRENT_YEAR "2015"
#define COPYRIGHT_NOTICE_CURRENT_YEAR "2016"

/*
This define specifies copyright notice which is displayed by every MySQL
Expand Down
1 change: 1 addition & 0 deletions mysql-test/lib/mtr_cases.pm
Original file line number Diff line number Diff line change
Expand Up @@ -498,6 +498,7 @@ sub process_suite {

# disabled.def
parse_disabled($suite->{dir} .'/disabled.def', $suitename);
parse_disabled($suite->{dir} .'/t/disabled.def', $suitename);

# combinations
if (@::opt_combinations)
Expand Down
16 changes: 16 additions & 0 deletions mysql-test/r/create.result
Original file line number Diff line number Diff line change
Expand Up @@ -2662,5 +2662,21 @@ Warnings:
Note 1291 Column 'a' has duplicated value '' in ENUM
drop table t1;
set @@session.collation_server=default;
#
# MDEV-7765: Crash (Assertion `!table || (!table->write_set ||
# bitmap_is_set(table->write_set, field_index) ||
# bitmap_is_set(table->vcol_set, field_index))' fails)
# on using function over not created table
#
CREATE function f1() returns int
BEGIN
declare n int;
set n:= (select count(*) from t1);
return n;
end|
create table t1 as select f1();
ERROR 42S02: Table 'test.t1' doesn't exist
drop function f1;
End of 5.5 tests
create table t1;
ERROR 42000: A table must have at least 1 column
7 changes: 4 additions & 3 deletions mysql-test/r/ctype_utf8.result
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ hex(a) STRCMP(a,'a') STRCMP(a,'a ')
DROP TABLE t1;
select insert('txs',2,1,'hi'),insert('is ',4,0,'a'),insert('txxxxt',2,4,'es');
insert('txs',2,1,'hi') insert('is ',4,0,'a') insert('txxxxt',2,4,'es')
this is a test
this is test
select insert("aa",100,1,"b"),insert("aa",1,3,"b");
insert("aa",100,1,"b") insert("aa",1,3,"b")
aa b
Expand Down Expand Up @@ -5370,9 +5370,10 @@ SET sql_mode=default;
SET NAMES utf8;
CREATE TABLE t1 (a INT);
INSERT INTO t1 VALUES (0), (0), (1), (0), (0);
SELECT COUNT(*) FROM t1, t1 t2
SELECT COUNT(*) FROM t1, t1 t2
GROUP BY INSERT('', t2.a, t1.a, (@@global.max_binlog_size));
ERROR 23000: Duplicate entry '107374182410737418241' for key 'group_key'
COUNT(*)
25
DROP TABLE t1;
#
# Bug#11764503 (Bug#57341) Query in EXPLAIN EXTENDED shows wrong characters
Expand Down
2 changes: 1 addition & 1 deletion mysql-test/r/ctype_utf8mb4.result
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ hex(a) STRCMP(a,'a') STRCMP(a,'a ')
DROP TABLE t1;
select insert('txs',2,1,'hi'),insert('is ',4,0,'a'),insert('txxxxt',2,4,'es');
insert('txs',2,1,'hi') insert('is ',4,0,'a') insert('txxxxt',2,4,'es')
this is a test
this is test
select insert("aa",100,1,"b"),insert("aa",1,3,"b");
insert("aa",100,1,"b") insert("aa",1,3,"b")
aa b
Expand Down
2 changes: 1 addition & 1 deletion mysql-test/r/ctype_utf8mb4_heap.result
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ hex(a) STRCMP(a,'a') STRCMP(a,'a ')
DROP TABLE t1;
select insert('txs',2,1,'hi'),insert('is ',4,0,'a'),insert('txxxxt',2,4,'es');
insert('txs',2,1,'hi') insert('is ',4,0,'a') insert('txxxxt',2,4,'es')
this is a test
this is test
select insert("aa",100,1,"b"),insert("aa",1,3,"b");
insert("aa",100,1,"b") insert("aa",1,3,"b")
aa b
Expand Down
2 changes: 1 addition & 1 deletion mysql-test/r/ctype_utf8mb4_innodb.result
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ hex(a) STRCMP(a,'a') STRCMP(a,'a ')
DROP TABLE t1;
select insert('txs',2,1,'hi'),insert('is ',4,0,'a'),insert('txxxxt',2,4,'es');
insert('txs',2,1,'hi') insert('is ',4,0,'a') insert('txxxxt',2,4,'es')
this is a test
this is test
select insert("aa",100,1,"b"),insert("aa",1,3,"b");
insert("aa",100,1,"b") insert("aa",1,3,"b")
aa b
Expand Down
Loading

0 comments on commit a4b2714

Please sign in to comment.