evo-syzkaller-ppdev-syzlang
Generates complete syzkaller syzlang device driver descriptions for the Linux ppdev (parallel port) subsystem.
Overview
Produces two files:
dev_ppdev.txt— syzlang descriptions with includes, resource, opener, all 28 ioctl variants, struct, and flag groupsdev_ppdev.txt.const— architecture-specific constant values for amd64 and 386
Key Domain Knowledge
IOCTL Encoding (x86)
- ppdev uses magic type char
'p'(0x70) for all ioctls _IO: dir=0, size=0_IOR: dir=2 (bit 31), size encoded in bits 16-29_IOW: dir=1 (bit 30), size encoded in bits 16-29- Formula:
(dir << 30) | (size << 16) | (type << 8) | nr
Architecture Differences
struct timevalis 16 bytes on amd64 (two 8-byte longs) but 8 bytes on 386 (two 4-byte longs)- This causes PPGETTIME and PPSETTIME to have different ioctl numbers per architecture
- All other ioctls have identical values across amd64 and 386
Complete IOCTL Coverage (28 total)
- 4
_IO(no-arg): PPCLAIM, PPRELEASE, PPYIELD, PPEXCL - 14
_IOW(input): PPSETMODE, PPWSTATUS(obsolete), PPWCONTROL, PPWDATA, PPWECONTROL(obsolete), PPWFIFO(obsolete), PPFCONTROL, PPDATADIR, PPNEGOT, PPWCTLONIRQ, PPSETPHASE, PPSETTIME, PPSETFLAGS - 10
_IOR(output): PPRSTATUS, PPRCONTROL, PPRDATA, PPRECONTROL(obsolete), PPRFIFO(obsolete), PPCLRIRQ, PPGETTIME, PPGETMODES, PPGETMODE, PPGETPHASE, PPGETFLAGS
Syzlang Direction Mapping
_IOR(kernel writes to user) →ptr[out, ...]_IOW(user writes to kernel) →ptr[in, ...]_IO(no data) → omit third argument entirely
Flag Groups
ieee1284_modes: 12 IEEE 1284 protocol mode constants fromlinux/parport.hppdev_flags: PP_FASTWRITE, PP_FASTREAD, PP_W91284PIC fromlinux/ppdev.h
Const File Format
- Header:
# Code generated by syz-sysgen. DO NOT EDIT. - Architecture line:
arches = 386, amd64 - Per-constant:
NAME = 386:value, amd64:value(arch-qualified format) - Values are decimal integers
- Constants must be sorted alphabetically (syzkaller convention)
Usage
import sys
sys.path.insert(0, '/app/environment/skills/evo-syzkaller-ppdev-syzlang/scripts')
from generate import write_files
write_files('/opt/syzkaller/sys/linux/dev_ppdev.txt', '/opt/syzkaller/sys/linux/dev_ppdev.txt.const')
Verification
cd /opt/syzkaller
make descriptions
make all TARGETOS=linux TARGETARCH=amd64