141 Commits

Author SHA1 Message Date
Angus Pearson
285bcac992 Add <strings.h> include to deps/hiredis/read.c to fix Implicit Declaration of strcasecmp warning 2019-05-08 11:36:31 +01:00
antirez
93dc3267ca RESP3: hiredis: implement bool type. 2019-01-09 17:00:30 +01:00
antirez
f97457cc23 RESP3: hiredis: save the original double string. 2019-01-09 17:00:30 +01:00
antirez
8d8dd89f1c RESP3: hiredis: implement null type. 2019-01-09 17:00:30 +01:00
antirez
193869c653 RESP3: hiredis: fix double implementation. 2019-01-09 17:00:30 +01:00
antirez
1ba5f3222d RESP3: hiredis: initial double implementation. 2019-01-09 17:00:30 +01:00
antirez
e2f2b355d5 RESP3: hiredis: fix hiredis.c assert for new types. 2019-01-09 17:00:29 +01:00
antirez
e3c3c6ce40 RESP3: hiredis: free map and set replies. 2019-01-09 17:00:29 +01:00
antirez
2543ce8ad8 RESP3: hiredis: fix read.c assert for new types. 2019-01-09 17:00:29 +01:00
antirez
facef39abd RESP3: hiredis updated with recent version + some RESP3 support. 2019-01-09 17:00:29 +01:00
Uman Shahzad
188b698989 Remove documentation about geohash-int in deps repo. 2019-01-03 19:12:45 +05:00
Oran Agra
36468e1c26 Active defrag fixes for 32bit builds (again)
* overflow in jemalloc fragmentation hint to the defragger
2018-07-11 16:09:00 +03:00
Jack Drogon
bae1d36e5d Fix typo 2018-07-03 18:19:46 +02:00
Oran Agra
ad7a05292e add defrag hint support into jemalloc 5 2018-06-27 10:52:39 +03:00
antirez
af9b47eca8 Security: fix Lua struct package offset handling.
After the first fix to the struct package I found another similar
problem, which is fixed by this patch. It could be reproduced easily by
running the following script:

    return struct.unpack('f', "xxxxxxxxxxxxx",-3)

The above will access bytes before the 'data' pointer.
2018-06-13 12:40:33 +02:00
antirez
dfa02e19db Security: more cmsgpack fixes by @soloestoy.
@soloestoy sent me this additional fixes, after searching for similar
problems to the one reported in mp_pack(). I'm committing the changes
because it was not possible during to make a public PR to protect Redis
users and give Redis providers some time to patch their systems.
2018-06-13 12:40:33 +02:00
antirez
f98aeb00c2 Security: update Lua struct package for security.
During an auditing Apple found that the "struct" Lua package
we ship with Redis (http://www.inf.puc-rio.br/~roberto/struct/) contains
a security problem. A bound-checking statement fails because of integer
overflow. The bug exists since we initially integrated this package with
Lua, when scripting was introduced, so every version of Redis with
EVAL/EVALSHA capabilities exposed is affected.

Instead of just fixing the bug, the library was updated to the latest
version shipped by the author.
2018-06-13 12:40:33 +02:00
antirez
cbd20a3028 Security: fix Lua cmsgpack library stack overflow.
During an auditing effort, the Apple Vulnerability Research team discovered
a critical Redis security issue affecting the Lua scripting part of Redis.

-- Description of the problem

Several years ago I merged a pull request including many small changes at
the Lua MsgPack library (that originally I authored myself). The Pull
Request entered Redis in commit d29c753f9, in 2014.
Unfortunately one of the changes included a variadic Lua function that
lacked the check for the available Lua C stack. As a result, calling the
"pack" MsgPack library function with a large number of arguments, results
into pushing into the Lua C stack a number of new values proportional to
the number of arguments the function was called with. The pushed values,
moreover, are controlled by untrusted user input.

This in turn causes stack smashing which we believe to be exploitable,
while not very deterministic, but it is likely that an exploit could be
created targeting specific versions of Redis executables. However at its
minimum the issue results in a DoS, crashing the Redis server.

-- Versions affected

Versions greater or equal to Redis 2.8.18 are affected.

-- Reproducing

Reproduce with this (based on the original reproduction script by
Apple security team):

https://gist.github.com/antirez/82445fcbea6d9b19f97014cc6cc79f8a

-- Verification of the fix

The fix was tested in the following way:

1) I checked that the problem is no longer observable running the trigger.
2) The Lua code was analyzed to understand the stack semantics, and that
actually enough stack is allocated in all the cases of mp_pack() calls.
3) The mp_pack() function was modified in order to show exactly what items
in the stack were being set, to make sure that there is no silent overflow
even after the fix.

