summaryrefslogtreecommitdiff
path: root/.github
diff options
context:
space:
mode:
authorOzan Tezcan <ozantezcan@gmail.com>2021-11-11 14:51:33 +0300
committerGitHub <noreply@github.com>2021-11-11 13:51:33 +0200
commitb91d8b289bb64965c5eaa445809f9f49293e99c0 (patch)
tree7e921ab63b0c7535f2a13f1ed75391a01d757a26 /.github
parentcd6b3d558be0703b1a43f9fe58fd5f1ed7452829 (diff)
downloadredis-b91d8b289bb64965c5eaa445809f9f49293e99c0.tar.gz
Add sanitizer support and clean up sanitizer findings (#9601)
- Added sanitizer support. `address`, `undefined` and `thread` sanitizers are available. - To build Redis with desired sanitizer : `make SANITIZER=undefined` - There were some sanitizer findings, cleaned up codebase - Added tests with address and undefined behavior sanitizers to daily CI. - Added tests with address sanitizer to the per-PR CI (smoke out mem leaks sooner). Basically, there are three types of issues : **1- Unaligned load/store** : Most probably, this issue may cause a crash on a platform that does not support unaligned access. Redis does unaligned access only on supported platforms. **2- Signed integer overflow.** Although, signed overflow issue can be problematic time to time and change how compiler generates code, current findings mostly about signed shift or simple addition overflow. For most platforms Redis can be compiled for, this wouldn't cause any issue as far as I can tell (checked generated code on godbolt.org). **3 -Minor leak** (redis-cli), **use-after-free**(just before calling exit()); UB means nothing guaranteed and risky to reason about program behavior but I don't think any of the fixes here worth backporting. As sanitizers are now part of the CI, preventing new issues will be the real benefit.
Diffstat (limited to '.github')
-rw-r--r--.github/workflows/ci.yml13
-rw-r--r--.github/workflows/daily.yml82
2 files changed, 94 insertions, 1 deletions
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index d5e3a97c6..6a8b7fc13 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -19,6 +19,19 @@ jobs:
- name: module api test
run: ./runtest-moduleapi --verbose
+ test-sanitizer-address:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v2
+ - name: make
+ run: make SANITIZER=address
+ - name: testprep
+ run: sudo apt-get install tcl8.6 tclx -y
+ - name: test
+ run: ./runtest --verbose --tags -slow
+ - name: module api test
+ run: ./runtest-moduleapi --verbose
+
build-debian-old:
runs-on: ubuntu-latest
container: debian:oldoldstable
diff --git a/.github/workflows/daily.yml b/.github/workflows/daily.yml
index 26d7c1e9c..1fe1c5beb 100644
--- a/.github/workflows/daily.yml
+++ b/.github/workflows/daily.yml
@@ -11,7 +11,7 @@ on:
inputs:
skipjobs:
description: 'jobs to skip (delete the ones you wanna keep, do not leave empty)'
- default: 'valgrind,tls,freebsd,macos,alpine,32bit'
+ default: 'valgrind,sanitizer,tls,freebsd,macos,alpine,32bit'
skiptests:
description: 'tests to skip (delete the ones you wanna keep, do not leave empty)'
default: 'redis,modules,sentinel,cluster'
@@ -290,6 +290,86 @@ jobs:
if: true && !contains(github.event.inputs.skiptests, 'modules')
run: ./runtest-moduleapi --valgrind --no-latency --verbose --clients 1 --timeout 2400 --dump-logs ${{github.event.inputs.test_args}}
+ test-sanitizer-address:
+ runs-on: ubuntu-latest
+ if: github.repository == 'redis/redis' && !contains(github.event.inputs.skipjobs, 'sanitizer')
+ timeout-minutes: 14400
+ strategy:
+ matrix:
+ compiler: [ gcc, clang ]
+ env:
+ CC: ${{ matrix.compiler }}
+ steps:
+ - name: prep
+ if: github.event_name == 'workflow_dispatch'
+ run: |
+ echo "GITHUB_REPOSITORY=${{github.event.inputs.use_repo}}" >> $GITHUB_ENV
+ echo "GITHUB_HEAD_REF=${{github.event.inputs.use_git_ref}}" >> $GITHUB_ENV
+ - uses: actions/checkout@v2
+ with:
+ repository: ${{ env.GITHUB_REPOSITORY }}
+ ref: ${{ env.GITHUB_HEAD_REF }}
+ - name: make
+ run: make SANITIZER=address REDIS_CFLAGS='-DREDIS_TEST'
+ - name: testprep
+ run: |
+ sudo apt-get update
+ sudo apt-get install tcl8.6 tclx -y
+ - name: test
+ if: true && !contains(github.event.inputs.skiptests, 'redis')
+ run: ./runtest --accurate --verbose --dump-logs ${{github.event.inputs.test_args}}
+ - name: module api test
+ if: true && !contains(github.event.inputs.skiptests, 'modules')
+ run: ./runtest-moduleapi --verbose ${{github.event.inputs.test_args}}
+ - name: sentinel tests
+ if: true && !contains(github.event.inputs.skiptests, 'sentinel')
+ run: ./runtest-sentinel ${{github.event.inputs.cluster_test_args}}
+ - name: cluster tests
+ if: true && !contains(github.event.inputs.skiptests, 'cluster')
+ run: ./runtest-cluster ${{github.event.inputs.cluster_test_args}}
+ - name: unittest
+ run: ./src/redis-server test all
+
+ test-sanitizer-undefined:
+ runs-on: ubuntu-latest
+ if: github.repository == 'redis/redis' && !contains(github.event.inputs.skipjobs, 'sanitizer')
+ timeout-minutes: 14400
+ strategy:
+ matrix:
+ compiler: [ gcc, clang ]
+ env:
+ CC: ${{ matrix.compiler }}
+ steps:
+ - name: prep
+ if: github.event_name == 'workflow_dispatch'
+ run: |
+ echo "GITHUB_REPOSITORY=${{github.event.inputs.use_repo}}" >> $GITHUB_ENV
+ echo "GITHUB_HEAD_REF=${{github.event.inputs.use_git_ref}}" >> $GITHUB_ENV
+ - uses: actions/checkout@v2
+ with:
+ repository: ${{ env.GITHUB_REPOSITORY }}
+ ref: ${{ env.GITHUB_HEAD_REF }}
+ - name: make
+ run: make SANITIZER=undefined REDIS_CFLAGS='-DREDIS_TEST'
+ - name: testprep
+ run: |
+ sudo apt-get update
+ sudo apt-get install tcl8.6 tclx -y
+ - name: test
+ if: true && !contains(github.event.inputs.skiptests, 'redis')
+ run: ./runtest --accurate --verbose --dump-logs ${{github.event.inputs.test_args}}
+ - name: module api test
+ if: true && !contains(github.event.inputs.skiptests, 'modules')
+ run: ./runtest-moduleapi --verbose ${{github.event.inputs.test_args}}
+ - name: sentinel tests
+ if: true && !contains(github.event.inputs.skiptests, 'sentinel')
+ run: ./runtest-sentinel ${{github.event.inputs.cluster_test_args}}
+ - name: cluster tests
+ if: true && !contains(github.event.inputs.skiptests, 'cluster')
+ run: ./runtest-cluster ${{github.event.inputs.cluster_test_args}}
+ - name: unittest
+ run: ./src/redis-server test all
+
test-centos7-jemalloc:
runs-on: ubuntu-latest
if: github.repository == 'redis/redis'