157 Commits

Author SHA1 Message Date
Dominik Maier
26122b20a0
Add unsafe to AsanErrorsObserver, fix UBs, fix Frida Version missmatch (#1987)
* Add unsafe to AsanErrorsObserver, fix UBs, fix Frida Version missmatch

* Clippy

* simpler API

* fix build

* fix
2024-04-02 10:17:59 +02:00
Dongjia "toka" Zhang
53bfae0a08
Increase llmp timeout & Print PID in logger (#1970)
* increase timeout & print pid for logger

* log

* aa

* rename stuff
2024-03-25 19:15:46 +01:00
Romain Malmain
44c841ffb1
WIP: QEMU exit handler (#1745)
* Added paging filtering.
Reworked address range filtering to fit with new generic code.

* Fix: renamed remaining QemuInstrumentationFilter instances.

* Renamed sync breakpoint to sync exit.

* Split emu in systemmode.rs / usermode.rs for specific code.
EmuExitHandler implementation.

* sync_backdoor.rs removal.
Formatting.

* Updated `bindgen` and `which`.
Adapting code to work with update.

* fix: reconfigure cleanly if prior configure was interrupted abruptly.

* Enable sanitizers in QEMU during debug.

* Added target-usable files.

* Added breakpoint structure.

* Adapted other files to work with ExitHandler.

* Adapted existing fuzzer to work with new exit handler.

* fix: use get to avoid crashes.

* Updated README to indicate cargo-make should be installed.

* Added QEMU internal exit handler.

* Adapted qemu_systemmode example with new exit handler.

* Fixed fuzzers to work with new exit handler.

* Trying to fix CI (#1739)

* test

* dummy

* dummy

* Added new examples.

* Forgot to add build scripts.

* format

* format

* clang-format

* python emulator adaptation.

* fixed python bindings.

* clippy fixes.

* python bindings.

* fix qemu_sugar.

* fix fuzzbench.

* fixed import issues.

* misc fixes.

* renamed crate.

* Updated x86_64 stub bindings.

* Fixed static naming.

* binding fmt

* clippy

* clippy

* Removed useless return statement.

* removed advice to install cargo-make in individual repositories.

* symcc_update (#1749)

* Remove unused create_anymap_for_trait macro (fixes #1719) (#1752)

* Fix `as_object` UB discussed in #1748 (#1751)

* Fix as_object UB discussed in #1748

* More cleanup, more less UB

* Fix fixes

* Added uninit_on_shmem api

* clippy

* fmt

* trying to fix fuzzers, libfuzzer wrapper

* Add OwnedRefMit::owned constructor, libfuzzer fix

* Some more fixes

* Add BacktaceObserver::owned fn

* fmt

* more fmt

* Ignore SigPipe by default (#1741)

* Ignore SigPipe by default

* Fix no_std

* fmt

* Fix incorrect imports (#1758)

* Fix incorrect imports

https://doc.rust-lang.org/core/simd/trait.SimdOrd.html

* Fix

* Try fix ci

* Documentation fixes (#1761)

* Documentation fixes

* Fix InProcessExecutor url

* Update all urls to latest

* Miri ignores for M1 regex (#1762)

* Enabling DrCov on Windows (#1765)

* Enabling DrCov for Windows

* Dedup common code in scheduler (#1702)

* dedup common code in scheduler

* del eco

* fixing

* fix

* replace `Emulator::new_empty` by `Emulator::get` calls outside of `emu.rs` for safety. (#1763)

* Add mute_inprocess_target fn, SimpleFdLogger::set_logger, and more (#1754)

* Add mute_inprocess_target fn, SimpleFdLogger::set_logger, set_error_print_panic_hook

* Trying to fix #1753

* typo

* More fix

* Fix test?

* more testcase fixes

* Fix: renamed remaining QemuInstrumentationFilter instances.

* Split emu in systemmode.rs / usermode.rs for specific code.
EmuExitHandler implementation.

* format

* format

* format

* Replace sync_exit with sync_backdoor.

* Rework command system.

* fix bad import.

* format.

* cargo fmt

* disable af-xdp as well to avoid linking errors.

* End of merging.

* format.

* Adaptation for usermode.

* format.

* injection support.

* usermode fixes.
format.

* clippy

* clippy + format

* Do not unwrap emu + format.

* fix: entry_point breakpoint

* inital commit.

* clippy

* tests

* clippy

* adapt example

* systemmode.

* renaming

* fmt

* fix lints.

* more lint fix.

* even more lint fixes.

* always more lint fixes.

* lint fix.

* allow unused qualifications for crate when it could be confusing.

* Still lint fixes.

* Lint fixes on generated code.

* Some lint fixes.

* merge continue.

* renamed modules as well.

* fixing merge.

* systemmode compiling.

* fmt

* fix early emulator drop.

* fmt

* fix cast to c_void of the wrong object.

* Added global enum for snapshot managers.
Some renaming.

* move things around.

* WIP: generic inclusion of QEMU Executor in exit handler.

* * Moved extern calls to `libafl_qemu_sys`
* Replaced old `Emulator` by `Qemu` and only kept C functions wrappers
* Now `Emulator` is for higher-level interactions with QEMU. Kept old functions for compatibility calling to `Qemu` functions
* A direct side effect of this slit is the removal of the `IsEmuExitHandler` trait dependency added in many parts of the code.
* Removed old dirty casting for `QemuExecutor` helpers and used the brand-new access to `QemuExecutorState` instead.
* Minor changes to `Qemu` and `Emulator` `get` methods for cleaner getters.

* Add missing `Qemu` function.

* Updated `qemu_systemmode` example.

* Adapted QEMU fuzzers + renaming.

* Fixed python.

* fix libafl_sugar with new implementation.

* fix dangling RefCell.
adapt new examples.
TODO: merge `libafl_systemmode.*` examples.

* clippy.

* fix more fuzzers.

* clippy.

* Implement `HasInstrumentationFilter` generically.
Updated `StdInstrumentationFilter` accordingly.

* Renamed breakpoint functions for QEMU.
`qemu.run()` handling.

* Removed OnceCell / RefCell in signature.
more explicit `MmapPerms` method names.

* minor code refactoring

* Emulator::run_handle refactoring

* deprecated Emulator functions calling directly to QEMU functions.

* IsSnapshotManager -> SnapshotManager

* IsEmuExitHandler -> EmuExitHandler + fmt

* Generic register when it makes sense.

* reverted IsSnapshotManager -> SnapshotManager because of a collision.

* fix syntax + clippy

* fmt

---------

Co-authored-by: Dongjia "toka" Zhang <tokazerkje@outlook.com>
Co-authored-by: Dominik Maier <domenukk@gmail.com>
Co-authored-by: lazymio <mio@lazym.io>
Co-authored-by: Bet4 <0xbet4@gmail.com>
Co-authored-by: mkravchik <mkravchik@hotmail.com>
2024-03-22 18:03:29 +01:00
Dominik Maier
7abc26ebc9
Change AnyMap API, add unsafe_ assert (#1958)
* Change AnyMap API, add unsafe_ assert

* clippy

* Add anymap serialize test

* Add test

* fmt
2024-03-20 14:45:23 +01:00
Dominik Maier
14fd3040bd
Remove hash for AnyMap (since it's a hashmap already) (#1951) 2024-03-19 20:41:15 +01:00
Dominik Maier
2efa747292
SerdeAnyMap: add unsafe_stable_anymap feature that uses type_name instead of TypeId::of (#1952)
* Test: Use type_name instead of type_id in AnyMap

* Hide behind 'unsafe_stable_anymap' feature

* nostd?

* rename fn

* cleanup a bit
2024-03-19 20:15:31 +01:00
am009
5eab4fb78b
Update tinyinst_simple to support Linux (#1316) (#1955)
* Make fuzzers/tinyinst_simple support Linux (#1316)

Fix a documentation error for `MmapShMemProvider`.

* Support shmem for `fuzzers/tinyinst_simple` on Linux.

Format code.

* Fix CI to install cxxbridge-cmd.

* Add `CARGO_TARGET_DIR` in makefile to fix CI.
2024-03-19 20:15:07 +01:00
Dominik Maier
a0143d02a6
Rename OSError -> OsError and merge with redundant Error::File (#1944)
* OSError -> OsError

* Move File errors to io Errors

* Removing File errors

* fixes :)

* More format

* fix libfuzzer runtime
2024-03-18 08:46:48 +01:00
Dongjia "toka" Zhang
44a37da680
Use const_assert not assert (#1949)
* stuff

* FMT
2024-03-16 03:33:20 +01:00
am009
93f67aa405
Fix os error printing in unix_shmem (#1406) (#1935)
Use `std::io::Error::last_os_error` instead of `libc::perror` for error printing in unix_shmem.
Add a new enum item `OSError` to enum Error.
2024-03-14 13:07:04 +01:00
Dominik Maier
4f3d9d2e50
Tiny optimization for into_vec (#1931)
* Tiny optimization for into_vec

* fix bug
2024-03-13 16:52:15 +01:00
Dominik Maier
dd410c590a
Allow dyn in StagesTuple, add Current Testcase API, Untraitify Progress (#1915)
* Move into_vec to extra trait

* fix no_std

* First step towards stages tuples as vecs

* Allow dyn in StagesTuple, add Current Testcase API, un-traitify Progress, cleanups

* Move from generics to impl keyword, more replacements with better API

* rename fn

* Fix additional stages, more cleanup, rename progress to retries

* Fix more fixes

* Fixes

* Rename ProgressHelper -> RestartHelper

* Fix sugar, python, add perform_restartable

* fixes

* remove prelude bs

* rename to restart_progress_should_run

* more cleanup, remove tests I don't understand (sorry)

* fix docs

* more fix

* fix miri

* unsafe safety annotations

* more comments

* last docs

* Mixed_attributes only allowed for bindgen
2024-03-12 00:58:07 +01:00
Dongjia "toka" Zhang
9b780cc0a7
Fix UB in anymap.rs and other minor warnings. (#1926)
* fix

* clippy

* fix
2024-03-11 18:15:56 +01:00
Dongjia "toka" Zhang
1b9f4ea29c
Fix batched timeout (#1920)
* fix ptr

* fix ptr

* fix

* One less windows warning

* One less windows warning
2024-03-07 23:52:56 +01:00
Dongjia "toka" Zhang
e3f837d712
Fix inconsistent settings of client_timeout (#1897)
* a

* fix client timeout

* revert

* more

* std

* import

* import

* sdt

* FMT

* backtick again
2024-03-05 17:58:44 +01:00
Dongjia "toka" Zhang
1a0e692f33
Print PID when you create a new Llmp Sender. (#1898)
* aaaa

* FMT

* adding std
2024-03-05 16:02:47 +01:00
Dongjia "toka" Zhang
95bed5b016
Fix the centralize disconnection bug. (#1896)
* fixing the first bug

* backtick
2024-03-05 15:49:35 +01:00
Romain Malmain
d96a1426d5
Fix lint errors (#1909)
* fix lints.

* more lint fix.

* even more lint fixes.

* always more lint fixes.

* lint fix.

* allow unused qualifications for crate when it could be confusing.

* Still lint fixes.

* Lint fixes on generated code.

* Some lint fixes.
2024-03-05 14:16:26 +01:00
Dominik Maier
b7efe8eb7d
Implement MutatorTuple for Vecs to allow Dynamic Mutator Choices (#1893)
* Implement MutatorTuple for Vecs to allow Dynamic Mutator Choices

* fix test

* clippy

* Move into_vec to extra trait

* fix no_std

* more nostd

* no_std
2024-03-04 22:48:38 +01:00
Addison Crump
8c773a6b85
Implement RetryProgress for limiting retry attempts in stages (#1890)
* do that again but smarter

* remember to register

* appease the clippy

* cleanup

* autofix clippy

* more clippy fixes

* more clippy...

* small clippy fix

* with_tries => with_retries

* most recent suggestions

* final clippy... hopefully
2024-02-28 14:12:28 +01:00
Dominik Maier
fafe8f5ce8
Fixing clippy some more (#1872)
* Fixing clippy some more

* more commit

* Git gud

* remove more useless imports
2024-02-19 16:46:06 +01:00
mkravchik
c837d0df7a
Pr/xxh3 rrmxmx mixer fix (#1828)
* Fixing the mixer according to the xxHash implementation

* Using Rust xxhash-rust instead of handwritten implementation

* Fixing the mixer according to the xxHash implementation - linking directly, not relying on bolts option

* clippy+fmt

* Removing rotation, as it causes issues

* Not using xxhash directly, relying on bolts

* Fmt
2024-02-14 11:45:47 +01:00
Dominik Maier
dede78159c
Remove unused shmem structs, update Nix (#1845)
* Remove unused shmem structs

* More unused stuff

* Unified crate versions, updated docker rust version

* clean up nix 27 mess?

* Windows?

* Fix frida

* Fix frida

* fix fuzzers with nix
2024-02-11 17:45:09 +01:00
Romain Malmain
9b82af4539
Configurable LLMP client timeout (#1838)
* LLMP client timeout is now configurable.

* fix example.

* Fix for no-std case.
Make default timeout private.

* Fix import.
2024-02-06 18:35:27 +01:00
Dominik Maier
244c6b0da5
QEMU: Fix injections build for hexagon, disable on system mode (#1821)
* Fix CI for Clippy, QEMU

* Clippy, fixes for system mode

* clippy

* clippy

* fixing new clippy
2024-01-30 04:25:14 +01:00
Karthik Prakash
07f9a9d06a
Remove create_serde_registry_for_trait macro (#1815)
* remove `create_serde_registry_for_trait` macro

* fix `clippy` errors

* fix formatting
2024-01-28 17:51:50 +01:00
Dominik Maier
0cb7b25f39
Replace static borrows with addr_of!, rust 2024 compatibility (#1800)
* Less UB

* fmt

* fix warning

* clippy fixes

* addr_of_mut allthethings

* removed duplicate import

* fix imports

* remove comment

* more windows

* fmt

* fix tests

* fixes

* qemu

* fix more cases, qemu

* fix

* fmt
2024-01-24 17:47:55 +01:00
Dongjia "toka" Zhang
001e132186
Fix windows after #1350 (#1801)
* fix

* apt update

* apt update

* a

* split even more

* tmate

* ci

* can't fix this shit

* s
2024-01-17 18:51:56 +01:00
David CARLIER
61718c4e88
bolts: fix static mutable use (#1793) 2024-01-16 14:32:42 +01:00
Addison Crump
ba8ca6723b
Resumable stages redux (#1780)
* initial stage refactor

* repair test

* redqueen

* fixup python bindings

* docs and clippy fixes

* misc hidden changes

* Status => Progress

* fix remaining fuzzers

* fix libafl_libfuzzer

* implement resume for nested stages

* deep testing for stage resumeability

* refactor: use let-else, docfix

* refactor in fuzzbench_forkserver_cmplog

* fmt

* actually use progress

* HasStageStatus => HasCurrentStage
2024-01-09 15:18:14 +01:00
Dominik Maier
a07563def0
Add mute_inprocess_target fn, SimpleFdLogger::set_logger, and more (#1754)
* Add mute_inprocess_target fn, SimpleFdLogger::set_logger, set_error_print_panic_hook

* Trying to fix #1753

* typo

* More fix

* Fix test?

* more testcase fixes
2024-01-01 23:14:59 +01:00
Dominik Maier
16a152267e
Ignore SigPipe by default (#1741)
* Ignore SigPipe by default

* Fix no_std

* fmt
2023-12-22 16:50:36 +01:00
Dominik Maier
c93291ab57
Fix as_object UB discussed in #1748 (#1751)
* Fix as_object UB discussed in #1748

* More cleanup, more less UB

* Fix fixes

* Added uninit_on_shmem api

* clippy

* fmt

* trying to fix fuzzers, libfuzzer wrapper

* Add OwnedRefMit::owned constructor, libfuzzer fix

* Some more fixes

* Add BacktaceObserver::owned fn

* fmt

* more fmt
2023-12-22 16:49:01 +01:00
Dominik Maier
4e7d2caa9f
Remove unused create_anymap_for_trait macro (fixes #1719) (#1752) 2023-12-22 16:48:43 +01:00
David CARLIER
ea61b79012
bolts/minibsod add openbsd arm64 support (#1724)
* bolts/minibsod adding openbsd arm64 part.

* disable core ids test on freebsd
2023-12-21 14:25:25 +01:00
Dominik Maier
68e7b203f5
Add file descriptor logger (#1742)
* Add file descriptor logger

* clippy

* Fix closing fds

* fix no_std, fmt

---------

Co-authored-by: Dongjia "toka" Zhang <tokazerkje@outlook.com>
2023-12-20 16:53:33 +01:00
Dongjia "toka" Zhang
78060ea308
0.11.2 (#1735) 2023-12-18 14:33:14 +01:00
Andreas
2f036b72e4
Make inner value of llmp Flags pub (#1725) 2023-12-15 20:58:05 +09:00
mkravchik
b336411516
Adding support for shutdown upon Ctrl+C on Windows for LLMP (#1704)
* Adding support for shutdown upon Ctrl+C on Windows for LLMP

* PR comments and clippy suggestions addressed

* Enable CI for PR branches and manually triggered CI

* Removed an empty line that broke compilation on some platforms

* Trying to fix nostd compilation

* Trying to fix nostd compilation for nightly toolchain

* Removing use that is unused on some platforms

* Trying to fix build on the nightly toolchain

* Trying to fix build on the nightly toolchain, take 2

* Unifying LlmpShutdownSignalHandler

* Fmt fix

* Making the handler pub(crate)

* Nightly toolchain fmt fixes

---------

Co-authored-by: Dongjia "toka" Zhang <tokazerkje@outlook.com>
2023-12-05 21:03:00 +01:00
Dongjia "toka" Zhang
fad59987d9
Better SigInt handler (#1710)
* fix simd

* better exit

* chg

* more

* more

* use

* change to proper name

* w

* aaaaaaa

* delete

* just separate them

* shell check
2023-12-04 20:06:11 +01:00
David CARLIER
c84629a2f8
bolts: fix solaris cpu binding (#1699)
Seems `PS_MYID` to save one syscall was not really working, explicit current id makes the test always pass.
2023-11-27 22:34:12 +01:00
Mrmaxmeier
84a87f1da8
bolts: support dump_registers for x86 linux (#1694)
* bolts: support dump_registers for x86 linux

* bolts: fix write_crash fault addr for linux/x86
2023-11-26 16:39:16 +01:00
Dongjia "toka" Zhang
16af5debbe
Fix aggreagator ui (#1693)
* fix

* more

---------

Co-authored-by: Andrea Fioraldi <andreafioraldi@gmail.com>
2023-11-24 13:50:57 +01:00
s1341
ba394c4acc
Fix LLMP map reuse overflow for slow brokers (#1679)
* Attempt to fix llmp refcounting

* readers->readers_count

* Removed refcounting for now, fixed

* fixes

* fixes

* add extra debug assert, remove duplicate line

* semicolons are pain :)

* Add comment

* oooooops, bugfix

* fmt

* Fix calcualtion in in_shmem

---------

Co-authored-by: Dominik Maier <dmnk@google.com>
Co-authored-by: Dominik Maier <domenukk@gmail.com>
2023-11-21 16:48:17 +01:00
Addison Crump
281524dbf9
Unicode-preserving mutators (#1542)
* create the string classification stage

* modify API to pre-group

* preserving mutator

* more meaningful test

* subproperty mutators + some fixes

* document, finalise, integrate with libafl_libfuzzer

* add example, fix for weird range select

* fix for introspection

* fix fuzzer build

* speed optimisation: allow, but do not require, stacking

* property => category

* token replacement

* fixup: rare case where rust does not agree on valid character

* fix CI again

* again again

* take two: dynamic unicode discovery

* oops

* fix: last byte is never selected

* opt: bias to smaller unicode categories

* fix test

* opt: precompute regions and fix tests

* cache and allow stacking

* document and update libafl_libfuzzer

* oops, use reverse

* fix bolts clippy error

* fixup part 2

* clippy

* part 2

* clippy warning allow

* clippy complaint

* use alloc not std

---------

Co-authored-by: toka <tokazerkje@outlook.com>
2023-11-21 00:41:16 +01:00
David CARLIER
a013ad6085
bolts for haiku update (#1673)
core_affinity using available_parallelism which also support this
platform. further tests disabling.
2023-11-19 23:58:30 +01:00
Mark Giraud
0750a6c3ca
refactor: Remove unnecessary Debug trait bounds (#1667)
* refactor: Remove Debug supertraits

Instead of having the Debug trait as supertrait on several traits, the
Debug trait is now required in bounds in specific implementations that
need this specific trait. This keeps the API cleaner, since users now
don't have to propagate the Debug requirement if they don't need to use
the Debug trait.

* refactor: Reformat code
2023-11-15 20:26:12 +01:00
s1341
7acdeacae8
Allow compiling 32bit (#1666)
* Allow compiling for 32bit

* Fmt

* Clean up minibsod for 32bit

* fmt
2023-11-15 12:43:04 +01:00
Dongjia "toka" Zhang
d53503b73e
Fix stb image on windows (#1657)
* fix

* fix

* HOW DO I ADD FROM:FROM????

* ok
2023-11-08 15:20:35 +01:00
David CARLIER
bae24d9072
bolts: haiku, addressing clippy warnings (#1647) 2023-11-04 17:03:09 +01:00