Skip to content

can't run nyx-based fuzzers #16

@epi052

Description

@epi052

I apologize for the vague title, but I'm not entirely sure where the real issue lies.

The problem

I was trying to get nyx_libxml2_standalone to run, as a precursor to writing my own nyx fuzzer.

when i cargo run, I get the following output (output hangs at the point you see a ctrl+c)

[!] libnyx: spawning qemu with:
 /home/epi/PycharmProjects/LibAFL/libafl_nyx/QEMU-Nyx/x86_64-softmmu/qemu-system-x86_64 -kernel /home/epi/PycharmProjects/LibAFL/libafl_nyx/packer/linux_initramfs/bzImage-linux-4.15-rc7 -initrd /home/epi/PycharmProjects/LibAFL/libafl_nyx/packer/linux_initramfs/init.cpio.gz -append nokaslr oops=panic nopti ignore_rlimit_data -display none -serial none -enable-kvm -net none -k de -m 512 -chardev socket,server,path=/tmp/nyx_libxml2/workdir/interface_0,id=nyx_interface -device nyx,chardev=nyx_interface,bitmap_size=65536,input_buffer_size=1048576,worker_id=0,workdir=/tmp/nyx_libxml2/workdir,sharedir=/tmp/nyx_libxml2/ -machine kAFL64-v1 -cpu kAFL64-Hypervisor-v1,+vmx
[QEMU-Nyx] Could not access KVM-PT kernel module!
[QEMU-Nyx] Trying vanilla KVM...
[QEMU-Nyx] NYX runs in fallback mode (no Intel-PT tracing or nested hypercall support)!
[QEMU-Nyx] Max Dirty Ring Size -> 1048576 (Entries: 65536)
[QEMU-Nyx] Warning: Attempt to use unsupported CPU model (PT) without KVM-PT (Hint: use '-cpu kAFL64-Hypervisor-v2' instead)
qemu-system-x86_64: warning: host doesn't support requested feature: CPUID.07H:EBX.hle [bit 4]
qemu-system-x86_64: warning: host doesn't support requested feature: CPUID.07H:EBX.rtm [bit 11]
[QEMU-Nyx] Dirty ring mmap region located at 0x7f39624bb000
^C[qemu-nyx] bye! (pid: 15451 / signal: 2)

Stuff I've looked at/tried

  • running cargo run as root
  • running the /tmp/nyx... dir with afl-fuzz
  • running nyx_libxml2_parallel

Based on the above output, I tried updating the -cpu value to match the hint. I did this by cloning libnyx pointing libafl's cargo.toml at my local copy, and then modifying the cmd variable.

i tried a few combinations:

  • -machine kAFL64-v1 -cpu kAFL64-Hypervisor-v2,+vmx
  • -machine kAFL64 -cpu kAFL64-Hypervisor-v2,+vmx
  • -machine kAFL64 -cpu kAFL64-Hypervisor-v1,+vmx

Environment info

I understand this may be a "me" problem, i.e. something wonky with my setup. Here's some relevant information.

uname -a 
Linux main 5.15.0-56-generic #62-Ubuntu SMP Tue Nov 22 19:54:14 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
lsmod | grep kvm
kvm_intel             368640  0
kvm                  1028096  1 kvm_intel
cat /sys/module/kvm/parameters/enable_vmware_backdoor 
Y
ls /sys/devices/intel_pt/format

branch  cyc_thresh  mtc         noretcomp   pt   pwr_evt
cyc     fup_on_ptw  mtc_period  psb_period  ptw  tsc

This may be important? No amount of running sudo modprobe kvm-intel pt_mode=1 will get the parameter below to reflect that value.

cat /sys/module/kvm_intel/parameters/pt_mode 
0

perf with intel-pt support works...?

sudo perf record -e intel_pt// -a sleep 1
[ perf record: Woken up 10 times to write data ]
[ perf record: Captured and wrote 14.937 MB perf.data ]

parting thoughts

is there a chance that qemu-nyx is falsely reporting kvm extension capability status?

I was poking around QEMU-Nyx's kvm checks, and as far as I can tell, my system CAN run intel-pt stuff. So, maybe the ioctl is falsely reporting on KVM_CAP_NYX_PT or KVM_CAP_NYX_FDL?

Idk, I'm at a loss at this point. Any help/clues would be greatly appreciated!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions