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

Packer needs qemu-img #228

Closed
M3noetius opened this issue Sep 11, 2023 · 2 comments
Closed

Packer needs qemu-img #228

M3noetius opened this issue Sep 11, 2023 · 2 comments

Comments

@M3noetius
Copy link

M3noetius commented Sep 11, 2023

Good afternoon,

In order to compile QEMU-NYX the --disable--tools is disabled [here].

Am I suppose to go to QEMU-nyx master [here] and compile the tool ?
I see that the changes are at the "block-backend.c" and I guess this will have an affect on the image used. [here] [git_blame]

~/kAFL/kafl/examples/templates/windows$ make build 
make[1]: Entering directory '/home/user/kAFL/kafl/examples/templates/windows'
packer init windows.pkr.hcl
source /home/user/kAFL/kafl/examples/templates/windows/../../venv/bin/activate && packer build -var-file win10.pkrvars.hcl windows.pkr.hcl
qemu.windows: output will be in this color.

Build 'qemu.windows' errored after 571 microseconds: Failed creating Qemu driver: exec: "qemu-img": executable file not found in $PATH

==> Wait completed after 600 microseconds

==> Some builds didn't complete successfully and had errors:
--> qemu.windows: Failed creating Qemu driver: exec: "qemu-img": executable file not found in $PATH

Thank you

@M3noetius M3noetius changed the title Vagrant needs qemu-img Packer needs qemu-img Sep 11, 2023
@Wenzel
Copy link
Contributor

Wenzel commented Sep 11, 2023

Hi @M3noetius and thank you for opening an issue.

I wasn't aware of the problem you are reporting, since I'm simply relying on the system package to get qemu-img tool, from /usr/bin/qemu-img (qemu-system-x86 package).

I'm not fully understanding all the QEMU-Nyx modifications at this stage.
However, the BlockBackend struct seems to be defined when QEMU_NYX is undefined.

#ifndef QEMU_NYX
struct BlockBackend {
    char *name;
    int refcnt;
    BdrvChild *root;

and judging from the blk_new functions, the only field added by Nyx is the cow_cache:
https://github.com/nyx-fuzz/QEMU-Nyx/blob/qemu-nyx-4.2.0/block/block-backend.c#L345

In any case, Packer and the Windows template here isn't configured to use the QEMU-Nyx binary that you built previously.
In fact, the PATH hasn't been modified to include kafl/kafl/qemu/x86_64-softmmu/qemu-system-x86_64.

So in my case, I also the system packaged QEMU to build the Windows template, and then fuzz it with QEMU-Nyx, doesn't seem to be a problem.

@il-steffen can you shed some lights regarding the block-backend.c modifications, and whether they are relevant for QEMU images being built ?

@Wenzel
Copy link
Contributor

Wenzel commented Oct 2, 2023

Closed by #234

@Wenzel Wenzel closed this as completed Oct 2, 2023
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

No branches or pull requests

2 participants