Hi Vitaly, thanks again for taking the time to discuss this.
> Then that means we'll need to upgrade QEMU.
I previously made an error when I said I tested the QEMU 3.0 binary
without S2E. I ran the S2E’s QEMU with the QEMU command line interface
instead of from an S2E project. But the QEMU itself is modified in S2E
so that was not correct.
I have been trying to download and test a clean version of QEMU 3.0 to
properly test and see if USB passthrough works on that version.
Unfortunately, I have not been able to fix what I believe is some
dependency issue with X11. There are errors with an unknown type name
“Window” during the make process.
> You could also try with QEMU 3.1, 4.0, 5.0, or whatever minimum version works. If 3.1 works, it may be easy to add S2E commits on top.
I was able to build QEMU 4.0 without issues. There the USB device
passes through properly in lsusb but the udev error is still present,
so that may be benign. I could start looking into patching S2E commits
on top of QEMU 4.0 but not properly testing 3.0 makes me think the
problem still may be with S2E.
For what my group would like to test we need functional deep
suspension in the VM (our goal is to investigate some of the power
management bugs within drivers such as how interrupt handlers
interfere with suspend/sleep events). Currently, I see only s2idle is
supported in the VM and issuing a systemctl suspend does not work
properly and there is some workqueue call trace in the dmesg.
I understand that S2E was likely designed without considering suspend
since it normally will not be used in S2E. Would you have any ideas on
if these issues originate from the S2E VM image or the DBT-based KVM
Implementation? I am specifically wondering if the DBT emulation on
its own would be causing issues with suspend since I am not interested
in symbolic execution, just the coverage. If not, perhaps I could
somehow utilize just that portion of S2E as essentially a hypervisor
with LCOV.
On Tue, Oct 1, 2024 at 2:58 PM 'Vitaly Chipounov' via S2E Developer
Forum <
s2e...@googlegroups.com> wrote:
>
> Hi,
>
> On Tue, Oct 1, 2024 at 2:38 AM Darrion Ramos <
darrio...@gmail.com> wrote:
>>
>> I have not added anything in the bootstrap file for USB. I am just specifying the following within the launch-s2e.sh: -usb -device nec-usb-xhci -device usb-host,vendorid=xxxx,productid=xxxx. Is there something else I need to specify in the bootstrap?
>
>
> That sounds right, there is nothing to put in bootstrap.sh besides the pci bus rescan. Since the snapshot was taken without USB, the guest needs to refresh the devices. Here's how it looks for me before and after rescan:
>
> QEMU sees the host device:
>
>
> Unfortunately, lsusb is still empty. I don't know why. I added the following commands to my bootstrap.sh:
>
> sudo dhclient
> sudo apt-get install usbutils
> echo 1 | sudo tee /sys/bus/pci/rescan
>
>
>>
>>
>> Yes it works with vanilla qemu, but I was not aware s2e was using qemu 3.0. When I tried running the qemu 3.0 binary without s2e it similarly failed to pass through the USB device. Is there a reason s2e uses qemu 3.0? I do not know the extent of the modifications, but I am assuming it's not very feasible for me to add the s2e modifications to a newer qemu version. Perhaps you know of a different pass-through solution?
>
>
> Then that means we'll need to upgrade QEMU. There is no particular reason it uses 3.0, I didn't get a chance to upgrade it. Doing so is conceptually straightforward [1], you need to apply the S2E commits on top of the current version (disk snapshots, kvm extensions mostly). Probably a month or two of full time work if you have no prior knowledge of QEMU internals. Alternatively, you could check what changed in the USB stack between 3.0 and the current version, then cherry-pick the changes. You could also try with QEMU 3.1, 4.0, 5.0, or whatever minimum version works. If 3.1 works, it may be easy to add S2E commits on top.
>
> Vitaly
>
> [1]
http://s2e.systems/docs/DesignAndImplementation/KvmInterface.html
>
>>
>>
>> On Mon, Sep 30, 2024 at 5:15 AM 'Vitaly Chipounov' via S2E Developer Forum <
s2e...@googlegroups.com> wrote:
>>>
>>> Hi,
>>>
>>> The warnings in the screenshot are benign. Regarding USB, did you make it work with vanilla QEMU? S2E uses QEMU 3.0, so a first step would be to check that it works there without S2E.
>>> I suppose you added the required USB hardware to the command line in bootstrap.sh (alongside your nic settings). You might need to trigger a pci bus rescan in the guest to detect it.
>>>
>>> Vitaly
>>>
>>> On Sun, Sep 29, 2024 at 4:03 AM Darrion Ramos <
darrio...@gmail.com> wrote:
>>>>
>>>> Hi Vitaly, thanks for fixing the crash and your suggestions.
>>>>
>>>> I was able to get the SSH to work with the dhclient command. I was also able to add my other configurations in the bootstrap once I understood that you were booting from a snapshot so my modifications to the guestfs were not doing anything.
>>>>
>>>> Also, regarding the USB pass-through. I was able to recompile the qemu binary with the proper support. But the passthrough is not working properly. lsusb outputs nothing on the VM, not even a hub. Is there some configuration needed in the image creation to allow this? When unplugging and reinserting the usb keyboard there is a udev error as you can see in the last line of this screenshot. I have read that this may be due to a dated libusb issue but this should be using the same version I used when building qemu from source. Unless s2e has its own isolated libusb version it is using. Do you know of any s2e configurations or anything else that could be affecting this? The device passes through fine with standalone qemu.
>>>>
>>>> Lastly, should I be concerned about the other warnings in the screenshot? It doesn't look like I need to but just double checking.
>>>>
>>>>
>>>>
>>>>
> To view this discussion on the web visit
https://groups.google.com/d/msgid/s2e-dev/CACjSjctdric%3DKDt-tDVQWnQjpQnRGyj%3DvDiHh8Ktn5V__2L-Qw%40mail.gmail.com.
--
-Thanks, Darrion