aboutsummaryrefslogtreecommitdiffstats
path: root/sys/netbsd
Commit message (Collapse)AuthorAgeFilesLines
* sys/syz-sysgen: serialize descriptions as gob and embedDmitry Vyukov2025-01-232-7/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Instead of generating Go files with descriptions serialize them as gob and compress with flate. This significantly reduces build time, go vet time, and solves scalability problems with some static analysis tools. Reference times (all after rm -rf ~/.cache/go-build) before: TIME="%e %P %M" time go install ./syz-manager 48.29 577% 4824820 TIME="%e %P %M" time go test -c ./prog 56.28 380% 6973292 After: TIME="%e %P %M" time go install ./syz-manager 22.81 865% 859788 TIME="%e %P %M" time go test -c ./prog 12.74 565% 267760 syz-manager size before/after: 194712597 -> 83418407 -57% even provided we now embed all descriptions instead of just a single arch. Deflate/decoding time for a single Linux arch is ~330ms. Fixes #5542
* pkg/host: explicitly disable syz_execute_funcDmitry Vyukov2024-04-291-1/+1
| | | | | | | | | Disable the syscall in descriptions rather than in the code. This makes it more visible for users that it's disabled, and makes it less special (will not need to move this logic to host). Also change the condition in syz-sysgen to be more precise, otherwise syz_execute_func becomes unused function.
* sys/netbsd: use a correct syscall const nameAleksandr Nogikh2023-10-041-1/+1
|
* sys/netbsd: neutralize compat_50_mknodAleksandr Nogikh2023-04-241-0/+21
| | | | | | Otherwise we may end up corrupting device memory. See https://groups.google.com/g/syzkaller-netbsd-bugs/c/Iy8-NZ_M9Ug/m/5jKKfncsAQAJ
* sys/netbsd: adding ipc and system management syscallsais23972022-07-204-0/+217
| | | | sys/netbsd: removing comments
* sys/netbsd: adding filesystem and device management related syscalls (#2640)Ayushi Sharma2021-10-2410-19/+312
| | | sys/netbsd: fixing descriptions
* sys: commit empty source filesDmitry Vyukov2021-04-211-0/+6
| | | | | | Commit empty files into generated packages, so that the tree is buildable even w/o generated files and Go tools continue to work.
* sys/netbsd: adding device driver's ioctl descriptions for NetBSD (#2080)Ayushi Sharma2021-03-2432-994/+1687
| | | | | | | | | | | | | | | | | | | | | | | | | * sys/netbsd: adding descriptions for device drivers & minor updation of syscall flags sys/netbsd: reordering rlimit_type sys/netbsd: reordering flags for stat(2) and mount(2) sys/netbsd: adding i2c and wscons device drivers sys/netbsd: adding desciptions for device drivers ioctls sys/netbsd: minor update in dev_wscons.txt sys/netbsd: updating descriptions of device driver files sys/netbsd: adding copyright statement to dev files sys/netbsd: minor changes in device driver files sys/netbsd: ioctl descriptions for /dev/tprof sys/netbsd: adding flags for tprof device driver * sys/netbsd: updating .const files
* pkg/compiler: check for unused resourcesDmitry Vyukov2020-08-043-22/+11
| | | | | | | | | | If a resource is never used as an input, it is not useful. It's effectively the same as using an integer. Detect such cases, they are quite confusing. Fix all existing errors in descriptions. This uncovered some interesting bugs as well, e.g. use of a completely unrelated fd subtype after copy-paste (while the resource that was supposed to be used there is completely unused).
* sys/netbsd: Adding syscalls related to mount(2),uname(2) and sockets (#1976)Ayushi Sharma2020-07-306-7/+86
| | | | | | | | | * sys/netbsd: Adding syscalls related to mount(2),uname(2) and sockets * sys/netbsd: Adding missing flags for fstatat(2) * sys/netbsd: reordering rlimit_type * sys/netbsd: reordering flags for stat(2) and mount(2)
* Adding ksem family of syscalls (#1972)Ayushi Sharma2020-07-262-0/+29
| | | | | | | | | * sys/netbsd: adding ksem related syscalls * sys/netbsd: adding missing header files to lwp.txt * sys/netbsd: updating descriptions for ksem family syscalls * sys/netbsd: updating descriptions for ksem family syscalls
* Adding stat(2) and statfs(2) related syscalls (#1855)Ayushi Sharma2020-06-264-2/+95
| | | | | | | | | | | | | | | * sys/netbsd: adding filesystem and communication syscalls * sys/netbsd: add fix for struct sockaddr_storage and profil(2) * sys/netbsd: add common ioctl(2) commands * sys/netbsd: resolving conflicts * sys/netbsd: adding stat() and statfs() related syscalls * sys/netbsd: adding missing flags for getfsstat(2) Co-authored-by: Siddharth M <siddharth.muralee@gmail.com>
* sys/netbsd: add common ioctl() commands (#1850)Ayushi Sharma2020-06-212-0/+25
| | | | | | | | | | | * sys/netbsd: adding filesystem and communication syscalls * sys/netbsd: add fix for struct sockaddr_storage and profil(2) * sys/netbsd: add common ioctl(2) commands * sys/netbsd: resolving conflicts Co-authored-by: Siddharth M <siddharth.muralee@gmail.com>
* sys/netbsd: increase syscall support (#1805)Ayushi Sharma2020-06-214-25/+94
| | | | | | | | | * sys/netbsd: increase syscall support * sys/netbsd: increase syscall support fixed * sys/netbsd: fixed mknod issue * sys/netbsd: add fix for getdents, futimes and setpriority
* sys/netbsd: adding filesystem and communication syscalls (#1826)Ayushi Sharma2020-06-176-15/+125
|
* sys/netbsd: improve vusb.txtm00nbsd2020-05-292-2/+1601
|
* executor: add support for USB fuzzing on NetBSDm00nbsd2020-05-191-0/+11
|
* sys/netbsd: increase syscall supportAyushi Sharma2020-05-152-0/+6
|
* sys/netbsd: add access(2)Ayushi Sharma2020-05-112-1/+8
|
* sys/netbsd: add __getcwd(2) (#1725)Ayushi Sharma2020-05-112-0/+2
|
* Makefile: generate descriptions on-the-flyDmitry Vyukov2020-04-302-2526/+0
| | | | | | | | | | | | | | | | | | Checking in the generated descriptions files makes few things simpler, but causes pain for pull requests: (1) PRs that touch descriptions _always_ conflict, (2) PRs are large and harder to review, (3) people sometimes forget to add auto-generated files. The proposed way does not require us to hardcode lots of dependencies in the Makefile (which is nice) and seem to work. Let's see how it works. The main contributor-visible consequence is that the auto-generated files do not need to be checked-in now. Credit for figuring the Makefile magic goes to @melver. Fixes #1291
* pkg/compiler: deduplicate Types in descriptionsDmitry Vyukov2020-04-261-941/+1522
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add prog.Ref Type that serves as a proxy for real types and allows to deduplicate Types in generated descriptions. The Ref type is effectively an index in an array of types. Just before serialization pkg/compiler replaces real types with the Ref types and prepares corresponding array of real types. When a Target is registered in prog package, we do the opposite operation and replace Ref's with the corresponding real types. This brings improvements across the board: compiler memory consumption is reduced by 15%, test building time by 25%, descriptions size by 33%. Before: $ du -h sys/linux/gen 54M sys/linux/gen $ time GOMAXPROCS=1 go test -p=1 -c ./prog real 0m54.200s real 0m53.883s $ time GOMAXPROCS=1 go install -p=1 ./tools/syz-execprog real 0m27.911s real 0m27.767s $ TIME="%e %P %M" GOMAXPROCS=1 time go tool compile ./sys/linux/gen 20.59 100% 3200016 20.97 100% 3445976 20.25 100% 3209684 After: $ du -h sys/linux/gen 36M sys/linux/gen $ time GOMAXPROCS=1 go test -p=1 -c ./prog real 0m42.290s real 0m43.230s $ time GOMAXPROCS=1 go install -p=1 ./tools/syz-execprog real 0m24.337s real 0m24.727s $ TIME="%e %P %M" GOMAXPROCS=1 time go tool compile ./sys/linux/gen 19.11 100% 2764952 19.66 100% 2787624 19.35 100% 2749376 Update #1580
* sys/netbsd: add lchmod(2) (#1687)Ayushi Sharma2020-04-213-1/+8
|
* pkg/compiler: refactor attribute handlingDmitry Vyukov2020-04-192-3/+3
| | | | | | | | | | | | Introduce common infrastructure for describing and parsing attribute instead of custom per-attribute code scattered across several locations. Change align attribute syntax from the weird align_N to align[N]. This also allows to use literal constants as N. Introduce notion of builtin constants. Currently we have only PTR_SIZE, which is needed to replace align_ptr with align[PTR_SIZE].
* executor: surround the data mapping with PROT_NONE pagesDmitry Vyukov2020-04-181-1/+1
| | | | | | | | | | | Surround the main data mapping with PROT_NONE pages to make virtual address layout more consistent across different configurations (static/non-static build) and C repros. One observed case before: executor had a mapping above the data mapping (output region), while C repros did not have that mapping above, as the result in one case VMA had next link, while in the other it didn't and it caused a bug to not reproduce with the C repro. The bug that reproduces only with the mapping above: https://lkml.org/lkml/2020/4/17/819
* prog: refactor target.MakeMmapDmitry Vyukov2020-04-181-1/+1
| | | | | | | | | | | Make MakeMmap return more than 1 call. This is a preparation for future changes. Also remove addr/size as they are effectively always the same and can be inferred from the target (will also conflict with the future changes). Also rename to MakeDataMmap to better represent the new purpose: it's just some arbitrary mmap, but rather mapping of the data segment.
* sys/linux: use PROT_EXEC for the data section mmapDmitry Vyukov2020-04-181-1/+1
| | | | | | | Turns out the mmap protection get out of sync between executor and C reproducers. C reproducers missed PROT_EXEC. Add PROT_EXEC for linux, freebsd and akaros.
* sys/netbsd: add minherit(2)ais2397@gmail.com2020-04-163-1/+18
|
* sys/netbsd: fix struct statais2397@gmail.com2020-04-132-32/+47
|
* sys/netbsd: adding chflags(2) syscalls (#1661)Ayushi Sharma2020-04-043-1/+37
|
* sys/netbsd: adding lwp syscalls (#1654)Ayushi Sharma2020-03-314-2/+21
|
* prog: rename target.SanitizeCall to NeutralizeDmitry Vyukov2020-03-171-3/+3
| | | | | | | | | | | | | We will need a wrapper for target.SanitizeCall that will do more than just calling the target-provided function. To avoid confusion and potential mistakes, give the target function and prog function different names. Prog package will continue to call this "sanitize", which will include target's "neutralize" + more. Also refactor API a bit: we need a helper function that sanitizes the whole program because that's needed most of the time. Fixes #477 Fixes #502
* pkg/compiler: calculate more precise sizes for argumentsDmitry Vyukov2020-03-171-34/+34
| | | | | | | | | | | | | | | | | | | | If we have: ioctl(fd fd, cmd int32) ioctl$FOO(fd fd, cmd const[FOO]) Currently we assume that cmd size in ioctl$FOO is sizeof(void*). However, we know that in ioctl it's specified as int32, so we can infer that the actual syscall size is 4. This massively reduces sizes of socket/setsockopt/getsockopt/ioctl and some other syscalls, which is good because we now use physical size in mutation/hints and some other places. This will also enable not morphing ioctl's into other ioctl's. Update #477 Update #502
* prog: remove unused ResourceDesc.TypeDmitry Vyukov2020-01-261-17/+17
|
* pkg/serializer: do not write field names if it won't save spaceDmitry Vyukov2020-01-261-751/+751
| | | | | | | If we are going to write all values, don't write field names. This only increases size of generated files. The change reduces size of generated files by 5.8% (62870496-59410354=3460142 bytes saved).
* pkg/compiler: don't mark flags with 0 as bitmaskDmitry Vyukov2020-01-181-19/+19
| | | | | | | They can't be a bitmask. This fixes important cases of "0, 1" and "0, 1, 2" flags. Fix some descriptions that added 0 to bitmasks explicitly (we should do it automatically instead).
* pkg/compiler: sort flags valuesDmitry Vyukov2020-01-181-62/+62
| | | | | | Will simplify runtime analysis of flags. Also just no reason to make it more deterministic and avoid unnecessary diffs in future if values are reordered.
* sys/netbsd: fix the build issues with posix_spawnSiddharth Muralee2019-12-053-15/+33
|
* make required changes to sys/netbsdSiddharth M2019-12-051-9/+10
|
* sys/netbsd: add the newer vfork syscallR3x2019-12-053-1/+5
|
* sys/netbsd: Added posix_spawn and fork syscallsR3x2019-12-053-1/+114
|
* pkg/compiler: define fileoff templatePaul Chaignon2019-11-011-7/+7
| | | | Signed-off-by: Paul Chaignon <paul.chaignon@orange.com>
* executor: add network packet injection for NetBSDSiddharth M2019-07-142-1/+36
| | | | | | | | | | | | * Initial Commit * working build of network packet fuzzing * Add missed csource file * pkg/csource: fix build * executor/common_bsd.h: Add comment stating reason for ifconfig create
* sys/netbsd: Adding more syscallsSiddharth M2019-07-017-1/+244
| | | | | | | | | | | | | | * sys/netbsd: Adding more syscalls * Added lwp create structures * Added a few lwp flags * completed _lwp* syscalls * add clone syscall * fix errors, recheck arguments
* sys/netbsd: Add new syscalls exit and ptraceR3x2019-06-263-1/+18
|
* .golangci.yml: add codeanalysis build tagDmitry Vyukov2019-05-151-1/+2
| | | | | | | | | Using a build tag to exclude files for golangci-lint reduces memory consumption (it does not parse them). The naive attempt with skip-dirs did not work. So add codeanalysis build tag and use it in auto-generated files. Update #977
* pkg/compiler: generate complex len targetsDmitry Vyukov2019-05-141-93/+93
| | | | Change the generated format for len type to support multiple path elements.
* pkg/compiler: make buffer alias to ptr[array[int8]]Dmitry Vyukov2019-04-011-30/+30
| | | | | | | | | | | Ptr type has special handling of direction (pointers are always input). But buffer type missed this special case all the time. Make buffer less special by aliasing to the ptr[array[int8]] type. As the result buffer type can't have optional trailing "opt" attribute because we don't have such support for templates yet. Change such cases to use ptr type directly. Fixes #1097
* pkg/csource: use 0 for missing syscall argsDmitry Vyukov2018-12-271-8/+8
| | | | | | | | | | | | | | We don't specify trailing unused args for some syscalls (e.g. ioctl that does not use its arg). Executor always filled tailing unsed args with 0's but pkg/csource didn't. Some such syscalls actually check that the unsed arg is 0 and as the result failed with C repro. We could statically check and eliminate all such cases, but it turns out the warning fires in 1500+ cases: https://gist.githubusercontent.com/dvyukov/e59ba1d9a211ee32fa0ba94fab86a943/raw/a3ace5a63f7281f0298f51ea9842ead1e4713418/gistfile1.txt So instead fill such args with 0's in pkg/csource too.
* sys: consistently mark all paddings as const[0]Dmitry Vyukov2018-12-102-5/+5
|