Commit Graph

4864 Commits

Author SHA1 Message Date
Andrey Konovalov
fe4122c3bf docs: various updates all over 2020-05-08 11:26:51 +02:00
Andrey Konovalov
1913718f34 dashboard/config: add CONFIG_TWIST_FOR_SYZKALLER_TESTING config 2020-05-08 09:13:41 +02:00
Dmitry Vyukov
6c70a1c220 all: replace TRAVIS env var with CI
In preparation to running some tests as github actions.
Both Travis and Github define CI env var, while TRAVIS is, well,
too Travis-specific.

Update #1699
2020-05-07 15:41:50 +02:00
Dmitry Vyukov
413b991c26 syz-fuzzer: add more checks for disabled syscalls
We are seeing some panics that say that some disabled
syscalls somehow get into corpus.
I don't see where/how this can happen.
Add a check to syz-fuzzer to panic whenever we execute
a program with disabled syscall. Hopefull the panic
stack will shed some light.
Also add a check in manager as the last defence line
so that bad programs don't get into the corpus.
2020-05-07 15:41:50 +02:00
Marco Elver
fa822db46a dashboard/config: Enable USB_RAW_GADGET for KCSAN config
The latest kernel includes USB raw-gadget support. Enable it for KCSAN.
2020-05-07 14:28:41 +02:00
Marco Elver
9b994354ae dashboard/config: Update KCSAN config 2020-05-07 14:28:41 +02:00
Andrey Konovalov
98cbd87b5f docs/linux: update x86-64 instructions 2020-05-07 11:26:03 +02:00
Andrey Konovalov
44cf2476f3 sys/android: dev_ prefix for ion descriptions 2020-05-07 11:26:03 +02:00
Andrey Konovalov
1b2b36d6ab sys/android: dev_ prefix for ion descriptions 2020-05-07 11:26:03 +02:00
Andrey Konovalov
d443a94b19 docs/linux: update links to go install 2020-05-07 11:26:03 +02:00
Andrey Konovalov
6ba01b1e0a docs: some setup.md updates 2020-05-07 11:26:03 +02:00
Andrey Konovalov
ec4026808b docs: move go install instructions to setup.md
Also update go version requirement to 1.13.
2020-05-07 11:26:03 +02:00
Dmitry Vyukov
4618eb2da0 .travis.yml: don't install docker
We don't seem to use it.
2020-05-06 14:17:35 +02:00
Dmitry Vyukov
5395017f67 Makefile: print what files are not formatted
Move this part from .travis.yml to Makefile.
It's useful to see it always and we generally
don't have lots of logic in the travis file.
Also move list of changed files to the bottom
(that's what one generally sees at console
and at the end of the log).
2020-05-06 14:17:35 +02:00
Andrey Konovalov
35b8eb3041
Update external_fuzzing_usb.md 2020-05-05 19:35:49 +02:00
Dmitry Vyukov
4b76dd2589 prog: use Ref as Arg type
Use Ref in Arg instead of full Type interface.
This reduces size of all args. In partiuclar the most common
ConstArg is reduces from 32 bytes to 16 and now does not
contain any pointers (better for GC).

Running syz-db bench on a beefy corpus: before:
allocs 7262 MB (18 M), next GC 958 MB, sys heap 1279 MB, live allocs 479 MB (8 M), time 9.704699958s
allocs 7262 MB (18 M), next GC 958 MB, sys heap 1279 MB, live allocs 479 MB (8 M), time 9.873792394s
allocs 7262 MB (18 M), next GC 958 MB, sys heap 1279 MB, live allocs 479 MB (8 M), time 9.820479906s

after:
allocs 7163 MB (18 M), next GC 759 MB, sys heap 1023 MB, live allocs 379 MB (8 M), time 8.938939937s
allocs 7163 MB (18 M), next GC 759 MB, sys heap 1087 MB, live allocs 379 MB (8 M), time 9.410243167s
allocs 7163 MB (18 M), next GC 759 MB, sys heap 1023 MB, live allocs 379 MB (8 M), time 9.38225806s

Max heap and live heap are reduced by 20%.

Update #1580
2020-05-05 14:01:52 +02:00
Dmitry Vyukov
8cbfd71747 tools/syz-db: implement memory benchmarking function
syz-db bench loads a corpus and measures memory consumption.
2020-05-05 14:01:52 +02:00
Dmitry Vyukov
e42fa3fd02 prog: refactor hints tests
The way the tests fabricate types dynamically creates
problems during any non-trivial changes to prog package.

Use existing types from descriptions instead.
2020-05-05 14:01:52 +02:00
Dmitry Vyukov
1905d7c090 prog: refactor ANY to not fabricate new types
Currently ANY implementation fabricates new types dynamically.
This is something we don't do anywhere else, generally types
come from compiler and all are static.
Dynamic types will conflict with use of Ref in Arg optimization.
Move ANY types creation into compiler.

