aboutsummaryrefslogtreecommitdiffstats
path: root/pkg/osutil
Commit message (Collapse)AuthorAgeFilesLines
* pkg/osutil: fix CreationTimeDmitry Vyukov2026-01-093-9/+25
| | | | | | | | | | We return Ctime from CreationTime. But "C" does not stand for "creation", it stands for "status change" (inode update). It may or may not be the creation time. Use Btime (birth time) for creation time. Fixes #6547
* pkg/osutil: add DiskUsage functionDmitry Vyukov2026-01-097-103/+73
| | | | DiskUsage returns total recursive disk usage of the dir (similar to du -s).
* pkg/osutil: move Semaphore from pkg/instanceDmitry Vyukov2025-11-241-0/+42
| | | | | | | | Semaphore is a very low-level primitive type, while pkg/instance is a very high-level package with lots of deps. Semaphore does not belong there, and may lead to cyclic deps if we use it more. Move it to pkg/osutil. It's not really OS-specific, but we don't have a better package.
* pkg/osutil: add Read/ParseJSON functionsDmitry Vyukov2025-11-172-0/+40
|
* pkg/osutil: make VerboseError nest other errorsAleksandr Nogikh2025-10-011-17/+7
| | | | | After this change it fits more naturally into the Go's error functionality.
* pkg/manager: remove a dependency on grepAleksandr Nogikh2025-08-052-0/+44
| | | | | | Instead of calling grep (the implementations of which may differ in different environments), traverse the directory and grep files with a special pkg/osutil helper functionality.
* pkg/manager: add a test for PatchFocusAreasAleksandr Nogikh2025-07-222-13/+18
| | | | For that, make a part of the tar_test.go reusable.
* pkg/osutil: add tar.gz generation helpersAleksandr Nogikh2025-04-112-0/+127
|
* pkg/ifuzz: fix generate/buildDmitry Vyukov2025-04-031-0/+13
| | | | | | | Currently the commands we have in go:generate first create an empty file and then write final contents. This breaks any parallel builds of the source. Even running go generate ./... does not work. Write output files atomically.
* all: delete dead codeTaras Madan2025-02-106-151/+0
| | | | | go install golang.org/x/tools/cmd/deadcode@latest deadcode -test ./...
* pkg/manager: show bug first timeDmitry Vyukov2025-01-176-0/+31
| | | | | This allows to understand if a bug is new (found in the current run) or old.
* pkg/osutil: add a WriteJSON helperAleksandr Nogikh2024-12-201-0/+9
|
* tools/syz-declextract: accept manager configDmitry Vyukov2024-11-261-2/+5
| | | | | Make the tool accept a manager config. This will be required for dynamic extraction of info from the kernel.
* pkg/build: handle OOM-killed build errorSabyrzhan Tasbolatov2024-09-231-1/+1
| | | | | | | Handle SIGKILL (exit code = 137) on osutil.Run() during Linux kernel image building and return build.InfraError without reporting. Fixes: https://github.com/google/syzkaller/issues/5317
* all: go fix everythingDmitry Vyukov2024-04-265-5/+0
|
* all: remove akaros supportDmitry Vyukov2024-04-151-40/+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.
* syz-fuzzer: use of monotonic time for latency measurementDmitry Vyukov2024-04-022-0/+22
| | | | | time.Now/Since may reject to use monotonic time if the fuzzer messes with system time badly enough. Enforce use of monotonic time.
* all: use errors.As instead of .(type)Taras Madan2023-07-241-5/+8
|
* all: use special placeholder for errorsTaras Madan2023-07-245-12/+12
|
* all: ioutil is deprecated in go1.19 (#3718)Taras Madan2023-02-234-11/+7
|
* vm/starnix: add support for fuzzing starnix (#3624)juanPabloMiceli2023-01-191-0/+5
| | | | | | | This commit adds a new VM for fuzzing starnix. The VM will boot a fuchsia image using the `ffx` tool and will connect to an adb server inside it. Fuzzing will be done using HostFuzzer mode due to some features not being implemented yet in starnix. Once this is possible, fuzzing will be performed without HostFuzzer mode. Co-authored-by: Juampi Miceli <jpmiceli@google.com>
* syz-manager: extract fs images from reproducersAleksandr Nogikh2022-09-271-0/+14
|
* vm: add the proxyapp support (#3269)Taras Madan2022-09-261-0/+9
| | | | | | | * vm: add pool.Close() support * vm: add proxyapp client implementation * vm/proxyapp: autogenerate mocks * vm/proxyapp: add proxyapp tests * pkg/mgrconfig: add proxyapp type tests
* osutil: create memfd with the MFD_CLOEXEC flagAndrei Vagin2022-05-271-1/+1
| | | | | | | | Go-runtime opens all files with CLOEXEC by default. exec.Cmd doesn't close file descriptors in a child process and so memfd without CLOEXEC can leak to an executor process where its content can be corrupted by one of test system calls.
* all: use `t.TempDir` to create temporary test directoryEng Zer Jun2022-03-282-13/+2
| | | | | | | | | This commit replaces all `ioutil.TempDir` with `t.TempDir` in tests. The directory created by `t.TempDir` is automatically removed when the test and all its subtests complete. Reference: https://pkg.go.dev/testing#T.TempDir Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
* pkg/build: increase bazel aquery timeoutDmitry Vyukov2021-12-131-1/+1
| | | | | | We've got a timeout of "bazel aquery". It's currently set to 1 minute. On an overloaded machine it can fire falsely, I guess bazel can start only for 1 minute. Increase to 10 minutes.
* pkg/osutil: use memfd_create on LinuxAleksandr Nogikh2021-12-033-26/+84
| | | | | | | | | | Mmapping plain files as shared memory leads to extra burden on the system being fuzzed, because the OS will periodically sync that data to the disk. On Linux, use memfd_create to obtain a file handle for the shared memory region. Experiments have demonstrated than it leads to 5-10% increase in the fuzzing performance.
* pkg/osutil: slightly relaxed Abs checkDmitry Vyukov2021-10-251-9/+12
| | | | | | | | | | | Currently Abs captures pwd in init function and checks that it's not changing over program execution. However, in some test environments (bazel) we need to chdir in test init function because the test process is started in a wrong dir. This causes the check in Abs to fail. Query the pwd lazily on the first Abs call. This does not change behavior for Abs users, but allows to change pwd in other init functions.
* tools/syz-testbed: do not send SIGKILL to syz-managersAleksandr Nogikh2021-10-207-10/+24
| | | | | Doing so can result in syz-manager leaking GCE instances. Set PDEATHSIG to SIGTERM instead, so that syz-manager has a change to exit gracefully.
* pkg: update generated files to go 1.17Alexey Kardashevskiy2021-07-074-0/+4
| | | | | | | | | | | "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>
* pkg/osutil: extend error message on wd changeDmitry Vyukov2020-11-211-1/+1
| | | | Knowning the new wd may help to localize the error.
* sys/linux: descriptions for USB/IPNazime Hande Harputluoglu2020-10-021-0/+10
|
* pkg/osutil: fix LinkFiles/FilesExist for the new pattern formatDmitry Vyukov2020-09-152-57/+64
|
* syz-ci: fix seeds copyingDmitry Vyukov2020-09-141-15/+0
| | | | | | | | | | | | | 1. Copy seeds from syzkaller checkout into syzkaller build dir. They need to be stable. 2. Make the code generic (current is linux-specific). 3. Don't copy seeds to workdir/seeds. We can load them directly from sys/OS/test. There are some unresolved comments for LinkDir on #2053 anyway. Follow up to #2053
* pkg/osutil: support glob patterns in CopyFilesDmitry Vyukov2020-09-142-10/+120
| | | | Follow up to #2053
* syz-manager: add test file as corpusJiaheng Hu2020-09-141-0/+15
| | | | | | | This commit enables the syz-manager to add unit test files as corpus to accelerate fuzzing. The syz-ci would copy unit tests into the worker/seeds folder for each manager process, and the manager would add those tests as seed into the corpus.
* tools/syz-linter: fix comments checkDmitry Vyukov2020-07-101-1/+1
| | | | | | | Turns out ast.Inspect does not visit most comments. Walk file.Comments manually. Update #1876
* pkg/osutil: remove appengine tagDmitry Vyukov2020-07-0610-59/+12
| | | | | Appengine doesn't provide appengine tag anymore. Resort to use of syscall package for ExitStatus instead.
* pkg/osutil: don't use os.ProcessState.ExitCode on appengineDmitry Vyukov2020-07-063-5/+25
| | | | It's not present in Go 1.11.
* pkg/bisect: minor style fix upsDmitry Vyukov2020-07-021-4/+10
|
* pkg/osutil: use functionality from x/sys/unixTobias Klauser2020-06-291-18/+4
| | | | | | | | | | Use unix.Unmount instead of manually wrapping SYS_UMOUNT2. Use unix.IoctlSetPointerInt instead of manually wrapping SYS_IOCTL. This also allows to use FS_IOC_SETFLAGS instead of manually defining it for each GOARCH. Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
* pkg/osutil: implement support for linux/riscv64Tobias Klauser2020-06-261-1/+1
| | | | Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
* sys/linux: first 64bit big-endian architecture s390xAlexander Egorenkov2020-06-251-1/+1
| | | | | | | | | | | | | | | * mmap syscall is special on Linux s390x because the parameters for this syscall are passed as a struct on user stack instead of registers. * Introduce the SyscallTrampolines table into targets.Target to address the above problem. * There is a bug in Linux kernel s390x which causes QEMU TCG to hang when KASAN is enabled. The bug has been fixed in the forthcoming Linux 5.8 version. Until then do not enable KASAN when using QEMU TCG, QEMU KVM shall have no problems with KASAN. Signed-off-by: Alexander Egorenkov <Alexander.Egorenkov@ibm.com>
* .golangci.yml: enable nestif checkerDmitry Vyukov2020-06-051-14/+18
| | | | Prevents functions with too many nested if's.
* pkg/osutil: don't sandbox on CIDmitry Vyukov2020-05-181-1/+1
| | | | | | CI does not have syzkaller user, but may run under root. Update #1699
* Implement basic support for MIPS64LEJouni Hogander2019-12-171-1/+1
| | | | | | | | | Add basic stuff to enable MIPS64ELR2 target: - build - make extract - make generate - qemu execution - system call parsing from /proc/kallsyms
* vm: add workdir_template functionalityDmitry Vyukov2019-12-031-0/+24
| | | | | | | | | | | | | | | | | The new manager config argument workdir_template refers to a directory. Optional. Each VM will get a recursive copy of the files that are present in workdir_template. VM config can then use these private copies as needed. The copy directory can be referenced with "{{TEMPLATE}}" string. This is different from using the files directly in that each instance will get own clean, private, scratch copy of the files. Currently supported only for qemu_args argument of qemu VM type. Use example: Create a template dir with necessary files: $ mkdir /mytemplatedir $ truncate -s 64K /mytemplatedir/fd Then specify the dir in the manager config: "workdir_template": "/mytemplatedir" Then use these files in VM config: "qemu_args": "-fda {{TEMPLATE}}/fd"
* pkg/osutil: fix arm buildAndrey Konovalov2019-09-161-1/+1
| | | | pkg/osutil/osutil_linux.go:44:13: cannot use info.Totalram (type uint32) as type uint64 in return argument
* tools/syz-env: restrict Makefile parallelism based on RAMDmitry Vyukov2019-07-196-0/+26
| | | | | | | Ensure that we have at least 1GB per Makefile job. Go compiler/linker can consume significant amount of memory (observed to consume at least 600MB). See #1276 for context. Update #1276
* pkg/osutil: kill subprocesses more reliablyDmitry Vyukov2019-03-188-0/+26
| | | | | | | | | | In some cases we start scp, which starts ssh, then kill scp but the ssh subprocess is not killed. As the result cmd.Wait hangs waiting for EOF on the stdout/stderr, which are still kept alive by ssh subprocess. But ssh just hangs forever. Create a process group for each command and kill whole process group. Hopefully this will help.