-- Credits

Thank you to the Apple team and to the other persons that helped me
checking the patch and coordinating this communication.
2018-06-13 12:40:33 +02:00
antirez
6830220c90 Backport hiredis issue 525 fix to compile on FreeBSD.
Close #4947.
2018-05-25 16:33:23 +02:00
antirez
5b1a603cd3 Generate configure for Jemalloc. 2018-05-24 18:21:13 +02:00
antirez
5de964e147 Add --with-version in Jemalloc config script. 2018-05-24 17:50:12 +02:00
antirez
c2430f8571 Specify that Jemalloc configure requires version. 2018-05-24 17:49:36 +02:00
antirez
e3d1823414 Jemalloc upgraded to version 5.0.1. 2018-05-24 17:17:37 +02:00
antirez
9fba9c9701 Update documentation about how to upgrade Jemalloc. 2018-05-24 17:16:12 +02:00
Oran Agra
0bd6e341f5 Active defrag fixes for 32bit builds
problems fixed:
* failing to read fragmentation information from jemalloc
* overflow in jemalloc fragmentation hint to the defragger
* test suite not triggering eviction after population
2018-05-17 09:52:00 +03:00
antirez
412b1733e2 Revert "Jemalloc updated to 4.4.0."
This reverts commit 36c1acc222d29e6e2dc9fc25362e4faa471111bd.
2017-04-22 13:17:07 +02:00
antirez
d69cc12bb3 Jemalloc updated to 4.4.0.
The original jemalloc source tree was modified to:

1. Remove the configure error that prevents nested builds.
2. Insert the Redis private Jemalloc API in order to allow the
Redis fragmentation function to work.
2017-01-30 09:58:34 +01:00
antirez
e901b0edbf Defrag: activate it only if running modified version of Jemalloc.
This commit also includes minor aesthetic changes like removal of
trailing spaces.
2017-01-10 11:25:39 +01:00
oranagra
c053025a0a active memory defragmentation 2016-12-30 03:37:52 +02:00
antirez
76c38aaebe deps/hiredis updated to latest version.
Close #3687.
2016-12-21 12:12:36 +01:00
antirez
40d53dcbbc Update linenoise to fix insecure redis-cli history file creation.
The problem was fixed in antirez/linenoise repository applying a patch
contributed by @lamby. Here the new version is updated in the Redis
source tree.

Close #1418
Close #3322
2016-07-29 11:28:16 +02:00
antirez
cd2e6c1fb1 geohash.c and geohash_helper.c are part of Redis.
They were under /deps since they originate from a different source tree,
however at this point they are very modified and we took ownership of
both the files making changes, fixing bugs, so there is no upgrade path
from the original code tree.

Given that, better to move the code under /src with proper dependencies
and with a more simpler editing experience.
2016-07-06 16:02:38 +02:00
antirez
fecf92d530 Geo: fix typo in geohashEstimateStepsByRadius().
I'm the author of this line but I can't see a good reason for it to
don't be a typo, a step of 26 should be valid with 52 bits per
coordinate, moreover the line was:

    if (step > 26) step = 25;

So a step of 26 was actually already used, except when one of 27 was
computed (which is invalid) only then it was trimmed to 25 instead of
26.

