• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Windows support
2
3To update descriptions run (assumes `cl` cross-compiler is in PATH):
4```
5syz-extract -os=windows
6syz-sysgen
7```
8
9`sys/windows/windows.txt` was auto-extracted from windows headers with `tools/syz-declextract`.
10
11To build binaries:
12```
13make fuzzer execprog stress TARGETOS=windows
14REV=git rev-parse HEAD
15cl executor\executor_windows.cc /EHsc -o bin\windows_amd64\syz-executor.exe \
16	-DGIT_REVISION=\"$REV\" \
17	kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib \
18	shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib \
19	winmm.lib rpcrt4.lib Crypt32.lib imm32.lib Urlmon.lib Oleaut32.lib \
20	Winscard.lib Opengl32.lib Mpr.lib Ws2_32.lib Bcrypt.lib Ncrypt.lib \
21	Synchronization.lib Shell32.lib Rpcns4.lib Mswsock.lib  Mincore.lib \
22	Msimg32.lib RpcRT4.lib Rpcrt4.lib lz32.lib
23```
24
25To run `syz-stress`:
26```
27bin\windows_amd64\syz-stress.exe -executor c:\full\path\to\bin\windows_amd64\syz-executor.exe
28```
29
30Windows is supported by only `gce` VMs at the moment.
31To use `gce`, create a Windows GCE VM, inside of the machine:
32
33 - Enable serial console debugging (see [this](https://docs.microsoft.com/en-us/windows-hardware/drivers/devtest/boot-parameters-to-enable-debugging) for details):
34```
35bcdedit /debug on
36bcdedit /dbgsettings serial debugport:1 baudrate:115200 /noumex
37```
38
39 - Disable automatic restart in `sysdm.cpl -> Advanced -> Startup and Recovery`
40
41 - Setup sshd with key auth, [these](https://winscp.net/eng/docs/guide_windows_openssh_server) instructions worked for me.
42   Preferably use non-admin user. Save private ssh key.
43
44Then shutdown the machine, stop the instance and create an image from the disk.
45Then start `syz-manager` with config similar to the following one:
46
47```
48{
49	"name": "windows",
50	"target": "windows/amd64",
51	"http": ":20000",
52	"workdir": "/workdir",
53	"syzkaller": "/syzkaller",
54	"sshkey": "/id_rsa",
55	"ssh_user": "you",
56	"cover": false,
57	"procs": 8,
58	"type": "gce",
59	"vm": {
60		"count": 10,
61		"machine_type": "n1-highcpu-2",
62		"gce_image": "your-gce-image"
63	}
64}
65```
66