aboutsummaryrefslogtreecommitdiffstats
path: root/pkg/osutil/osutil.go
Commit message (Collapse)AuthorAgeFilesLines
* pkg/osutil: fix CreationTimeDmitry Vyukov2026-01-091-4/+3
| | | | | | | | | | 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-091-0/+18
| | | | DiskUsage returns total recursive disk usage of the dir (similar to du -s).
* pkg/osutil: add Read/ParseJSON functionsDmitry Vyukov2025-11-171-0/+19
|
* 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/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-101-23/+0
| | | | | go install golang.org/x/tools/cmd/deadcode@latest deadcode -test ./...
* pkg/manager: show bug first timeDmitry Vyukov2025-01-171-0/+6
| | | | | 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
* syz-fuzzer: use of monotonic time for latency measurementDmitry Vyukov2024-04-021-0/+12
| | | | | 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-241-5/+5
|
* all: ioutil is deprecated in go1.19 (#3718)Taras Madan2023-02-231-5/+4
|
* 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
* 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: 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-201-3/+13
| | | | | 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/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-151-22/+18
|
* 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-141-10/+23
| | | | 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.
* pkg/osutil: remove appengine tagDmitry Vyukov2020-07-061-1/+8
| | | | | 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-061-5/+1
| | | | It's not present in Go 1.11.
* pkg/bisect: minor style fix upsDmitry Vyukov2020-07-021-4/+10
|
* 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: kill subprocesses more reliablyDmitry Vyukov2019-03-181-0/+2
| | | | | | | | | | 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.
* pkg/osutil: return output with errors from RunDmitry Vyukov2019-03-171-1/+1
| | | | | | | | | Turns out git bisect fails to communicate some outcomes (multiple potential commits), and the only way to understand what happened is parsing plain English output. Extracting the output from the error is quite unhandy. So return it with the error. Update #501
* pkg/runtest: fixes for fuchsiaDmitry Vyukov2018-09-061-4/+2
| | | | | | | Add simple fuchsia program, the one that is run during image testing. Fix csource errno printing for fuchsia. Fix creation of executable files (chmod is not implemented on fuchsia). Check that we get signal/coverage from all syscalls.
* pkg/osutil: minor tweaksDmitry Vyukov2018-08-031-4/+18
| | | | | | 1. Make it clear when a command times out. 2. Don't add trailing newline for VerboseError if output is empty. 3. Fix WriteExecFile for the case when the file already exists.
* pkg/host: check that we can open files rather than that they existDmitry Vyukov2018-07-101-0/+13
| | | | | | | See issue #640 where /dev/net/tun is present, but open fails with ENODEV. Check that we can actually open all these files. Fixes #640
* pkg/osutil: allow to provide own stdout/stderr during cmd executionDmitry Vyukov2018-07-051-2/+6
| | | | Useful if caller wants to collect only stdout or stderr.
* pkg/build: add gvisor supportDmitry Vyukov2018-06-221-6/+15
|
* pkg/kernel: allow to split full make outputDmitry Vyukov2018-05-171-2/+23
| | | | | | | | | | | Currently kernel build failures are insanely verbose (contain full kernel build output) and there is no way to separate short descriptions from full output. Make it possible. Also try to extract failure root cause froom build log. Use this in pkg/bisect to not pollute log on build failures. Update #501
* pkg/osutil: introduce TempFile helperDmitry Vyukov2018-05-141-0/+11
| | | | Introduce TempFile helper and use it in several packages.
* pkg/osutil: don't leace runaway processesDmitry Vyukov2017-11-161-14/+19
| | | | | | When manager is stopped there are sometimes runaway qemu processes still running. Set PDEATHSIG for all subprocesses. We never need child processes outliving parents.
* pkg/ipc, pkg/osutil: remove filepath.Abs fuchsia workaroundsDmitry Vyukov2017-10-121-8/+0
| | | | | This claimed to be fixed: https://fuchsia.atlassian.net/browse/DNO-158
* pkg/osutil: windows portDmitry Vyukov2017-09-251-0/+28
|
* all: more assorted fuchsia supportDmitry Vyukov2017-09-221-20/+0
|
* syz-manager, syz-hub: share repros between managers via hubDmitry Vyukov2017-08-071-0/+10
| | | | | | | | | | | | | | | | | Currently hub allows managers to exchange programs from corpus. But reproducers are not exchanged and we don't know if a crash happens on other managers as well or not. Allow hub to exchange reproducers. Reproducers are stored in a separate db file with own sequence numbers. This allows to throttle distribution of reproducers to managers, so that they are not overloaded with reproducers and don't lose them on restarts. Based on patch by Andrey Konovalov: https://github.com/google/syzkaller/pull/325 Fixes #282
* pkg/kernel: actually pass cmdline/sysctl files to the build scriptDmitry Vyukov2017-07-171-0/+11
|
* pkg/osutil: don't depend on syscall in appengine buildDmitry Vyukov2017-07-031-30/+0
| | | | | | Dashboard app now depends on osutil through config package. Reshuffle functions so that the package does not depend on syscall in appengine build.
* all: use consistent file permissionsDmitry Vyukov2017-07-031-7/+19
| | | | | | | | | | | | | | | | Currently we have unix permissions for new files/dirs hardcoded throughout the code base. Some places use 0644, some - 0640, some - 0600 and a variety of other constants. Introduce osutil.MkdirAll/WriteFile that use the default permissions and use them throughout the code base. This makes permissions consistent and also allows to easily change the permissions later if we change our minds. Also merge pkg/fileutil into pkg/osutil as they become dependent on each other. The line between them was poorly defined anyway as both operate on files.
* pkg/osutil: port to darwinDmitry Vyukov2017-06-261-3/+1
|
* pkg/osutil: add FilesExist/CopyFiles/LinkFiles functionsDmitry Vyukov2017-06-201-0/+70
| | | | Will be required by the new build system.
* pkg/osutil: fix IsExistDmitry Vyukov2017-06-191-1/+1
| | | | | Currently it returns true for "/some/existing/file/foo" because that returns ENOTDIR.