|
| 1 | +name: Sanitizer Tests |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [ 'master', 'main', 'release/**' ] |
| 6 | + pull_request: |
| 7 | + branches: [ '*' ] |
| 8 | + |
| 9 | +concurrency: |
| 10 | + group: ${{ github.workflow }}-${{ github.ref }} |
| 11 | + cancel-in-progress: true |
| 12 | + |
| 13 | +jobs: |
| 14 | + build_wolfssl: |
| 15 | + name: Build wolfSSL |
| 16 | + runs-on: ubuntu-latest |
| 17 | + timeout-minutes: 5 |
| 18 | + steps: |
| 19 | + - name: Checkout wolfSSL |
| 20 | + uses: actions/checkout@v4 |
| 21 | + with: |
| 22 | + repository: wolfssl/wolfssl |
| 23 | + path: wolfssl |
| 24 | + |
| 25 | + - name: Build wolfSSL |
| 26 | + working-directory: ./wolfssl |
| 27 | + run: | |
| 28 | + ./autogen.sh |
| 29 | + ./configure --enable-wolftpm --enable-pkcallbacks |
| 30 | + make -j$(nproc) |
| 31 | + sudo make install |
| 32 | + sudo ldconfig |
| 33 | +
|
| 34 | + - name: tar build-dir |
| 35 | + run: tar -zcf wolfssl-install.tgz /usr/local/lib/libwolfssl* /usr/local/include/wolfssl |
| 36 | + |
| 37 | + - name: Upload built lib |
| 38 | + uses: actions/upload-artifact@v4 |
| 39 | + with: |
| 40 | + name: wolfssl-install |
| 41 | + path: wolfssl-install.tgz |
| 42 | + retention-days: 5 |
| 43 | + |
| 44 | + sanitizer_test: |
| 45 | + name: ${{ matrix.name }} |
| 46 | + runs-on: ubuntu-latest |
| 47 | + timeout-minutes: 10 |
| 48 | + needs: build_wolfssl |
| 49 | + strategy: |
| 50 | + fail-fast: false |
| 51 | + matrix: |
| 52 | + include: |
| 53 | + - name: "ASan" |
| 54 | + cflags: "-fsanitize=address -fno-omit-frame-pointer -g -O1" |
| 55 | + ldflags: "-fsanitize=address" |
| 56 | + - name: "UBSan" |
| 57 | + cflags: "-fsanitize=undefined -fno-sanitize-recover=all -fno-omit-frame-pointer -g" |
| 58 | + ldflags: "-fsanitize=undefined" |
| 59 | + - name: "LeakSan" |
| 60 | + cflags: "-fsanitize=leak -fno-omit-frame-pointer -g" |
| 61 | + ldflags: "-fsanitize=leak" |
| 62 | + |
| 63 | + steps: |
| 64 | + - name: Workaround high-entropy ASLR |
| 65 | + run: sudo sysctl vm.mmap_rnd_bits=28 |
| 66 | + |
| 67 | + - name: Checkout wolfTPM |
| 68 | + uses: actions/checkout@v4 |
| 69 | + |
| 70 | + - name: Download wolfSSL |
| 71 | + uses: actions/download-artifact@v4 |
| 72 | + with: |
| 73 | + name: wolfssl-install |
| 74 | + |
| 75 | + - name: Install wolfSSL |
| 76 | + run: | |
| 77 | + sudo tar -xzf wolfssl-install.tgz -C / |
| 78 | + sudo ldconfig |
| 79 | +
|
| 80 | + - name: Setup ibmswtpm2 |
| 81 | + uses: actions/checkout@v4 |
| 82 | + with: |
| 83 | + repository: kgoldman/ibmswtpm2 |
| 84 | + path: ibmswtpm2 |
| 85 | + |
| 86 | + - name: Build and start TPM simulator |
| 87 | + working-directory: ./ibmswtpm2/src |
| 88 | + run: | |
| 89 | + make -j$(nproc) |
| 90 | + ./tpm_server & |
| 91 | + sleep 2 |
| 92 | +
|
| 93 | + - name: Build wolfTPM with ${{ matrix.name }} |
| 94 | + run: | |
| 95 | + ./autogen.sh |
| 96 | + ./configure --enable-swtpm \ |
| 97 | + CFLAGS="${{ matrix.cflags }}" LDFLAGS="${{ matrix.ldflags }}" |
| 98 | + make -j$(nproc) |
| 99 | +
|
| 100 | + - name: Run tests |
| 101 | + run: make check |
| 102 | + |
| 103 | + - name: Upload failure logs |
| 104 | + if: failure() |
| 105 | + uses: actions/upload-artifact@v4 |
| 106 | + with: |
| 107 | + name: wolftpm-${{ matrix.name }}-logs |
| 108 | + path: | |
| 109 | + run.out |
| 110 | + test-suite.log |
| 111 | + config.log |
| 112 | + retention-days: 5 |
0 commit comments