All tests passing after the change.
2016-05-30 15:31:19 +02:00
antirez
881a40e09d Fix GEORADIUS wrong output with radius > Earth radius.
Close #3266
2016-05-30 12:45:54 +02:00
antirez
26159be2e0 Actually use --with-lg-quantum=3 to build jemalloc.
This change is documented in deps/README.md but was lost in one way or
the other, neutralizing the benefits of 24 bytes size classes (and
others).

Close #3208.
2016-05-18 11:59:14 +02:00
antirez
8b20c65419 redis-cli hints. 2016-04-13 12:34:14 +02:00
antirez
9997ba6346 Linenoise updated again (hints support). 2016-04-12 23:40:52 +02:00
antirez
c2e833797a Linenoise updated.
As a side effect, cat commands.txt | redis-cli now is able to handle
lines more than 4096 bytes.
2016-04-06 13:38:32 +02:00
antirez
c2fd1784c2 Remove Lua state reference from buffers in lua_cmsgpack. 2016-02-10 09:12:17 +01:00
yoav@monfort.co.il
071645d76f cmsgpack: pass correct osize values to lua allocator, update correct buf free space in cmsgpack 2016-02-07 20:24:28 +02:00
Sun He
4dd05ab55e lua_struct.c/getnum: throw error if overflow happen
Fix issue #2855
2015-12-13 13:47:22 +08:00
antirez
e88759f742 Lua debugger: use sds_malloc() to allocate eval cli array.
Redis-cli handles the debugger "eval" command in a special way since
sdssplitargs() would not be ok: we need to send the Redis debugger the
whole Lua script without any parsing. However in order to later free the
argument vector inside redis-cli using just sdsfreesplitres(), we need
to allocate the array of SDS pointers using the same allocator SDS is
using, that may differ to what Redis is using.

So now a newer version of SDS exports sds_malloc() and other allocator
functions to give access, to the program it is linked to, the allocator
used internally by SDS.
2015-11-17 15:43:23 +01:00
antirez
61cceef3a3 Jemalloc configure script fixed to work nested.
Now way to make unmodified Jemalloc configure to work when the jemalloc
source tree is inside a subdirectory of a different git repository.

Problem signaled here:
http://www.canonware.com/pipermail/jemalloc-discuss/2015-October/001174.html
2015-10-07 09:17:06 +02:00
antirez
e7e83e86f2 Jemalloc updated to 4.0.3. 2015-10-06 16:55:37 +02:00
antirez
fe49700cf5 Added a README into deps on dependencies and how to upgrade. 2015-10-06 10:56:16 +02:00
antirez
7b940930d0 deps/hiredis SDS updated to version 2.0.0. 2015-07-25 17:51:48 +02:00
antirez
0b469c7882 Jemalloc: use LG_QUANTUM of 3 for AMD64 and I386.
This gives us a 24 bytes size class which is dict.c dictEntry size, thus
improving the memory efficiency of Redis significantly.
Moreover other non 16 bytes aligned tiny classes are added that further
reduce the fragmentation of the allocator.

Technically speaking LG_QUANTUM should be 4 on i386 / AMD64 because of
SSE types and other 16 bytes types, however we don't use those, and our
jemalloc only targets Redis.

New versions of Jemalloc will have an explicit configure switch in order
to specify the quantum value for a platform without requiring any change
to the Jemalloc source code: we'll switch to this system when available.

This change was originally proposed by Oran Agra (@oranagra) as a change
to the Jemalloc script to generate the size classes define. We ended
doing it differently by changing LG_QUANTUM since it is apparently the
supported Jemalloc method to obtain a 24 bytes size class, moreover it
also provides us other potentially useful size classes.

Related to issue #2510.
2015-07-24 10:20:02 +02:00
antirez
df481b24f2 Geo: use ULL suffix for unsigned 64 bit constants. 2015-07-09 11:27:58 +02:00
antirez
ecb568558c Geo: -Ofast breaks builds on older GCCs. 2015-07-09 11:25:29 +02:00
antirez
ccce923ec6 Geo: validate long,lat passed by user via API 2015-07-06 18:39:25 +02:00