angr/tests
Yan Shoshitaishvili 55530509ce
SimLinux: Stop pre-growing the stack past address zero. (#6806)
SimLinux.state_blank pre-grows the stack by a fixed 0x20 pages without
checking that 0x20 pages exist beneath the stack pointer. When they do
not, the allocation loop wraps past address 0 and hands out the remainder
at the top of the address space.

On x86-64 that is silent: blank_state(stack_end=0x10000) maps sixteen
stack pages from 0x0 up and sixteen more from 0xfffffffffffff000 down.
Where the wrap reaches a page the same call already handed out, the state
fails with SimSegfaultException("stack collided with heap") instead, and
where it reaches the loaded image it replaces it with blank pages.

Skip the pre-grow when that much space does not exist. Clamping it to the
space that does exist is not an option: the pre-allocated pages are not
backed by the loader, so a stack that reaches down to an image beneath it
hides that image. The pages that are skipped are still faulted in on
demand.

Also reject an allocation that does not fit beneath the top of the stack
in allocate_stack_pages() itself, so a caller that asks for one gets an
error rather than pages at the top of the address space.

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
2026-08-17 05:55:58 -07:00
..
ailment [pre-commit.ci] pre-commit autoupdate (#6721) 2026-07-29 13:46:11 -07:00
analyses CFG: Warn when the regions to analyze cover no bytes. (#6825) 2026-08-13 17:26:22 -05:00
angrdb Enable ruff isort rule (#6452) 2026-06-02 14:48:07 -07:00
engines Fix signed division and remainder in the pcode engine (#6739) 2026-07-31 12:23:05 -07:00
exploration_techniques Enable ruff isort rule (#6452) 2026-06-02 14:48:07 -07:00
factory tests: sum floats sequentially in run_manyfloatsum_symbolic (#6509) 2026-06-16 17:25:37 -07:00
gui DecompilationCache: Serialization support. (#6624) 2026-07-22 03:03:40 -07:00
knowledge_plugins CompleteCallingConventions: fail loudly when all workers die. (#6718) 2026-07-27 18:20:59 -07:00
llm DecompilationCache: Serialization support. (#6624) 2026-07-22 03:03:40 -07:00
manual Enable ruff isort rule (#6452) 2026-06-02 14:48:07 -07:00
mcp Decompiler: Add edits layer; add more tools to MCP. (#6789) 2026-08-09 01:48:07 -07:00
misc Enable ruff isort rule (#6452) 2026-06-02 14:48:07 -07:00
perf Enable ruff isort rule (#6452) 2026-06-02 14:48:07 -07:00
procedures SimLibrary/SimSyscallLibrary: Treat None prototypes as absent. (#6673) 2026-07-24 11:29:58 -07:00
regression Enable ruff isort rule (#6452) 2026-06-02 14:48:07 -07:00
serialization SimConstantVariable: Fix overflows and value out of range errors. (#6738) 2026-07-29 13:58:20 -07:00
sim Support native AIL Abs expressions in light engines (#6683) 2026-07-24 00:43:03 -07:00
simos SimLinux: Stop pre-growing the stack past address zero. (#6806) 2026-08-17 05:55:58 -07:00
state_plugins state_plugins: Map the heap region lazily and grow it on demand. (#6715) 2026-07-27 18:20:07 -07:00
storage SimLinux: Stop pre-growing the stack past address zero. (#6806) 2026-08-17 05:55:58 -07:00
types SimStruct: Remove _arch_memo to fix the cache leak. (#6757) 2026-08-05 01:12:55 -07:00
utils CFGFast: Make the smart scan nodecode ratio O(log n) (#6767) 2026-08-05 01:42:45 -07:00
__init__.py tests: Structure test files into directories 2023-09-08 16:05:33 -07:00
common.py [pre-commit.ci] pre-commit autoupdate (#6721) 2026-07-29 13:46:11 -07:00
README.md Update test/README.md with current tools (#3774) 2023-02-01 18:48:16 -07:00
test_calling_conventions.py SimCCMicrosoftFastcall: Implement next_arg. (#6491) 2026-06-10 03:19:34 -07:00
test_cli.py Add Rust decompiler support to CLI (#6421) 2026-05-19 23:00:07 -07:00
test_fuzzer.py Fuzzer infrastructure: engine caching, custom breakpoints, icicle bump (#6346) 2026-04-15 15:22:31 -07:00
test_load_shellcode.py Enable ruff isort rule (#6452) 2026-06-02 14:48:07 -07:00

Tests

Running tests

These tests require the binaries repository, clone it in the folder where angr was cloned.

git clone https://github.com/angr/binaries

nose2 or pytest may be used to run tests. Each tool can be installed with pip:

pip install nose2
pip install pytest

To run the tests with nose2, from the root of the repository, run:

nose2 -s tests

Or if using pytest, simply run:

pytest

Writing new tests

New tests should be written using unittest, part of Python's standard library. For more information about unittest, see https://docs.python.org/3/library/unittest.html. While we prefer nose2 and pytest for running tests, avoid using nose2 or pytest features in tests themselves, to avoid dependency on a specific runner.