summaryrefslogtreecommitdiff
path: root/sql/sys_vars.cc
diff options
context:
space:
mode:
authorJon Olav Hauglid <jon.hauglid@oracle.com>2015-01-22 14:19:56 +0100
committerJon Olav Hauglid <jon.hauglid@oracle.com>2015-01-23 10:17:09 +0100
commit7a408dbdf40930144c1bad654cb1e31e5ce5fc7a (patch)
tree154611a8df35f2325180540e15a5022e631ea870 /sql/sys_vars.cc
parent70f5d81a96ba38d690e907f5fd56760b9ee87803 (diff)
downloadmariadb-git-7a408dbdf40930144c1bad654cb1e31e5ce5fc7a.tar.gz
Bug#19770858: MYSQLD CAN BE DRIVEN TO OOM WITH TWO SIMPLE SESSION VARS
The problem was that the maximum value of the transaction_prealloc_size session system variable was ULONG_MAX which meant that it was possible to cause the server to allocate excessive amounts of memory. This patch fixes the problem by reducing the maxmimum value of transaction_prealloc_size and transaction_alloc_block_size down to 128K. Note that transactions will still be able to allocate more than 128K if needed, this patch just reduces the amount that can be preallocated - as well as the maximum size of the incremental allocation blocks.
Diffstat (limited to 'sql/sys_vars.cc')
-rw-r--r--sql/sys_vars.cc6
1 files changed, 3 insertions, 3 deletions
diff --git a/sql/sys_vars.cc b/sql/sys_vars.cc
index e826624b42f..d1c02cda20c 100644
--- a/sql/sys_vars.cc
+++ b/sql/sys_vars.cc
@@ -1,4 +1,4 @@
-/* Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved.
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
@@ -1836,7 +1836,7 @@ static Sys_var_ulong Sys_trans_alloc_block_size(
"transaction_alloc_block_size",
"Allocation block size for transactions to be stored in binary log",
SESSION_VAR(trans_alloc_block_size), CMD_LINE(REQUIRED_ARG),
- VALID_RANGE(1024, ULONG_MAX), DEFAULT(QUERY_ALLOC_BLOCK_SIZE),
+ VALID_RANGE(1024, 128 * 1024 * 1024), DEFAULT(QUERY_ALLOC_BLOCK_SIZE),
BLOCK_SIZE(1024), NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(0),
ON_UPDATE(fix_trans_mem_root));
@@ -1844,7 +1844,7 @@ static Sys_var_ulong Sys_trans_prealloc_size(
"transaction_prealloc_size",
"Persistent buffer for transactions to be stored in binary log",
SESSION_VAR(trans_prealloc_size), CMD_LINE(REQUIRED_ARG),
- VALID_RANGE(1024, ULONG_MAX), DEFAULT(TRANS_ALLOC_PREALLOC_SIZE),
+ VALID_RANGE(1024, 128 * 1024 * 1024), DEFAULT(TRANS_ALLOC_PREALLOC_SIZE),
BLOCK_SIZE(1024), NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(0),
ON_UPDATE(fix_trans_mem_root));