Update #1580
2020-05-05 14:01:52 +02:00
Dmitry Vyukov
3dda7e6768 pkg/compiler: simplify and enhance handling of builtins
Currently we have special support for each type of builtin node.
This is complex and does not scale (we may want other types in future).
Prepend the builtin descriptions to the user descriptions instead.
This requires a bit of special support, like not reporting
any builtin descriptions as unused, but otherwise much simpler and more flexible.
Does not produce any diff in generated descriptions.
2020-05-05 14:01:52 +02:00
Dmitry Vyukov
c07ad91c6b pkg/ast: improve test output
Improve the test utility to group error messages by line.
2020-05-05 14:01:52 +02:00
Dmitry Vyukov
577e2c45a7 prog: fix stale comment 2020-05-05 14:01:52 +02:00
Dmitry Vyukov
9941337c5f pkg/csource: init res var in generated call
It seems that gcc in ubuntu on travis got dumber:

<stdin>: In function ‘execute_call’:
<stdin>:1741:6: error: ‘res’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
cc1: all warnings being treated as errors
compiler invocation: arm-linux-gnueabi-gcc [-o /tmp/syz-executor675297211 -DGOOS_linux=1 -DGOARCH_arm=1 -DHOSTGOOS_linux=1 -x c - -O2 -pthread -Wall -Werror -Wparentheses -Wframe-larger-than=16384 -D__LINUX_ARM_ARCH__=6 -march=armv6 -static -Wno-overflow]

https://travis-ci.com/github/dvyukov/syzkaller/jobs/327487382

Though, we generate the same code and res seems to be initialized on all paths.

Initialize it explicitly.
2020-05-04 20:56:20 +02:00
Dmitry Vyukov
71db69869e sys/linux: mark some ioctls as disabled
Mark ioctls we disable in init.go as disabled.

Update #477
Update #502
2020-05-04 20:56:20 +02:00
Dmitry Vyukov
a4d38b39a8 prog: support disabled attribute
Update #477
Update #502
2020-05-04 20:56:20 +02:00
Dmitry Vyukov
58ae5e1862 prog: remove StructDesc
Remove StructDesc, KeyedStruct, StructKey and all associated
logic/complexity in prog and pkg/compiler.
We can now handle recursion more generically with the Ref type,
and Dir/FieldName are not a part of the type anymore.
This makes StructType/UnionType simpler and more natural.

Reduces size of sys/linux/gen/amd64.go from 5201321 to 4180861 (-20%).

Update #1580
2020-05-03 12:55:42 +02:00
Dmitry Vyukov
5457883a51 tools/codecov.yml: add
Add configuratio file for codecov.io
2020-05-02 14:12:25 +02:00
Dmitry Vyukov
f8d0ffe005 docs: update source download instructions
Since we don't don't have auto-generated files checked-in,
go get fails to parse packages.
go get only prog package without building,
this will checkout the whole repo anyway
and that's the only thing we need.
2020-05-02 14:12:25 +02:00
Dmitry Vyukov
4d9915573a organize top level files
Remove .gitattributes, we don't have any of these files now.
Move fuzzit.sh -> tools/fuzzit.sh.
2020-05-02 14:12:25 +02:00
Dmitry Vyukov
58da4c35b1 prog: introduce Field type
Remvoe FieldName from Type and add a separate Field type
that holds field name. Use Field for struct fields, union options
and syscalls arguments, only these really have names.

Reduces size of sys/linux/gen/amd64.go from 5665583 to 5201321 (-8.2%).
Allows to not create new type for squashed any pointer.
But main advantages will follow, e.g. removing StructDesc,
using TypeRef in Arg, etc.

Update #1580
2020-05-02 12:16:06 +02:00
Dmitry Vyukov
bc734e7ada prog: rename {PtrType,ArrayType}.Type to Elem
Name "Type" is confusing when referring to pointer/array element type.
Frequently there are too many Type/typ/typ1/t and typ.Type is not very informative.
It _is_ a type, but what's usually more relevant is that it's an _element_ type.
Let's leave type checking to compiler and give it a more meaningful name.
2020-05-01 13:31:17 +02:00
Dmitry Vyukov
43dc635b4f Makefile: reduce presubmit size
Run fewer builds in presubmit. Also run them sequentially instead of parallel.
The current presubmit OOMs on CI every other time, this is not useful.

Update #1699
2020-05-01 13:31:17 +02:00
Dmitry Vyukov
e54e9781a4 prog: remove Dir from Type
Having Dir is Type is handy, but forces us to duplicate lots of types.
E.g. if a struct is referenced as both in and out, then we need to
have 2 copies and 2 copies of structs/types it includes.
If also prevents us from having the struct type as struct identity
(because we can have up to 3 of them).

Revert to the old way we used to do it: propagate Dir as we walk
syscall arguments. This moves lots of dir passing from pkg/compiler
to prog package.
Now Arg contains the dir, so once we build the tree, we can use dirs
as before.

Reduces size of sys/linux/gen/amd64.go from 6058336 to 5661150 (-6.6%).

