Skip to content

Conversation

@atharva-potdar
Copy link
Contributor

@atharva-potdar atharva-potdar commented Dec 30, 2025

As mentioned in #3530, this PR is working towards creating a system to easily build documentation for all crates in the Cargo workspace.

The current structure is that there is a Justfile in the root of the repository, which calls the Justfiles of each of the crates we've created/worked on. So, running just doc-all will build the docs for all the crates mentioned in the root Justfile.

I am aware that the pull request #3626 exists but it seems to be doing it for the fuzzers - I'll be sticking to 'crates/'. The root Justfile in that PR is vastly different to mine though, so please let me know about any suggestions on how I could make my PR compatible with the repository standards. I'll keep this PR as a draft for now and slowly work towards adding a Justfile to all the crates.

Edit: are the specified features for libafl_qemu's Justfile correct?

Progress (crates done):
  • libafl_bolts
  • libafl
  • libafl_targets
    • Resolved markdown rendering issue in docs by adding a newline between README.md and document-features
  • libafl_cc
    • Minor typo fixes in docs
  • libafl_derive
  • libafl_nyx
    • Recognized the cpio dependency, noted it down in its Justfile
    • Fixed intradoc links
  • build_id2
  • core_affinity2
  • exceptional
  • fast_rands
  • libafl_core
  • libafl_intelpt
  • libafl_sugar
  • libafl_tinyinst
  • libafl_unicorn
  • ll_mp
  • minibsod
  • no_std_time
  • ownedref
  • serde_anymap
  • shmem_providers
  • tuple_list_ex
  • libafl_libfuzzer
    • Bypassed build errors by setting RUSTFLAGS and RUSTDOCFLAGs to "--cfg clippy"
  • libafl_asan
  • libafl_asan_fuzz
  • libafl_asan_libc
  • libafl_qemu_runner
  • libafl_qemu_build
  • libafl_qemu_sys
  • libvharness_sys
  • libafl_qemu
    • Removed all default features and manually specified features
  • libafl_concolic_symcc_runtime
  • libafl_concolic_dump_constraints
  • libafl_concolic_runtime_test
  • libafl_concolic_symcc_libafl
  • libafl_frida
Progress (utils done):
  • build_and_test_fuzzers
  • ci_runner
  • ci_splitter
  • deexit
  • drcov_utils
  • gramatron_construct_automata
  • libafl_benches
  • libafl_jumper

The Justfile in the root directory calls the Justfile in each of the
crates' directory to compile the docs. Also, there was an issue with the
libafl_targets docs not rendering correctly. It was fixed by adding an
extra newline between README.md and document-features.
Some intradoc links had to be fixed in libafl_nyx.
Building the docs for this also requires cpio.
There are some issues with the docs of libafl_nyx i.e.
the README.md file does not get added to the docs.
After this commit, I am going to build every single doc
again and then go through everything built to check that
all links work, there are no typos and that all relevant
info gets added to the docs.
Also fixed docs issue with libafl_nyx and included README.md in the docs
namely - libafl_sugar, libafl_tinyinst, libafl_unicorn, ll_mp, minibsod,
no_std_time, ownedref, serde_anymap, shmem_providers, tuple_list_ex
@atharva-potdar atharva-potdar changed the title Add Justfiles for all crates/ Add Justfiles to build documentation for all crates/ Dec 31, 2025
This required a bypass where I had to pass in "--cfg clippy" to
RUSTFLAGS as well as RUSTDOCFLAGS.
The libafl_asan justfile was restructured such that the -fuzz and -libc
crates are now imported as modules. This means that they will have
separate namespaces, thus making it easier to avoid conflicts where
"doc" is defined in all three.
@atharva-potdar atharva-potdar changed the title Add Justfiles to build documentation for all crates/ Add Justfiles to build documentation for all workspace crates/ and utils/ Dec 31, 2025
@atharva-potdar
Copy link
Contributor Author

If this approach is alright then I'll add it to the GitHub workflow file as well. I have some concerns about the repetition in files though - a lot of the files are the same command.

Also not sure of a better approach for the libafl_libfuzzer where

Bypassed build errors by setting RUSTFLAGS and RUSTDOCFLAGs to "--cfg clippy"

@atharva-potdar atharva-potdar marked this pull request as ready for review December 31, 2025 09:11
@atharva-potdar atharva-potdar marked this pull request as draft December 31, 2025 12:10
@atharva-potdar
Copy link
Contributor Author

Trying to build the libafl_qemu docs in Github workflows gives this error:

