Skip to content

Commit

Permalink
Remove archinfo dependency (#308)
Browse files Browse the repository at this point in the history
* plugins 2: no more plugins

* homebrew arches

* lint

* I think this is related to thumb mode?

* Remove archinfo from tests

* Remove archinfo from setup.cfg

* Fix fuzzing

* Fix ARM32 -> ARM

* Fix missing closing brace in PyvexArch.__repr__

* Get register offsets directly from vex_ffi

* Fix test cases failures related to little endian instructions

* Resore riscv64le

* Also in __init__.py

* Add subregister map

* Fix another test

* Don't treat rMSR r value as a vex offset, treat it as a register

* Fix remaining failing test cases

* Add some backwards compatibility for register indicies

* Revert _lookup_register to original behaviour

* Fix arch name

* Fix registers with vex_name

* Fix LDM instruction using register numbers

---------

Co-authored-by: Kevin Phoenix <[email protected]>
  • Loading branch information
rhelmot and twizmwazin authored Dec 2, 2023
1 parent 63bc840 commit 0f32e9d
Show file tree
Hide file tree
Showing 31 changed files with 2,241 additions and 296 deletions.
20 changes: 17 additions & 3 deletions fuzzing/irsb_fuzzer.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
import pyvex

# Additional imports
import archinfo
from enhanced_fdp import EnhancedFuzzedDataProvider

register_error_msg = re.compile("Register .*? does not exist!")
Expand All @@ -44,7 +43,22 @@ def nostdout():


# Save all available architectures off
available_archs = [tup[3]() for tup in archinfo.arch.arch_id_map if len(tup) >= 3]
available_archs = [
pyvex.ARCH_X86,
pyvex.ARCH_AMD64,
pyvex.ARCH_ARM_LE,
pyvex.ARCH_ARM_BE,
pyvex.ARCH_ARM64_LE,
pyvex.ARCH_ARM64_BE,
pyvex.ARCH_PPC32,
pyvex.ARCH_PPC64_BE,
pyvex.ARCH_PPC64_LE,
pyvex.ARCH_S390X,
pyvex.ARCH_MIPS32_BE,
pyvex.ARCH_MIPS32_LE,
pyvex.ARCH_MIPS64_BE,
pyvex.ARCH_MIPS64_LE,
]


class SupportedOptLevels(IntEnum):
Expand All @@ -58,7 +72,7 @@ class SupportedOptLevels(IntEnum):
StrictOpt = 2


def consume_random_arch(fdp: atheris.FuzzedDataProvider) -> archinfo.Arch:
def consume_random_arch(fdp: atheris.FuzzedDataProvider) -> pyvex.arches.PyvexArch:
return fdp.PickValueInList(available_archs)


Expand Down
34 changes: 34 additions & 0 deletions pyvex/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,24 @@
__version__ = "9.2.80.dev0"

from . import const, expr, stmt
from .arches import (
ARCH_AMD64,
ARCH_ARM64_BE,
ARCH_ARM64_LE,
ARCH_ARM_BE,
ARCH_ARM_BE_LE,
ARCH_ARM_LE,
ARCH_MIPS32_BE,
ARCH_MIPS32_LE,
ARCH_MIPS64_BE,
ARCH_MIPS64_LE,
ARCH_PPC32,
ARCH_PPC64_BE,
ARCH_PPC64_LE,
ARCH_RISCV64_LE,
ARCH_S390X,
ARCH_X86,
)
from .block import IRSB, IRTypeEnv
from .const import get_type_size, get_type_spec_size, tag_to_const_class
from .enums import (
Expand Down Expand Up @@ -54,4 +72,20 @@
"IRStmt",
"IRExpr",
"IRConst",
"ARCH_X86",
"ARCH_AMD64",
"ARCH_ARM_BE",
"ARCH_ARM_BE_LE",
"ARCH_ARM_LE",
"ARCH_ARM64_LE",
"ARCH_ARM64_BE",
"ARCH_PPC32",
"ARCH_PPC64_BE",
"ARCH_PPC64_LE",
"ARCH_S390X",
"ARCH_MIPS32_BE",
"ARCH_MIPS32_LE",
"ARCH_MIPS64_BE",
"ARCH_MIPS64_LE",
"ARCH_RISCV64_LE",
]
Loading

0 comments on commit 0f32e9d

Please sign in to comment.