aboutsummaryrefslogtreecommitdiffstats
path: root/pkg/csource/gen.go
Commit message (Collapse)AuthorAgeFilesLines
* pkg/csource: replace go:generate with go:embedDmitry Vyukov2024-05-081-88/+0
| | | | | | | go:embed is a more modern way to do this and it does not require a special Makefile step. Since go:embed cannot use paths that contains "..", the actual embeding is moved to executor package.
* all: go fix everythingDmitry Vyukov2024-04-261-1/+0
|
* all: remove akaros supportDmitry Vyukov2024-04-151-1/+0
| | | | | | | Akaros support is unused, it was shutdown on syzbot for a while, the akaros development seems to be frozen for years as well. We have a bunch of hacks for Akaros since it supported only super old gcc and haven't supported Go. Remove it.
* executor: detangle common_openbsd.h out of common_bsd.hGreg Steuck2023-04-271-0/+1
|
* executor: update to match the new `syz_mount_image` callHrutvik Kanabar2022-11-211-0/+1
| | | | | | Update the executor to handle the new `syz_mount_image`/`syz_part_table` pseudo-syscalls. It now expects compressed images, and decompresses them using the new `common_zlib.h` header file before mounting.
* executor: add `zlib` decompression header fileHrutvik Kanabar2022-11-211-2/+5
| | | | | | | | | | | | | | Create a header file to provide a clean entrypoint `puff_zlib_to_file()`, which decompresses `zlib` data from an array to a file. This will be used for pseudo-syscalls which accept compressed data, e.g. `syz_mount_image`. The implementation uses a slightly-modified version of `puff.{c,h}`, found in the `zlib` repository. We have to be careful to ensure the copyright information from `puff.{c,h}` gets included in generated C code and C reproducers. Therefore, introduce the `//%` pattern to indicate comments which should not be removed by code generation, and use this pattern for the copyright notice.
* executor: added code to run Android with System accountAndrey Artemiev2022-07-191-0/+4
|
* executor: add extension point for adding non-mainline pseudo-syscallsDmitry Vyukov2022-01-191-0/+1
| | | | | | | | | | Add an empty common_ext.h which is included into executor and C reproducers and can be used to add non-mainline pseudo-syscalls w/o changing any other files (by replacing common_ext.h file). It would be good to finish #2274 which allows to add pseudo-syscalls along with *.txt descriptions, but #2274 is large and there are several open design questions. So add this simple extension point for now.
* executor/common_kvm_ppc64: fix KVM supportAlexey Kardashevskiy2021-07-191-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | Turns out the ifuzz on powerpc did not ever properly work. This fixes syz_kvm_setup_cpu$ppc64: Enable the PAPR KVM capability (otherwise KVM_RUN fails right away). Finish generated sequences with the software debug breakpoint as there is no x86's "hlt" variant on POWER and otherwise KVM won't exit. Add exception handlers, use the software debug breakpoint instruction to trigger immediate exit from KVM with the only exception of the decrementer interrupt handler (timer) to recharge the timer and continue. Define and use endianness selection flag (Big vs. Little endian). Define the code generator similar to kvm_gen.cc which for now contains 2 simple tests and the decrementer interrupt handler code. Add test cases to the executor so "bin/linux_ppc64le/syz-executor test" can run some sensible tests. The tests copy 0xbadc0de around similar to x86 and uses gpr[3] is a return value register (similar to EAX). Signed-off-by: Alexey Kardashevskiy <aik@linux.ibm.com>
* executor: prepare code generator to allow other achitecturesAlexey Kardashevskiy2021-07-191-1/+1
| | | | | | | At the moment only AMD64 is supported, change file names to emphasise this. Signed-off-by: Alexey Kardashevskiy <aik@linux.ibm.com>
* pkg: update generated files to go 1.17Alexey Kardashevskiy2021-07-071-1/+2
| | | | | | | | | | | "make generate" produces this diff when go 1.17 (go1.17-c95464f0ea3f==upstream) is used. Seems compatible with >=1.16. https://github.com/golang/go/commit/4d2d89ff42ca documents the syntax. https://github.com/golang/go/commit/eeadce2d8713 enforces "ignore" for unsatisfiable tags hence the pkg/csource/gen.go change. Signed-off-by: Alexey Kardashevskiy <aik@linux.ibm.com>
* all: use tool.Failf instead of local functionsDmitry Vyukov2020-12-251-9/+6
|
* pkg/ifuzz/powerpc: add powerpc supportAlexey Kardashevskiy2020-11-201-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | This adds KVM's syz_kvm_setup_cpu pseudo syscall. This adds placeholder for options (none implemented yet). This adds instruction generator for ifuzz; this also adds a few pseudo instructions to simulate super/hyper/ultracalls (a PPC64/pseries platform thing). The insns.go is generated from PowerISA_public.v3.0B.pdf [1] by a horrendous python3 script on top of pdftotext. The ISA covers POWER9 which is the latest available POWER CPU at the moment. The next ISA for POWER10 is quite different and we will deal with it later. The // comment after every instruction is a fixed opcode list for verification purposes. This does not define DecodeExt as there is no obvious replacement of the Intel XED library for POWERPC (gapstone-capstone, later, may be). [1] https://openpowerfoundation.org/?resource_lib=power-isa-version-3-0 Signed-off-by: Alexey Kardashevskiy <aik@linux.ibm.com>
* all: mark auto-generated filesDmitry Vyukov2020-07-291-1/+1
| | | | | | | | | | Use the standard Go convention for Go files: https://golang.org/pkg/cmd/go/internal/generate Use github linguish for other files: https://github.com/github/linguist#generated-code Both are understood by github and should result in these files being collapsed in PRs by default.
* executor: add support for USB fuzzing on NetBSDm00nbsd2020-05-191-1/+2
|
* executor: split out Linux specific USB codeAndrey Konovalov2020-03-281-0/+1
|
* executor: add seccomp support for Androidmspectorgoogle2020-03-111-11/+25
| | | | | | | | | | This adds support for the seccomp filters that are part of Android into the sandbox. A process running as untrusted_app in Android has a restricted set of syscalls that it is allow to run. This is accomplished by setting seccomp filters in the zygote process prior to forking into the application process. The seccomp filter list comes directly from the Android source, it cannot be dynamically loaded from an Android phone because libseccomp_policy.so does not exist as a library on the system partition.
* tools: add script that checks copyright headersDmitry Vyukov2020-02-181-1/+1
| | | | Fixes #1604
* all: add basic USB fuzzing supportAndrey Konovalov2019-04-111-0/+1
| | | | | | | | | | | | This commits implements 4 syzcalls: syz_usb_connect, syz_usb_io_control, syz_usb_ep_write and syz_usb_disconnect. Those syzcalls are used to emit USB packets through a custom GadgetFS-like interface (currently exposed at /sys/kernel/debug/usb-fuzzer), which requires special kernel patches. USB fuzzing support is quite basic, as it mostly covers only the USB device enumeration process. Even though the syz_usb_ep_write syzcall does allow to communicate with USB endpoints after the device has been enumerated, no coverage is collected from that code yet.
* pkg/csource: rewrite gen.sh in GoDmitry Vyukov2018-07-271-0/+63
| | | | | | | | | | Shell files cause portability problems. On Linux it's hard to install /bin/sh, /bin/bash is not present on *BSD. Any solution is hard to test on Darwin. Don't even want to mention Windows. Just do it in Go.
* executor: overhaulDmitry Vyukov2018-07-241-50/+0
| | | | | | | | | | | | | | | | | Make as much code as possible shared between all OSes. In particular main is now common across all OSes. Make more code shared between executor and csource (in particular, loop function and threaded execution logic). Also make loop and threaded logic shared across all OSes. Make more posix/unix code shared across OSes (e.g. signal handling, pthread creation, etc). Plus other changes along similar lines. Also support test OS in executor (based on portable posix) and add 4 arches that cover all execution modes (fork server/no fork server, shmem/no shmem). This change paves way for testing of executor code and allows to preserve consistency across OSes and executor/csource.
* pkg/csource: support fuchsiaDmitry Vyukov2018-06-291-4/+17
| | | | Lots of assorted heavylifting to support csource on fuchsia.
* gometalinter: enable package comment checkingDmitry Vyukov2018-05-031-4/+4
| | | | Update #538
* pkg/csource: refactorDmitry Vyukov2017-12-171-0/+19
| | | | | | | csource.go is too large and messy. Move Build/Format into buid.go. Move generation of common header into common.go. Split generation of common header into smaller managable functions.
* csource: Fix sed(1) invocationzoulasc2017-11-061-4/+4
| | | | | | | | There is no need to specify '-' as the filename for sed(1): - The default behavior is to read stdin - It was not done in all places - It breaks on NetBSD sed(1) (although I am tempted to fix it now :-) and it does not work
* pkg/csource: add freebsd/netbsd supportDmitry Vyukov2017-10-261-0/+6
|
* pkg/csource: support akarosDmitry Vyukov2017-10-161-0/+12