Update #1580
2020-05-01 13:31:17 +02:00
Dmitry Vyukov
3f4dbb2f6f prog: fix size assignment for squashed args
We can have a situation where len target points
into a squashed argument. In suca case we don't have the target argument.
In such case we simply leave size argument as is. It can't happen during generation,
only during mutation and mutation can set size to random values, so it should be fine.
This is a lateny bug, we just never had such case before.
2020-05-01 13:31:17 +02:00
Dmitry Vyukov
986fa4971c prog: don't squash objects that contain pointers
Squashing pointers creates several problems:
- we need to generate pointer types on the fly,
  something we don't do in any other contexts,
  it complicates other changes
- pointers are very special as values,
  if we change size of the surrounding blobs,
  offsets changes and we will use something that's
  not a pointer as pointer and vise versa,
  boths things are most likley very bad as inputs
- squashing/any implementation is just too complex

This disqualifies several types for squashing:

    <         alloc_pd_cmd
    <         arpt_replace
    <         array[cmsghdr_rds]
    <         create_cq_cmd
    <         create_flow_cmd
    <         create_qp_cmd
    <         create_srq_cmd
    <         ebt_counters_info
    <         ip6t_replace
    <         ipt_replace
    <         mlx5_alloc_pd_cmd
    <         mlx5_create_dv_qp_cmd
    <         open_xrcd_cmd
    <         post_recv_cmd
    <         post_send_cmd
    <         post_srq_recv_cmd
    <         query_qp_cmd
    <         query_srq_cmd
    <         reg_mr_cmd
    <         rereg_mr_cmd
    <         resize_cq_cmd
    <         usbdevfs_urb
    <         vhost_memory
    <         vusb_connect_descriptors

and adds few new:

    >         binder_objects
    >         query_qp_resp
    >         resize_cq_resp
    >         usb_bos_descriptor
    >         usb_string_descriptor

Overall this looks sane.
Majority is still unchanged.
2020-05-01 13:31:17 +02:00
Dmitry Vyukov
143a10e9d6 pkg/ast: extend tests
Test more functions that we currently don't test.
2020-05-01 08:50:11 +02:00
Dmitry Vyukov
6ae554d324 README.md: point Travis link to /branches
The current link points to the latest build for the project,
which may be on a random PR. Both failure and success are
mostly irrelevant. The /branches page seems to be more relevant.
2020-05-01 08:07:20 +02:00
Dmitry Vyukov
a4d01b8075 fuzzit.sh: generate descriptions before building
The script does not use make and does not generate descriptions.
Generate descriptions explicitly before building.
2020-05-01 07:22:22 +02:00
Dmitry Vyukov
a73c1fd952 Makefile: fix use of PWD
PWD in Makefile points to the dir from where make is invoked,
not the Makefile dir. Moreover, PWD may be overriden in shell.
Use "realpath ." instead.
2020-05-01 07:08:01 +02:00
Dmitry Vyukov
ec42220e77 Makefile: generate descriptions on-the-fly
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
2020-04-30 17:18:29 +02:00
Dmitry Vyukov
136082ab38 pkg/cmdprof: add package
cmdprof simplifies cpu/memory profiling for command line tools. Use as:

	flag.Parse()
	defer cmdprof.Install
2020-04-30 17:18:29 +02:00
Mark Johnston
cc90e4763e pkg/report: match a common pf panic 2020-04-30 16:33:09 +02:00
Dmitry Vyukov
3698959af9 sys/targets: fix detection of optional compiler flags
The test source is now C++, so use -x c++.
Stupid bug, but testing this is not trivial
in the context where we specifically make
behavior "flexible"...
2020-04-30 11:54:39 +02:00
Greg Steuck
2dd552a542
vm/.../openbsd: get back traces of the first two cpus. (#1705) 2020-04-29 11:09:59 -07:00
Andy Nguyen
c42af8f753 sys: add mldv2 packet structs
Use special values for hop limit to increase likelihood of triggering certain paths.
2020-04-29 18:55:57 +02:00
Andy Nguyen
bd365072bf sys: add more specific ipv6 options
Additionally fix a type for ipv6_hopopts_ext_header
2020-04-29 16:46:34 +02:00
Dmitry Vyukov
3b93a8e003 sys/targets: better detection for missing/broken cross-compilers
1. Detect when compiler is present, but is not functioning
(can't build a simple program, common for Linux distros).

2. Be more strict with skipping tests due to missing/broken compilers on CI
(on CI they should work, so fail loudly if not).

3. Dedup this logic across syz-env and pkg/csource tests.

4. Add better error reporting for syz-env.

Fixes #1606
2020-04-29 16:32:33 +02:00
Dmitry Vyukov
08bed8d769 dashboard/app: fix linter warnings 2020-04-29 16:32:33 +02:00
Dmitry Vyukov
496a08ae32 dashboard/app: introduce notion of "decommissioned" namespaces
Decommissioned namespaces are not actively tested, no notifications are sent, etc.
UI is somewhat different, we don't want about broken builds, etc.
They are kept mostly read-only for historical reference.
2020-04-29 13:14:07 +02:00
Dmitry Vyukov
d397d49acd dashboard/app: remove old namespace redirects
We kept redirects from old URLs for more than a year.
It's time to remove them. Old links, if they still exist,
need to be updated sooner or later.
2020-04-29 13:07:43 +02:00