Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LibAFL_QEMU: Don't return a generic Address from Register reads #2681

Merged
merged 5 commits into from
Nov 13, 2024

Conversation

domenukk
Copy link
Member

No description provided.

@@ -138,7 +138,7 @@ where
qemu: Qemu,
arch_regs_map: &'static EnumMap<ExitArgs, Regs>,
) -> Result<Self::OutputCommand, CommandError> {
let input_virt_addr: GuestVirtAddr = qemu.read_reg(arch_regs_map[ExitArgs::Arg1])?;
let input_virt_addr: GuestVirtAddr = qemu.read_reg(arch_regs_map[ExitArgs::Arg1])?.into();
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rmalmain Don't really understand why GuestVirtAddr can be a different size to GuestReg, but anyway not a big issue

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is more for semantic purposes, most of the time len(GuestReg) = len(GuestVirtAddr) >= len(GuestPhysAddr).
so we could just use GuestReg everywhere in theory i think.
it's just convenient to know what exactly we manipulate with the type.

@domenukk
Copy link
Member Author

This is done, CI is flakey because of Libafl-fuzz

@rmalmain
Copy link
Collaborator

looks good, thanks

@rmalmain
Copy link
Collaborator

i guess we could do something similar for register writes as well

@domenukk
Copy link
Member Author

Writes are not necessary, usually the compiler can figure out the types. But up to you.

@domenukk domenukk merged commit 0ef0684 into main Nov 13, 2024
99 of 100 checks passed
@domenukk domenukk deleted the qemu_reg branch November 13, 2024 01:14
riesentoaster pushed a commit to riesentoaster/LibAFL that referenced this pull request Nov 21, 2024
…lusplus#2681)

* LibAFL_QEMU: Make ReadReg always return GuestReg type

* Don't return a generic address

* fix fuzzers

* fix mips
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.

2 participants