Commit Graph

3822 Commits

Author SHA1 Message Date
Anton Lindqvist
85c573157d pkg/csource: add ability to annotate syscalls using comments in C reproducers
Providing additional info, especially regarding syscall arguments, in reproducers
can be helpful. An example is device numbers passed to mknod(2).

This commit introduces an optional annotate function on a per target basis.

Example for the OpenBSD target:

  $ cat prog.in
  mknod(0x0, 0x0, 0x4503)
  getpid()
  $ syz-prog2c -prog prog.in
  int main(void)
  {
    syscall(SYS_mmap, 0x20000000, 0x1000000, 3, 0x1012, -1, 0, 0);
    syscall(SYS_mknod, 0, 0, 0x4503); /* major = 69, minor = 3 */
    syscall(SYS_getpid);
    return 0;
  }
2019-05-24 22:33:56 +02:00
R3x
0dadcd9d91 pkg/build: Add the KCOV build commands 2019-05-23 08:48:16 +02:00
Dongliang Mu
84b9d38467 doc/linux: add one link for linux in the README.md (#1194) 2019-05-21 18:59:22 -07:00
Pascal Perez
0625bb5c4c sys/fuchsia: Updating Fuchsia definitions
Simply

	make extract TARGETOS=fuchsia SOURCEDIR=<FUCHSIA_DIR>/fuchsia
2019-05-21 14:55:36 -07:00
Pascal Perez
77beeccbe0 sys: Updating Fuchsia extraction scripts
Consolidating FIDL library build mappings in one place, so that it can
be used from extraction, and script invoking fidlgen. This also makes
code clearer, and provides a more natural path for evolutions / dealing
with oddities.

Minor doc update post fx command changes.
2019-05-21 14:55:36 -07:00
Dmitry Vyukov
13427bd9a9 pkg/vcs: disable CONFIG_SECURITY_TOMOYO_OMIT_USERSPACE_LOADER before v5.2
See https://groups.google.com/d/msg/syzkaller/mODXmnauUZM/HLZiO2UDBAAJ for context.
2019-05-21 16:50:29 +02:00
R3x
9809825e48 make changes to prevent failing build 2019-05-21 13:56:38 +02:00
Dmitry Vyukov
712bfcbdd8 pkg/runtest: test host.Setup
This would catch binfmt_misc breakage on non-linux.
2019-05-21 12:35:51 +02:00
Dmitry Vyukov
4adc00e894 syz-manager: reproduce leaks from hub
pkg/repro only enables leak checking when report type is MemoryLeak.
Since repros from hub always have Unknown type, repro won't reproduce leaks.
Always set report type to MemoryLeak on leak instances.
2019-05-21 12:25:10 +02:00
Dmitry Vyukov
f35ffcc16f pkg/host: don't enable binfmt_misc on non-linux
The csource options lack any relation to the tested OS,
while they do depend on the tested OS (most are linux-specific).
As the result we enable binfmt_misc, but its setup fails on anything
other than linux. As a work-around don't enable binfmt_misc on non-linux.
2019-05-21 12:23:44 +02:00
Dmitry Vyukov
d46b0931bd syz-fuzzer: setup host features during image testing 2019-05-21 12:22:58 +02:00
Dmitry Vyukov
40957b8193 executor: exit after first detected leak in C repros
Otherwise C repros print infinite stream of the same leaks again and again.
2019-05-21 12:00:02 +02:00
Dmitry Vyukov
e503f048b0 docs: don't duplicate manager config parameters
Currently we have them duplicated in docs/configuration.md
and the actual source in pkg/mgrconfig/config.go.
Documentation is missing in one place or another,
some is outdated, some is phrased slightly differently.
Move all docs to pkg/mgrconfig/config.go and reference it
from docs/configuration.md instead.
2019-05-21 11:47:51 +02:00
Dmitry Vyukov
8285069f89 executor: implement support for leak checking
Leak checking support was half done and did not really work.
This is heavy-lifting to make it work.

1. Move leak/fault setup into executor.
pkg/host was a wrong place for them because we need then in C repros too.
The pkg/host periodic callback functionality did not work too,
we need it in executor so that we can reuse it in C repros too.
Remove setup/callback functions in pkg/host entirely.

2. Do leak setup/checking in C repros.
The way leak checking is invoked is slightly different from fuzzer,
but much better then no support at all.
At least the checking code is shared.

3. Add Leak option to pkg/csource and -leak flag to syz-prog2c.

4. Don't enalbe leak checking in fuzzer while we are triaging initial corpus.
It's toooo slow.

5. Fix pkg/repro to do something more sane for leak bugs.

Few other minor fixes here and there.
2019-05-20 19:40:20 +02:00
Dmitry Vyukov
7b3084af2e syz-manager: don't repro non-leaks on leak instance
Leak checking is too slow to reproduce other bugs.
2019-05-20 19:40:20 +02:00
Dmitry Vyukov
32ebe81cf3 pkg/repro: fix no output timeout
We duplicated the no output timeout in the repro package,
and it got out of sync. It's not 3 mins now, but 5 mins.
Remove the duplication and fix this.
2019-05-20 19:40:20 +02:00
Dmitry Vyukov
2c9280d432 pkg/rpctype: use string type for leak frames
We need them as string everywhere.
Not sure why they were []byte to begin with.
2019-05-20 19:40:20 +02:00
Dmitry Vyukov
4d4a4420e7 pkg/report: add Type/Frame to Report
In several places we do special handling for some crash types.
Currently we compare report title with magic strings,
which is error-prone. Add explicit Type to reports.
2019-05-20 19:40:20 +02:00
Dmitry Vyukov
cddddce85a dashboard/config: update kmemleak config
Update to latest linux.
Enable configs enabled in the kasan config.
2019-05-20 19:40:20 +02:00
Dmitry Vyukov
33a268bd3b
docs: clarify syzbot handling of rebased trees 2019-05-20 18:14:07 +02:00
Greg Steuck
b5641f32bf docs/openbsd: Record gcloud commands used for /syzkaller 2019-05-20 17:59:02 +02:00
Dmitry Vyukov
5a4461b07f pkg/instance: fix types in OverrideVMCount
vmConfig value is interface{}, not string.
So compare with nil and assign int.
2019-05-18 08:41:48 +02:00
Dmitry Vyukov
40046286a4 dashboard/config: disable CONFIG_RETPOLINE
It slows down execution without any benefit for testing.
Who needs security anyways?
2019-05-17 13:21:31 +02:00
Dmitry Vyukov
95dfd515a0 sys/linux: improve binder descriptions
Refine some consts to increase changes of correct programs.
Fix some types. Add comments and a test.
2019-05-17 11:56:54 +02:00
Andrew Donnellan
2755003a34 pkg/report: Label powerpc unreliable stack frames as questionable
Add a second "questionable" regex to match the powerpc "(unreliable)"
format.

Signed-off-by: Andrew Donnellan <ajd@linux.ibm.com>
2019-05-17 07:15:52 +02:00
Andrew Donnellan
2233782fc1 pkg/report: Add powerpc's __switch_to to function skip list
Signed-off-by: Andrew Donnellan <ajd@linux.ibm.com>
2019-05-17 07:15:52 +02:00
Dmitry Vyukov
7fb690f39a sys/linux: improve binder descriptions
Always pass 3 objects in a transaction.
This allows to specify correct offsets for objects.
Let's see if this improves coverage.
2019-05-16 19:19:25 +02:00
Dmitry Vyukov
c4a2377034 dashboard/config: disable binder debug
Binder is too noisy with debug output.
Still noisy, but this at least removes part of constant output.
2019-05-16 18:56:49 +02:00
Dmitry Vyukov
b1165d81a4 sys/linux: use offsetof in ebtables
Resolve 2 TODOs in ebtables using the new offsetof type.
2019-05-16 18:26:31 +02:00
Dmitry Vyukov
76fc461b55 pkg/compiler: add offsetof type
Similar to C offsetof gives offset of a field
from the beginning of the parent struct.
We have several TODOs in descriptions asking for this.
2019-05-16 18:05:05 +02:00
Alexander Potapenko
f59a9cb554 Rebuild upstream-kmsan.config
Turns out I was using a stale KASAN config which didn't include TOMOYO
bits.
2019-05-16 11:10:34 +02:00
Greg Steuck
051c49fe0d
tools/create-openbsd: valid URIs must use a single slash (#1184)
Triggered by OpenBSD ftp upgrade which isn't looking kindly
at double slahses: https://marc.info/?t=155794126200001&r=1&w=2
2019-05-15 12:08:03 -07:00
Alexander Potapenko
27b25dbc1d util.sh: factor out util_add_extra_syzbot_configs 2019-05-15 16:23:44 +02:00
Alexander Potapenko
692754f1a7 Enable USB fuzzing in KMSAN configs.
This moves the USB-related parts of generate-config-usb.sh to util.sh
and reuses them in generate-config-kmsan-from-kasan.sh.

It also updates upstream-kmsan.config
2019-05-15 16:23:44 +02:00
Dmitry Vyukov
491919b14f pkg/compiler: work around 0-array-size errors due to missing consts
A const can be used as array size. Then if the const is not present
on all arches, compiler will produce an error about 0-sized-array.
There is no easy way to work around this for a user.
Use value of 1 for missing consts. It's just a bit safer.
2019-05-15 13:48:59 +02:00
Dmitry Vyukov
3345130d0f dashboard/config: fix up TOMOYO configs
See https://groups.google.com/d/msg/syzkaller/mODXmnauUZM/nIuyd2M0AAAJ for context.
2019-05-15 11:57:17 +02:00
Dmitry Vyukov
22c391e195 Makefile: switch to golangci-lint
Finally!

Fixes #977
Fixes #1108
2019-05-15 11:39:31 +02:00
Dmitry Vyukov
01d1494471 .golangci.yml: add codeanalysis build tag
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
2019-05-15 11:39:31 +02:00
Dmitry Vyukov
bd4e3ac77b prog: fix crash in assignSize on optional pointer 2019-05-14 20:58:33 +02:00
Dmitry Vyukov
2e6300854a sys/linux: improve binder descriptions
Add few new ioctl's. Add some typedefs for clarity.
2019-05-14 19:28:01 +02:00
Dmitry Vyukov
c1caccc833 sys/linux: improve key and net_sch descriptions
Use the len paths to resolve pending TODOs.
2019-05-14 19:28:01 +02:00
Dmitry Vyukov
2376f0f937 pkg/compiler: allow to refer to syscall arguments in len paths
This allows to use len[syscall:arg] expressions.
2019-05-14 19:28:01 +02:00
Dmitry Vyukov
9a4969814e pkg/compiler: refactor len target checking
Create named const for "parent" and move some code into a helper function.
2019-05-14 19:28:01 +02:00
Dmitry Vyukov
30e50d7959 sys/akaros: rename syscall argument
In preparation for making syscall a reserved name.
2019-05-14 19:28:01 +02:00
Dmitry Vyukov
cd3454ba97 sys/linux: improve btf descriptions
Now that we have the len path expressions we can fix the TODO
in btf descriptions to properly specify offsets of btf sections.

Also add proper descriptions for btf type section
and few other minor things around.
2019-05-14 19:28:01 +02:00
Dmitry Vyukov
93dcf0adc8 prog: implement complex len target support
This actually implements support for complex len targets
during program generation and mutation.
2019-05-14 19:28:01 +02:00
Dmitry Vyukov
16c881ad85 pkg/compiler: generate complex len targets
Change the generated format for len type to support multiple path elements.
2019-05-14 19:28:01 +02:00
Dmitry Vyukov
eea28fee30 pkg/compiler: support complex len targets
This change adds compiler support for complex path
expressions in len targets. E.g. it allows to refer
to a sibling field as len[parent_struct:field:another_field].
See the docs change for details.

This is just a compiler change.
The feature is not yet supported by the prog package.
2019-05-14 19:28:01 +02:00
Dmitry Vyukov
1886b2a481 pkg/ast: refactor COLON handling
This prepared for handling of bytesize[parent:foo:bar] expressions
by allowing multiple identifiers after colon.
No functional changes for now, just preparation for storing more
than one identifier after colon.
2019-05-14 19:28:01 +02:00
Dmitry Vyukov
354b388e08 sys/test: remove a leftover file 2019-05-14 19:28:01 +02:00