Skip to content

added mayhem stuff #156

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 59 additions & 0 deletions .github/workflows/mayhem.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: Mayhem
on:
push:
pull_request:
workflow_dispatch:

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
MAYHEMFILE: Mayhemfile

jobs:
build:
name: "${{ matrix.os }} shared=${{ matrix.shared }} ${{ matrix.build_type }}"
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]
shared: [false]
build_type: [Release]
include:
- os: ubuntu-latest
triplet: x64-linux

steps:
- uses: actions/checkout@v2

- name: Log in to the Container registry
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}

- name: Build and push Docker image
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

- name: Start analysis
uses: ForAllSecure/mcode-action@v1
with:
mayhem-token: ${{ secrets.MAYHEM_TOKEN }}
args: --image ${{ steps.meta.outputs.tags }} --file ${{ env.MAYHEMFILE }}
sarif-output: sarif

- name: Upload SARIF file(s)
uses: github/codeql-action/upload-sarif@v1
with:
sarif_file: sarif
33 changes: 33 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@

FROM ubuntu:20.04 as builder

## Install build dependencies.
RUN apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get install -y cmake clang curl
RUN curl --proto "=https" --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
RUN ${HOME}/.cargo/bin/rustup default nightly
RUN ${HOME}/.cargo/bin/cargo install -f cargo-fuzz

ADD . /trie
WORKDIR /trie

## TODO: ADD YOUR BUILD INSTRUCTIONS HERE.
# RUN ${HOME}/.cargo/bin/cargo build --all
RUN cd trie-db && \
cd fuzz && ${HOME}/.cargo/bin/cargo fuzz build

# Package Stage
FROM ubuntu:20.04


## TODO: Change <Path in Builder Stage>
COPY --from=builder trie/trie-db/fuzz/target/x86_64-unknown-linux-gnu/release/trie_root_new /
COPY --from=builder trie/trie-db/fuzz/target/x86_64-unknown-linux-gnu/release/trie_root /
COPY --from=builder trie/trie-db/fuzz/target/x86_64-unknown-linux-gnu/release/trie_root_fix_len /
COPY --from=builder trie/trie-db/fuzz/target/x86_64-unknown-linux-gnu/release/no_ext_insert /
COPY --from=builder trie/trie-db/fuzz/target/x86_64-unknown-linux-gnu/release/no_ext_insert_rem /
COPY --from=builder trie/trie-db/fuzz/target/x86_64-unknown-linux-gnu/release/prefix_iter /
COPY --from=builder trie/trie-db/fuzz/target/x86_64-unknown-linux-gnu/release/seek_iter /
COPY --from=builder trie/trie-db/fuzz/target/x86_64-unknown-linux-gnu/release/trie_proof_valid /
COPY --from=builder trie/trie-db/fuzz/target/x86_64-unknown-linux-gnu/release/trie_codec_proof /
COPY --from=builder trie/trie-db/fuzz/target/x86_64-unknown-linux-gnu/release/trie_proof_invalid /
14 changes: 14 additions & 0 deletions Mayhemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@

project: openml
target: openml

cmds:
- cmd: /trie_root_new
- cmd: /trie_root
- cmd: /trie_root_fix_len
- cmd: /no_ext_insert
- cmd: /prefix_iter
- cmd: /seek_iter
- cmd: /trie_proof_valid
- cmd: /trie_codec_proof
- cmd: /trie_proof_invalid