Cannot find a suitable llvm-config, it must be a version equal or greater than the rustc LLVM version. Try specifying LLVM_CONFIG_PATH.: "Could not find llvm-config"

The build scripts make it so that if DOCS_RS=1 is set, then it skips the build phase - so it will not need llvm. But, the doc build for libafl_qemu fails after that because it has unresolved imports and types (logs attached below).

@domenukk do you have any idea on what the issue is here? The libafl_asan test is unrelated to my changes and is failing on a separate PR as well. The rest of the build works fine - locally, there are no errors (since llvm stuff is installed) and all docs for workspace crates as well as utils get built correctly.

The failing logs:
error[E0432]: unresolved imports `libafl_qemu_sys::libafl_qemu_remove_hw_breakpoint`, `libafl_qemu_sys::libafl_qemu_set_hw_breakpoint`
  --> crates/libafl_qemu/src/qemu/mod.rs:32:23
   |
32 | use libafl_qemu_sys::{libafl_qemu_remove_hw_breakpoint, libafl_qemu_set_hw_breakpoint};
   |                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no `libafl_qemu_set_hw_breakpoint` in the root
   |                       |
   |                       no `libafl_qemu_remove_hw_breakpoint` in the root
   |
help: a similar name exists in the module
   |
32 - use libafl_qemu_sys::{libafl_qemu_remove_hw_breakpoint, libafl_qemu_set_hw_breakpoint};
32 + use libafl_qemu_sys::{libafl_qemu_remove_breakpoint, libafl_qemu_set_hw_breakpoint};
   |
help: a similar name exists in the module
   |
32 - use libafl_qemu_sys::{libafl_qemu_remove_hw_breakpoint, libafl_qemu_set_hw_breakpoint};
32 + use libafl_qemu_sys::{libafl_qemu_remove_hw_breakpoint, libafl_qemu_set_breakpoint};
   |

error[E0432]: unresolved imports `libafl_qemu_sys::libafl_load_qemu_snapshot`, `libafl_qemu_sys::libafl_qemu_current_paging_id`, `libafl_qemu_sys::libafl_save_qemu_snapshot`, `libafl_qemu_sys::qemu_cleanup`
  --> crates/libafl_qemu/src/qemu/systemmode.rs:10:58
   |
10 |     GuestAddr, GuestPhysAddr, GuestUsize, GuestVirtAddr, libafl_load_qemu_snapshot,
   |                                                          ^^^^^^^^^^^^^^^^^^^^^^^^^ no `libafl_load_qemu_snapshot` in the root
11 |     libafl_page_from_addr, libafl_qemu_current_paging_id, libafl_qemu_run,
   |                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |                            |
   |                            no `libafl_qemu_current_paging_id` in the root
   |                            help: a similar name exists in the module: `libafl_qemu_current_cpu`
12 |     libafl_save_qemu_snapshot, qemu_cleanup,
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^  ^^^^^^^^^^^^ no `qemu_cleanup` in the root
   |     |
   |     no `libafl_save_qemu_snapshot` in the root

error[E0412]: cannot find type `DeviceSnapshotKind` in crate `libafl_qemu_sys`
  --> crates/libafl_qemu/src/qemu/systemmode.rs:80:43
   |
80 |     fn enum_id(&self) -> libafl_qemu_sys::DeviceSnapshotKind {
   |                                           ^^^^^^^^^^^^^^^^^^ not found in `libafl_qemu_sys`

error[E0412]: cannot find type `SyxSnapshot` in crate `libafl_qemu_sys`
  --> crates/libafl_qemu/src/emu/systemmode.rs:97:50
   |
97 | pub type FastSnapshotPtr = *mut libafl_qemu_sys::SyxSnapshot;
   |                                                  ^^^^^^^^^^^ not found in `libafl_qemu_sys`

Some errors have detailed explanations: E0412, E0432.
For more information about an error, try `rustc --explain E0412`.
error: could not document `libafl_qemu`
error: Recipe `doc` failed on line 2 with exit code 101

@atharva-potdar
Copy link
Contributor Author

atharva-potdar commented Jan 1, 2026

ubuntu-doc-build now successfully runs! I changed it to build usermode instead of systemmode docs. I'll go through the changes one more time to see if I had anything to do with the currently failing CI/CD tasks and if there's anything I can fix in the docs itself (not correctly formatted, typos etc.) before making this ready for review.

Edit: to my knowledge, the failed CI/CD checks are unrelated to my changes.

@atharva-potdar atharva-potdar marked this pull request as ready for review January 2, 2026 08:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant