On Wed, Oct 14, 2015 at 8:35 PM, Sasha Levin <
sasha...@oracle.com> wrote:
> On 10/14/2015 11:20 AM, Dmitry Vyukov wrote:
>> On Wed, Oct 14, 2015 at 12:29 AM, Sasha Levin <
sasha...@oracle.com> wrote:
>>> On 10/13/2015 04:55 AM, Dmitry Vyukov wrote:
>>>> On Tue, Oct 13, 2015 at 4:51 AM, Sasha Levin <
sasha...@oracle.com> wrote:
>>>>>> On 10/12/2015 04:40 AM, Dmitry Vyukov wrote:
>>>>>>>> // autogenerated by syzkaller (
http://github.com/google/syzkaller)
>>>>>>
>>>>>> Hey Dmitry,
>>>>>>
>>>>>> Is there an easy way to run just the fuzzer inside a given VM? I'm doing
>>>>>> my testing inside kvmtool guests rather than qemu, and would rather not
>>>>>> use additional infrastructure or carry patches on top of your tree.
>>>> +syzkaller group
>>>>
>>>> Hi Sasha,
>>>>
>>>> syzkaller is a stateful fuzzer as opposed to trinity/iknowthis. The
>>>> state is meant to amplify fuzzer efficiency over time (at least that's
>>>> the plan). So a deployment should include a persistent process that
>>>> collects/distributes the state across a set of VMs/physical machines.
>>>>
>>>> I would happily incorporate code needed to run syzkaller with
>>>> kvmtools-based VMs. I understand the unwillingness to carry patches,
>>>> and in the end your setup can well be better than mine.
>>>>
>>>> The code to manage qemu-based VMs is in:
>>>>
https://github.com/google/syzkaller/blob/master/vm/qemu/qemu.go
>>>> I guess we just need to alter the commands to create/start kvm-tools
>>>> based VMs. Can you advise on what are these commands?
>>>
>>> It's mostly simple:
>>>
>>> ./vm sandbox -n mode=user -k [kernel bzimage] -d dir --no-dhcp -m [mem] -c [cpus] -p "kernel params" -- /runtrin.sh
>>>
>>> Which will utilize virtio-9p transport to boot a kernel using 'dir' as rootfs,
>>> and then run 'runtrin.sh' once the vm has booted (which is just my bootstrap
>>> to start trinity right now.
>>>
>>> The question here is what do you expect on the networking side? kvmtool has a
>>> pretty simple usermode networking, but it might need tap...
>>
>>
>> What is ./vm binary? Is it the same as lkvm binary described here
>>
https://git.kernel.org/cgit/linux/kernel/git/will/kvmtool.git/tree/Documentation/kvm-run.txt
>> ?
>
> Yeah, same one.
>
>> On networking side I expect two-way connectivity. I use scp/ssh to
>> deploy and run necessary binaries into a VM. And the binary inside of
>> VM connects back to a binary running on host. I use the following net
>> setup for qemu "-net user,host=1.2.3.4,hostfwd=tcp::23456-:22".
>> Scp/ssh access is probably not mandatory, especially if it uses a host
>> dir as disk. I can just put the binaries into the dir, and substitute
>> /runtrin.sh to start syzkaller.
>> But VM->host connectivity is mandatory in the current design.
>
> Ah, that should easily work out of the box. usermode networking defaults
> the host to 192.168.33.1, so connecting from inside the vm to any port on
> the host using that ip should work.
I got lkvm up and running.
I run it as:
./lkvm run --disk linux-0.2.img --mem=2048 --cpus=4 --kernel
arch/x86/boot/bzImage -n mode=user
However, networking does not work. When I ping 192.168.33.1 from
within VM, it says "Destination Host Unreachable".
I've also tried to run with "-n mode=user,host_ip=192.168.33.1" flag.
No success.
I also don't get how sandbox command works.
I've tried to run:
$ ./lkvm ... -- /bin/ls
but nothing happened. VM just booted as with lkvm run.
Was that program executed, and then boot process continues as usual?
ps does not work within the VM (image is obtained as described in README):
sh-2.05b# ps
[ 2.757686] ps[886]: segfault at f7736000 ip 00000000f772f737 sp
00000000fff64f00 error 4 in libproc.so.2.0.11[f7728000+a000]
Segmentation fault
so I can't check whether sandbox actually starts something or not...
Also should sandbox refer to a program on host or in VM image?
/bin/ls is present in both locations, so I would expect that to work anyways.