Skip to content

Commit

Permalink
Restrict token permissions and add OpenSSF badge to repository (#100)
Browse files Browse the repository at this point in the history
  • Loading branch information
novafacing authored Aug 12, 2024
1 parent d175220 commit 755e74f
Show file tree
Hide file tree
Showing 6 changed files with 84 additions and 100 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ env:
MINGW_URL: "https://github.com/brechtsanders/winlibs_mingw/releases/download/13.2.0-16.0.6-11.0.0-ucrt-r1/winlibs-x86_64-posix-seh-gcc-13.2.0-llvm-16.0.6-mingw-w64ucrt-11.0.0-r1.7z"
MINGW_VERSION: "13.2.0-16.0.6-11.0.0-ucrt-r1"

permissions:
contents: read

jobs:
cache_craff:
runs-on: ubuntu-latest
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/scans.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ on:
pull_request:
branches: ["main"]

permissions:
contents: read

jobs:
super_lint:
name: Run Super Linter
Expand Down
10 changes: 5 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -48,21 +48,21 @@ libafl_bolts = { git = "https://github.com/AFLplusplus/LibAFL", rev = "0f26f6ea3
libafl_targets = { git = "https://github.com/AFLplusplus/LibAFL", rev = "0f26f6ea32aa74ee526636558842ec06bbfb49bb", default-features = false, features = [
"std",
] }
yaxpeax-arch = { version = "0.2.8", default-features = false, features = [
yaxpeax-arch = { version = "0.3.2", default-features = false, features = [
"std",
"use-serde",
] }
yaxpeax-x86 = { version = "1.2.2", default-features = false, features = [
yaxpeax-x86 = { version = "2.0.0", default-features = false, features = [
"std",
"use-serde",
"fmt",
] }
typed-builder = "0.18.2"
typed-builder = "0.19.1"
raw-cstr = "0.1.4"
goblin = "0.8.2"
yaxpeax-riscv = { git = "https://github.com/DrChat/yaxpeax-riscv", version = "0.1.0", features = [
"serde",
], rev = "0e2151b" }
], rev = "5973ff8" }
crc32fast = "1.4.2"
simics = "0.1.1"
indoc = "2.0.5"
Expand All @@ -74,7 +74,7 @@ num-traits = "0.2.19"
num-derive = "0.4.2"
tracing-subscriber = "0.3.18"
tracing = { version = "0.1.40", features = ["log"] }
yaxpeax-arm = "0.2.5"
yaxpeax-arm = "0.3.0"
chrono = "0.4.38"

[dev-dependencies]
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
[![OpenSSF Best Practices](https://www.bestpractices.dev/projects/9349/badge)](https://www.bestpractices.dev/projects/9349)

# TSFFS: Target Software Fuzzer For SIMICS

TSFFS is a snapshotting, coverage-guided fuzzer built on the
Expand Down
80 changes: 34 additions & 46 deletions src/arch/x86.rs
Original file line number Diff line number Diff line change
Expand Up @@ -766,79 +766,67 @@ impl TryFrom<(&Operand, Option<u8>)> for CmpExpr {
let value = value.0;

let expr = match value {
Operand::ImmediateI8(i) => CmpExpr::I8(*i),
Operand::ImmediateU8(u) => CmpExpr::U8(*u),
Operand::ImmediateI16(i) => CmpExpr::I16(*i),
Operand::ImmediateU16(u) => CmpExpr::U16(*u),
Operand::ImmediateI32(i) => CmpExpr::I32(*i),
Operand::ImmediateU32(u) => CmpExpr::U32(*u),
Operand::Register(r) => CmpExpr::Reg((r.name().to_string(), r.width())),
Operand::DisplacementU32(d) => CmpExpr::Addr(*d as u64),
Operand::RegDeref(r) => CmpExpr::Deref((
Box::new(CmpExpr::Reg((r.name().to_string(), r.width()))),
Operand::ImmediateI8 { imm } => CmpExpr::I8(*imm),
Operand::ImmediateU8 { imm } => CmpExpr::U8(*imm),
Operand::ImmediateI16 { imm } => CmpExpr::I16(*imm),
Operand::ImmediateU16 { imm } => CmpExpr::U16(*imm),
Operand::ImmediateI32 { imm } => CmpExpr::I32(*imm),
Operand::ImmediateU32 { imm } => CmpExpr::U32(*imm),
Operand::Register { reg } => CmpExpr::Reg((reg.name().to_string(), reg.width())),
Operand::AbsoluteU32 { addr } => CmpExpr::Addr(*addr as u64),
Operand::MemDeref { base } => CmpExpr::Deref((
Box::new(CmpExpr::Reg((base.name().to_string(), base.width()))),
width,
)),
Operand::RegDisp(r, d) => CmpExpr::Deref((
Operand::Disp { base, disp } => CmpExpr::Deref((
Box::new(CmpExpr::Add((
Box::new(CmpExpr::Reg((r.name().to_string(), r.width()))),
Box::new(CmpExpr::I32(*d)),
Box::new(CmpExpr::Reg((base.name().to_string(), base.width()))),
Box::new(CmpExpr::I32(*disp)),
))),
width,
)),
Operand::RegScale(r, s) => CmpExpr::Deref((
Operand::MemIndexScale { index, scale } => CmpExpr::Deref((
Box::new(CmpExpr::Mul((
Box::new(CmpExpr::Reg((r.name().to_string(), r.width()))),
Box::new(CmpExpr::U8(*s)),
Box::new(CmpExpr::Reg((index.name().to_string(), index.width()))),
Box::new(CmpExpr::U8(*scale)),
))),
width,
)),
Operand::RegIndexBase(r, i) => CmpExpr::Deref((
Box::new(CmpExpr::Add((
Box::new(CmpExpr::Reg((r.name().to_string(), r.width()))),
Box::new(CmpExpr::Reg((i.name().to_string(), i.width()))),
))),
width,
)),
Operand::RegIndexBaseDisp(r, i, d) => CmpExpr::Deref((
Box::new(CmpExpr::Add((
Box::new(CmpExpr::Add((
Box::new(CmpExpr::Reg((r.name().to_string(), r.width()))),
Box::new(CmpExpr::Reg((i.name().to_string(), i.width()))),
))),
Box::new(CmpExpr::I32(*d)),
))),
width,
)),
Operand::RegScaleDisp(r, s, d) => CmpExpr::Deref((
Operand::MemIndexScaleDisp { index, scale, disp } => CmpExpr::Deref((
Box::new(CmpExpr::Add((
Box::new(CmpExpr::Mul((
Box::new(CmpExpr::Reg((r.name().to_string(), r.width()))),
Box::new(CmpExpr::U8(*s)),
Box::new(CmpExpr::Reg((index.name().to_string(), index.width()))),
Box::new(CmpExpr::U8(*scale)),
))),
Box::new(CmpExpr::I32(*d)),
Box::new(CmpExpr::I32(*disp)),
))),
width,
)),
Operand::RegIndexBaseScale(r, i, s) => CmpExpr::Deref((
Operand::MemBaseIndexScale { base, index, scale } => CmpExpr::Deref((
Box::new(CmpExpr::Add((
Box::new(CmpExpr::Reg((r.name().to_string(), r.width()))),
Box::new(CmpExpr::Reg((base.name().to_string(), base.width()))),
Box::new(CmpExpr::Add((
Box::new(CmpExpr::Reg((i.name().to_string(), i.width()))),
Box::new(CmpExpr::U8(*s)),
Box::new(CmpExpr::Reg((index.name().to_string(), index.width()))),
Box::new(CmpExpr::U8(*scale)),
))),
))),
width,
)),
Operand::RegIndexBaseScaleDisp(r, i, s, d) => CmpExpr::Deref((
Operand::MemBaseIndexScaleDisp {
base,
index,
scale,
disp,
} => CmpExpr::Deref((
Box::new(CmpExpr::Add((
Box::new(CmpExpr::Add((
Box::new(CmpExpr::Reg((r.name().to_string(), r.width()))),
Box::new(CmpExpr::Reg((base.name().to_string(), base.width()))),
Box::new(CmpExpr::Add((
Box::new(CmpExpr::Reg((i.name().to_string(), i.width()))),
Box::new(CmpExpr::U8(*s)),
Box::new(CmpExpr::Reg((index.name().to_string(), index.width()))),
Box::new(CmpExpr::U8(*scale)),
))),
))),
Box::new(CmpExpr::I32(*d)),
Box::new(CmpExpr::I32(*disp)),
))),
width,
)),
Expand Down
86 changes: 37 additions & 49 deletions src/arch/x86_64.rs
Original file line number Diff line number Diff line change
Expand Up @@ -740,82 +740,70 @@ impl TryFrom<(&Operand, Option<u8>)> for CmpExpr {
let value = value.0;

let expr = match value {
Operand::ImmediateI8(i) => CmpExpr::I8(*i),
Operand::ImmediateU8(u) => CmpExpr::U8(*u),
Operand::ImmediateI16(i) => CmpExpr::I16(*i),
Operand::ImmediateU16(u) => CmpExpr::U16(*u),
Operand::ImmediateI32(i) => CmpExpr::I32(*i),
Operand::ImmediateU32(u) => CmpExpr::U32(*u),
Operand::ImmediateI64(i) => CmpExpr::I64(*i),
Operand::ImmediateU64(u) => CmpExpr::U64(*u),
Operand::Register(r) => CmpExpr::Reg((r.name().to_string(), r.width())),
Operand::DisplacementU32(d) => CmpExpr::Addr(*d as u64),
Operand::DisplacementU64(d) => CmpExpr::Addr(*d),
Operand::RegDeref(r) => CmpExpr::Deref((
Box::new(CmpExpr::Reg((r.name().to_string(), r.width()))),
Operand::ImmediateI8 { imm } => CmpExpr::I8(*imm),
Operand::ImmediateU8 { imm } => CmpExpr::U8(*imm),
Operand::ImmediateI16 { imm } => CmpExpr::I16(*imm),
Operand::ImmediateU16 { imm } => CmpExpr::U16(*imm),
Operand::ImmediateI32 { imm } => CmpExpr::I32(*imm),
Operand::ImmediateU32 { imm } => CmpExpr::U32(*imm),
Operand::ImmediateI64 { imm } => CmpExpr::I64(*imm),
Operand::ImmediateU64 { imm } => CmpExpr::U64(*imm),
Operand::Register { reg } => CmpExpr::Reg((reg.name().to_string(), reg.width())),
Operand::AbsoluteU32 { addr } => CmpExpr::Addr(*addr as u64),
Operand::AbsoluteU64 { addr } => CmpExpr::Addr(*addr),
Operand::MemDeref { base } => CmpExpr::Deref((
Box::new(CmpExpr::Reg((base.name().to_string(), base.width()))),
width,
)),
Operand::RegDisp(r, d) => CmpExpr::Deref((
Operand::Disp { base, disp } => CmpExpr::Deref((
Box::new(CmpExpr::Add((
Box::new(CmpExpr::Reg((r.name().to_string(), r.width()))),
Box::new(CmpExpr::I32(*d)),
Box::new(CmpExpr::Reg((base.name().to_string(), base.width()))),
Box::new(CmpExpr::I32(*disp)),
))),
width,
)),
Operand::RegScale(r, s) => CmpExpr::Deref((
Operand::MemIndexScale { index, scale } => CmpExpr::Deref((
Box::new(CmpExpr::Mul((
Box::new(CmpExpr::Reg((r.name().to_string(), r.width()))),
Box::new(CmpExpr::U8(*s)),
Box::new(CmpExpr::Reg((index.name().to_string(), index.width()))),
Box::new(CmpExpr::U8(*scale)),
))),
width,
)),
Operand::RegIndexBase(r, i) => CmpExpr::Deref((
Box::new(CmpExpr::Add((
Box::new(CmpExpr::Reg((r.name().to_string(), r.width()))),
Box::new(CmpExpr::Reg((i.name().to_string(), i.width()))),
))),
width,
)),
Operand::RegIndexBaseDisp(r, i, d) => CmpExpr::Deref((
Box::new(CmpExpr::Add((
Box::new(CmpExpr::Add((
Box::new(CmpExpr::Reg((r.name().to_string(), r.width()))),
Box::new(CmpExpr::Reg((i.name().to_string(), i.width()))),
))),
Box::new(CmpExpr::I32(*d)),
))),
width,
)),
Operand::RegScaleDisp(r, s, d) => CmpExpr::Deref((
Operand::MemIndexScaleDisp { index, scale, disp } => CmpExpr::Deref((
Box::new(CmpExpr::Add((
Box::new(CmpExpr::Mul((
Box::new(CmpExpr::Reg((r.name().to_string(), r.width()))),
Box::new(CmpExpr::U8(*s)),
Box::new(CmpExpr::Reg((index.name().to_string(), index.width()))),
Box::new(CmpExpr::U8(*scale)),
))),
Box::new(CmpExpr::I32(*d)),
Box::new(CmpExpr::I32(*disp)),
))),
width,
)),
Operand::RegIndexBaseScale(r, i, s) => CmpExpr::Deref((
Operand::MemBaseIndexScale { base, index, scale } => CmpExpr::Deref((
Box::new(CmpExpr::Add((
Box::new(CmpExpr::Reg((r.name().to_string(), r.width()))),
Box::new(CmpExpr::Reg((base.name().to_string(), base.width()))),
Box::new(CmpExpr::Add((
Box::new(CmpExpr::Reg((i.name().to_string(), i.width()))),
Box::new(CmpExpr::U8(*s)),
Box::new(CmpExpr::Reg((index.name().to_string(), index.width()))),
Box::new(CmpExpr::U8(*scale)),
))),
))),
width,
)),
Operand::RegIndexBaseScaleDisp(r, i, s, d) => CmpExpr::Deref((
Operand::MemBaseIndexScaleDisp {
base,
index,
scale,
disp,
} => CmpExpr::Deref((
Box::new(CmpExpr::Add((
Box::new(CmpExpr::Add((
Box::new(CmpExpr::Reg((r.name().to_string(), r.width()))),
Box::new(CmpExpr::Reg((base.name().to_string(), base.width()))),
Box::new(CmpExpr::Add((
Box::new(CmpExpr::Reg((i.name().to_string(), i.width()))),
Box::new(CmpExpr::U8(*s)),
Box::new(CmpExpr::Reg((index.name().to_string(), index.width()))),
Box::new(CmpExpr::U8(*scale)),
))),
))),
Box::new(CmpExpr::I32(*d)),
Box::new(CmpExpr::I32(*disp)),
))),
width,
)),
Expand Down

0 comments on commit 755e74f

Please sign in to comment.