1. 21 7月, 2021 2 次提交
    • H
      On 32 bit platform, the bit position of GETBIT/SETBIT/BITFIELD/BITCOUNT,BITPOS... · 71d45287
      Huang Zhw 提交于
      On 32 bit platform, the bit position of GETBIT/SETBIT/BITFIELD/BITCOUNT,BITPOS may overflow (see CVE-2021-32761) (#9191)
      
      GETBIT, SETBIT may access wrong address because of wrap.
      BITCOUNT and BITPOS may return wrapped results.
      BITFIELD may access the wrong address but also allocate insufficient memory and segfault (see CVE-2021-32761).
      
      This commit uses `uint64_t` or `long long` instead of `size_t`.
      related https://github.com/redis/redis/pull/8096
      
      At 32bit platform:
      > setbit bit 4294967295 1
      (integer) 0
      > config set proto-max-bulk-len 536870913
      OK
      > append bit "\xFF"
      (integer) 536870913
      > getbit bit 4294967296
      (integer) 0
      
      When the bit index is larger than 4294967295, size_t can't hold bit index. In the past,  `proto-max-bulk-len` is limit to 536870912, so there is no problem.
      
      After this commit, bit position is stored in `uint64_t` or `long long`. So when `proto-max-bulk-len > 536870912`, 32bit platforms can still be correct.
      
      For 64bit platform, this problem still exists. The major reason is bit pos 8 times of byte pos. When proto-max-bulk-len is very larger, bit pos may overflow.
      But at 64bit platform, we don't have so long string. So this bug may never happen.
      
      Additionally this commit add a test cost `512MB` memory which is tag as `large-memory`. Make freebsd ci and valgrind ci ignore this test.
      71d45287
    • O
      Fix ACL category for SELECT, WAIT, ROLE, LASTSAVE, READONLY, READWRITE, ASKING (#9208) · 32e61ee2
      Oran Agra 提交于
      - SELECT and WAIT don't read or write from the keyspace (unlike DEL, EXISTS, EXPIRE, DBSIZE, KEYS, etc).
      they're more similar to AUTH and HELLO (and maybe PING and COMMAND).
      they only affect the current connection, not the server state, so they should be `@connection`, not `@keyspace`
      
      - ROLE, like LASTSAVE is `@admin` (and `@dangerous` like INFO) 
      
      - ASKING, READONLY, READWRITE are `@connection` too (not `@keyspace`)
      
      - Additionally, i'm now documenting the exact meaning of each ACL category so it's clearer which commands belong where.
      32e61ee2
  2. 19 7月, 2021 2 次提交
  3. 18 7月, 2021 5 次提交
  4. 17 7月, 2021 1 次提交
  5. 16 7月, 2021 2 次提交
  6. 15 7月, 2021 1 次提交
    • O
      Test infra, handle RESP3 attributes and big-numbers and bools (#9235) · 6a5bac30
      Oran Agra 提交于
      - promote the code in DEBUG PROTOCOL to addReplyBigNum
      - DEBUG PROTOCOL ATTRIB skips the attribute when client is RESP2
      - networking.c addReply for push and attributes generate assertion when
        called on a RESP2 client, anything else would produce a broken
        protocol that clients can't handle.
      6a5bac30
  7. 14 7月, 2021 2 次提交
  8. 13 7月, 2021 1 次提交
  9. 11 7月, 2021 4 次提交
    • P
      Fail EXEC command in case a watched key is expired (#9194) · ac8b1df8
      perryitay 提交于
      There are two issues fixed in this commit: 
      1. we want to fail the EXEC command in case there is a watched key that's logically
         expired but not yet deleted by active expire or lazy expire.
      2. we saw that currently cache time is update in every `call()` (including nested calls),
         this time is being also being use for the isKeyExpired comparison, we want to update
         the cache time only in the first call (execCommand)
      Co-authored-by: NOran Agra <oran@redislabs.com>
      ac8b1df8
    • H
      Do not install a file event to send data to rewrite child when parent stop... · cb961d8c
      Huang Zhw 提交于
      Do not install a file event to send data to rewrite child when parent stop sending diff to child in aof rewrite. (#8767)
      
      In aof rewrite, when parent stop sending data to child, if there is
      new rewrite data, aofChildWriteDiffData write event will be installed.
      Then this event is issued and deletes the file event without do anyting.
      This will happen over and over again until aof rewrite finish.
      
      This bug used to waste a few system calls per excessive wake-up
      (epoll_ctl and epoll_wait) per cycle, each cycle triggered by receiving
      a write command from a client.
      cb961d8c
    • B
      Add test for ziplist (nextdiff == -4 && reqlen < 4) (#9218) · fe5d3251
      Binbin 提交于
      The if judgement `nextdiff == -4 && reqlen < 4` in __ziplistInsert.
      It's strange, but it's useful. Without it there will be problems during
      chain update.
      Till now these lines didn't have coverage in the tests, and there was
      a question if they are at all needed (#7170)
      fe5d3251
    • Y
      Pre-test bind-source-addr before running test. (#9214) · 92e80047
      Yossi Gottlieb 提交于
      This attempts to catch any non-standard configuration where the test may
      fail and produce a false positive.
      92e80047
  10. 10 7月, 2021 2 次提交
  11. 07 7月, 2021 1 次提交
    • M
      Direct redis-cli repl prints to stderr, because --rdb can print to stdout.... · 1eb4baa5
      Mikhail Fesenko 提交于
      Direct redis-cli repl prints to stderr, because --rdb can print to stdout. fflush stdout after responses  (#9136)
      
      1. redis-cli can output --rdb data to stdout
         but redis-cli also write some messages to stdout which will mess up the rdb.
      
      2. Make redis-cli flush stdout when printing a reply
        This was needed in order to fix a hung in redis-cli test that uses
        --replica.
         Note that printf does flush when there's a newline, but fwrite does not.
      
      3. fix the redis-cli --replica test which used to pass previously
         because it didn't really care what it read, and because redis-cli
         used printf to print these other things to stdout.
      
      4. improve redis-cli --replica test to run with both diskless and disk-based.
      Co-authored-by: NOran Agra <oran@redislabs.com>
      Co-authored-by: NViktor Söderqvist <viktor@zuiderkwast.se>
      1eb4baa5
  12. 06 7月, 2021 3 次提交
  13. 05 7月, 2021 8 次提交
  14. 04 7月, 2021 1 次提交
  15. 03 7月, 2021 1 次提交
  16. 01 7月, 2021 3 次提交
    • Y
      Fix CLIENT UNBLOCK crashing modules. (#9167) · aa139e2f
      Yossi Gottlieb 提交于
      Modules that use background threads with thread safe contexts are likely
      to use RM_BlockClient() without a timeout function, because they do not
      set up a timeout.
      
      Before this commit, `CLIENT UNBLOCK` would result with a crash as the
      `NULL` timeout callback is called. Beyond just crashing, this is also
      logically wrong as it may throw the module into an unexpected client
      state.
      
      This commits makes `CLIENT UNBLOCK` on such clients behave the same as
      any other client that is not in a blocked state and therefore cannot be
      unblocked.
      aa139e2f
    • O
      Fix bug in sdscatfmt when % is the last format char (#9173) · de9bae21
      Oran Agra 提交于
      For the sdscatfmt function in sds.c, when the parameter fmt ended up with '%',
      the behavior is undefined. This commit fix this bug.
      Co-authored-by: Nstafuc <stafuc@gmail.com>
      de9bae21
    • W
      Don't start in sentinel mode if only the folder name contains redis-sentinel (#9176) · 16e04ed9
      Wang Yuan 提交于
      Before this commit, redis-server starts in sentinel mode if the first startup
      argument has the string redis-sentinel, so redis also starts in sentinel mode
      if the directory it was started from contains the string redis-sentinel.
      Now we check the executable name instead of directory.
      
      Some examples:
      1. Execute ./redis-sentinel/redis/src/redis-sentinel, starts in sentinel mode.
      2. Execute ./redis-sentinel/redis/src/redis-server, starts in server mode,
         but before, redis will start in sentinel mode.
      3. Execute ./redis-sentinel/redis/src/redis-server --sentinel, of course, like
         before, starts in sentinel mode.
      16e04ed9
  17. 30 6月, 2021 1 次提交