Commit Graph

4841 Commits

Author SHA1 Message Date
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
Dmitry Vyukov
49bb6b93d5 tools/syz-bisect: fix file presence check
1. Filename should be relative to flagCrash, not the current dir.
2. Use osutil.IsExist, os.Stat can fail for other reasons, e.g. no permissions.
3. Dedup filepresence check.
2020-04-29 11:24:49 +02:00
Jouni Hogander
bc0712ac2b pkg/instance: Use syz or c source file when testing
Currenlty only syz file is taken into account when testing.
Use also c source file if available. Still use syz as a "main"
reproducer.
2020-04-29 11:20:26 +02:00
Dmitry Vyukov
2fdc5098e9 pkg/html: regenerate 2020-04-29 11:14:16 +02:00
Dmitry Vyukov
ba2806dbc6 dashboard/app: add help link for coverage reports 2020-04-29 09:09:35 +02:00
Dmitry Vyukov
95eafd1ba5 .travis.yml: switch to latest Go releases
We generally test the last 2 released Go versions.
1.11 is too old and 1.14 is not officially released.
Switch to 1.13 and 1.14.
2020-04-29 09:06:44 +02:00
Dmitry Vyukov
4c9b435b67 prog: reduce code nesting level 2020-04-28 16:52:22 +02:00
Dmitry Vyukov
15862c0b45 prog: simplify hints test
It assumes too much about prog internals.
Parse complete program instead.
2020-04-28 16:52:22 +02:00
Dmitry Vyukov
dcd4b58785 prog: make program parsing more permissive
Don't error on wrong vma with value in non strict mode.
Add more tests and fix use of cmp package (prog.Syscall is not comparable anymore).
2020-04-28 16:52:22 +02:00
Dmitry Vyukov
e3ecea2e7f
docs: clarify struct/union attributes in syzlang 2020-04-28 12:38:46 +02:00
Dmitry Vyukov
0ce7569ee7 pkg/compiler: deduplicate Types in descriptions
Add prog.Ref Type that serves as a proxy for real types
and allows to deduplicate Types in generated descriptions.
The Ref type is effectively an index in an array of types.
Just before serialization pkg/compiler replaces real types
with the Ref types and prepares corresponding array of real types.
When a Target is registered in prog package, we do the opposite
operation and replace Ref's with the corresponding real types.

This brings improvements across the board:
compiler memory consumption is reduced by 15%,
test building time by 25%, descriptions size by 33%.

Before:
$ du -h sys/linux/gen
54M	sys/linux/gen

$ time GOMAXPROCS=1 go test -p=1 -c ./prog
real	0m54.200s
real	0m53.883s

$ time GOMAXPROCS=1 go install -p=1 ./tools/syz-execprog
real	0m27.911s
real	0m27.767s

$ TIME="%e %P %M" GOMAXPROCS=1 time go tool compile ./sys/linux/gen
20.59 100% 3200016
20.97 100% 3445976
20.25 100% 3209684

After:
$ du -h sys/linux/gen
36M	sys/linux/gen

$ time GOMAXPROCS=1 go test -p=1 -c ./prog
real	0m42.290s
real	0m43.230s

$ time GOMAXPROCS=1 go install -p=1 ./tools/syz-execprog
real	0m24.337s
real	0m24.727s

$ TIME="%e %P %M" GOMAXPROCS=1 time go tool compile ./sys/linux/gen
19.11 100% 2764952
19.66 100% 2787624
19.35 100% 2749376

Update #1580
2020-04-26 05:58:31 +02:00
Greg Steuck
99b258ddc3 sys/openbsd: extend vnet
* started with freebsd/vnet.txt
  * pruned unsupported items
  * gmake extract
  * gmake generate_sys
  * gmake fomat
2020-04-26 04:43:15 +02:00
Greg Steuck
32c0bff1a8 Makefile: pin golangci-lint version
Used the recipe from https://github.com/golangci/golangci-lint
2020-04-26 04:42:23 +02:00
Dmitry Vyukov
b8bb8e5f8e pkg/serializer: support primitive user types in interfaces
Add handling of user types that has underlying primitive types.
Consider:

	type T int
	var obj interface{} = T(42)

T has kind reflect.Int. But if we serialize obj as just "42",
it will be turned into plain int.
Detect this case and serialize obj as "T(42)".
2020-04-25 11:01:02 +02:00
Dmitry Vyukov
b3cb1996a4 pkg/serializer: test result in the test
Make the test actually test what we expect
and extend slightly for few interesting cases.
2020-04-25 10:52:15 +02:00
Dmitry Vyukov
a113ba3838 prog: dedup code in ForeachType 2020-04-25 07:40:50 +02:00
Dmitry Vyukov
3e9855a176 pkg/compiler: simplify sort predicate 2020-04-25 07:36:03 +02:00
Andrey Konovalov
03d97a1bcd dashboard/config: update android/config-5.4 2020-04-23 18:56:40 +02:00
Andrey Konovalov
11ab92d01e dashboard/config: update upstream-usb.config 2020-04-23 18:56:40 +02:00
Andrey Konovalov
fdf8134e77 dashboard/config: add more android configs 2020-04-23 18:56:40 +02:00
Andrey Konovalov
b9233cab41 dashboard/config, sys/linux: update usb config 2020-04-23 16:47:51 +02:00
Andrey Konovalov
fabe518e91 dashboard/config: update usb config generation script 2020-04-23 16:47:51 +02:00
Ayushi Sharma
2e44d63e40
sys/netbsd: add lchmod(2) (#1687) 2020-04-21 13:22:03 +02:00
Siddharth M
f20434a845
pkg/build: Remove all the build dirs for NetBSD (#1688) 2020-04-21 10:38:02 +00:00