aboutsummaryrefslogtreecommitdiffstats
path: root/sys/fuchsia
Commit message (Collapse)AuthorAgeFilesLines
* sys: commit empty source filesDmitry Vyukov2021-04-211-0/+6
| | | | | | Commit empty files into generated packages, so that the tree is buildable even w/o generated files and Go tools continue to work.
* all: use tool.Failf instead of local functionsDmitry Vyukov2020-12-251-13/+9
|
* sys/targets: add OS/Arch name constsDmitry Vyukov2020-10-261-1/+1
| | | | | | | | | | | | We use strings to identify OS/Arch. These strings are duplicated throughout the code base massively. golangci-lint points to possiblity of typos and duplication. We already had to define these names in pkg/csource and disable checking for prog package. A future change triggers such warnings in another package. Add OS/Arch name consts to sys/targets so that they can be used to refer to OS/Arch. Use the consts everywhere.
* pkg/compiler: check for unused resourcesDmitry Vyukov2020-08-045-16/+9
| | | | | | | | | | If a resource is never used as an input, it is not useful. It's effectively the same as using an integer. Detect such cases, they are quite confusing. Fix all existing errors in descriptions. This uncovered some interesting bugs as well, e.g. use of a completely unrelated fd subtype after copy-paste (while the resource that was supposed to be used there is completely unused).
* all: fix dup types in func argsDmitry Vyukov2020-07-041-1/+1
|
* sys/fuchsia: regenerate FIDL descriptionsMatthew Dempsky2020-06-0538-785/+225
| | | | | | | This commit is the results of running: rm sys/fuchsia/*.const sys/fuchsia/*.syz.txt TARGETOS=fuchsia make extract
* sys/fuchsia: update "make extract" support codeMatthew Dempsky2020-06-055-57/+33
| | | | | | | FIDL fuzzing hasn't been working for a while, and it's further bit-rotted as upstream FIDL functionality has continued to evolve. This commit updates enough FIDL functionality to get a minimal FIDL test case to work again.
* Makefile: generate descriptions on-the-flyDmitry Vyukov2020-04-303-20147/+0
| | | | | | | | | | | | | | | | | | 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
* pkg/compiler: deduplicate Types in descriptionsDmitry Vyukov2020-04-262-9404/+14362
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* prog: add ignore_return and breaks_returns call attribtuesDmitry Vyukov2020-04-194-17/+17
| | | | | We had these hard-coded for fuchsia and linux accordingly. Replace with call attributes.
* pkg/compiler: refactor attribute handlingDmitry Vyukov2020-04-191-1/+1
| | | | | | | | | | | | Introduce common infrastructure for describing and parsing attribute instead of custom per-attribute code scattered across several locations. Change align attribute syntax from the weird align_N to align[N]. This also allows to use literal constants as N. Introduce notion of builtin constants. Currently we have only PTR_SIZE, which is needed to replace align_ptr with align[PTR_SIZE].
* prog: refactor target.MakeMmapDmitry Vyukov2020-04-181-1/+1
| | | | | | | | | | | Make MakeMmap return more than 1 call. This is a preparation for future changes. Also remove addr/size as they are effectively always the same and can be inferred from the target (will also conflict with the future changes). Also rename to MakeDataMmap to better represent the new purpose: it's just some arbitrary mmap, but rather mapping of the data segment.
* sys/fuchsia: Add cprng and vmo tests.Marco Vanotti2020-03-212-0/+7
| | | | | This commit adds two new tests for fuchsia. One tests a basic syscall (zx_cprng_draw), and the other does multiple tests over a vmo.
* pkg/compiler: check that const values fit into base typeDmitry Vyukov2020-03-173-663/+894
| | | | | const[0x12345678, int8] is always an error, detect these cases. Found some bugs in mptcp, socket proto and fuchsia fidl descriptions.
* pkg/compiler: calculate more precise sizes for argumentsDmitry Vyukov2020-03-172-6/+6
| | | | | | | | | | | | | | | | | | | | If we have: ioctl(fd fd, cmd int32) ioctl$FOO(fd fd, cmd const[FOO]) Currently we assume that cmd size in ioctl$FOO is sizeof(void*). However, we know that in ioctl it's specified as int32, so we can infer that the actual syscall size is 4. This massively reduces sizes of socket/setsockopt/getsockopt/ioctl and some other syscalls, which is good because we now use physical size in mutation/hints and some other places. This will also enable not morphing ioctl's into other ioctl's. Update #477 Update #502
* tools: add script that checks copyright headersDmitry Vyukov2020-02-182-0/+6
| | | | Fixes #1604
* prog: remove unused ResourceDesc.TypeDmitry Vyukov2020-01-262-152/+152
|
* pkg/serializer: do not write field names if it won't save spaceDmitry Vyukov2020-01-262-5148/+5148
| | | | | | | If we are going to write all values, don't write field names. This only increases size of generated files. The change reduces size of generated files by 5.8% (62870496-59410354=3460142 bytes saved).
* pkg/compiler: don't mark flags with 0 as bitmaskDmitry Vyukov2020-01-182-30/+30
| | | | | | | They can't be a bitmask. This fixes important cases of "0, 1" and "0, 1, 2" flags. Fix some descriptions that added 0 to bitmasks explicitly (we should do it automatically instead).
* pkg/compiler: sort flags valuesDmitry Vyukov2020-01-182-40/+40
| | | | | | Will simplify runtime analysis of flags. Also just no reason to make it more deterministic and avoid unnecessary diffs in future if values are reordered.
* pkg/compiler: generate const[0] for flags w/o valuesDmitry Vyukov2020-01-182-6/+6
| | | | | | | Generate const[0] for flags without values and for flags with a single value which is 0. This is the intention in all existing cases (e.g. an enum with types of something, but there is really only 1 type exists).
* sys/fuchsia: remove deprecated exception APIsDavid Pursell2019-11-146-42/+13
| | | | | | The port-based exception APIs have been deprecated on Fuchsia and will be removed shortly. Delete them from the syscall definitions and modify the Fuchsia executor to use the new channel-based APIs instead.
* sys/fuchsia: fix Fuchsia extract/generateDavid Pursell2019-11-1416-1657/+1921
| | | | | Updates some paths and add zx_eventpair type definition to fix `make extract` and `make generate`.
* pkg/compiler: define fileoff templatePaul Chaignon2019-11-012-14/+14
| | | | Signed-off-by: Paul Chaignon <paul.chaignon@orange.com>
* sys/fuchsia: update socket syscallsMarco Vanotti2019-08-147-992/+25
|
* sys/fuchsia: update zx_clock_get syscall (#1292)Marco Vanotti2019-07-163-12/+5
| | | | | | | | | | | | * sys/fuchsia: update zx_clock_get. zx_clock_get was deprecated and replaced by zx_clock_get_new. In a recent CL[0], they replaced the zx_clock_get by zx_clock_get_new and moved all client. This commit updates syzkaller to use the new function. [0]: https://fuchsia-review.googlesource.com/c/fuchsia/+/298575 * run make extract && make generate
* run make extract and make generate for fuchsiaMarco Vanotti2019-07-169-446/+135
|
* sys/fuchsia: remove RESIZEABLE flags from vmo ops.Marco Vanotti2019-07-161-2/+2
| | | | | | | | This change removes the ZX_VMO_NON_RESIZABLE flag for vmo create and the ZX_VMO_CHILD_NON_RESIZEABLE flag from vmo create child. The flags were removed upstream in cl: https://fuchsia-review.googlesource.com/c/fuchsia/+/293991
* sys/fuchsia: rename vmo_clone to vmo_create_child.Marco Vanotti2019-07-161-2/+2
| | | | | | | This commit modifies the vmo_clone definition, renaming it to vmo_create_child. This change happened in fuchsia a few weeks ago[0]. [0]: https://fuchsia-review.googlesource.com/c/fuchsia/+/272268/
* sys/fuchsia: remove power fidl definitions.Marco Vanotti2019-07-164-82/+0
| | | | | | This commit removes the fuchsia-power fidl definitions. The interface doesn't have a service implementing it in fuchsia, and it is causing issues in make extract.
* sys/fuchsia: Updating Fuchsia definitionsPascal Perez2019-05-2164-70/+756
| | | | | | Simply make extract TARGETOS=fuchsia SOURCEDIR=<FUCHSIA_DIR>/fuchsia
* sys: Updating Fuchsia extraction scriptsPascal Perez2019-05-212-58/+89
| | | | | | | | | 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.
* .golangci.yml: add codeanalysis build tagDmitry Vyukov2019-05-152-2/+4
| | | | | | | | | 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
* pkg/compiler: generate complex len targetsDmitry Vyukov2019-05-142-1468/+1468
| | | | Change the generated format for len type to support multiple path elements.
* Update syscalls (#1116)Marco Vanotti2019-04-2224-138/+517
| | | | | | | | | * sys/fuchsia: update all syscalls. This commit modifies all the existing syscalls definitions to match more closely the documentation in the Fuchsia repo. * run make extract && make generate
* sys/fuchsia: Remove object_*_cookie syscalls. (#1099)Marco Vanotti2019-04-037-93/+137
| | | | | | | | Those syscalls were removed from Zircon in a recent CL[0]. This commit runs make extract && make generate to update syscalls and fidl interfaces. [0]: https://fuchsia-review.googlesource.com/c/fuchsia/+/249349
* pkg/compiler: make buffer alias to ptr[array[int8]]Dmitry Vyukov2019-04-012-20/+20
| | | | | | | | | | | Ptr type has special handling of direction (pointers are always input). But buffer type missed this special case all the time. Make buffer less special by aliasing to the ptr[array[int8]] type. As the result buffer type can't have optional trailing "opt" attribute because we don't have such support for templates yet. Change such cases to use ptr type directly. Fixes #1097
* sys/sys-extract: update import path for fuchsia.Marco Vanotti2019-03-273-2/+15
| | | | | | | | | | Apparently, sysroot/include doesn't exist in the build-zircon path anymore. I changed the path in sys-extract to make it point to the exported sdk include path. I also ran make extract and make generate to add new fidl definitions. TEST=ran make extract and make generate.
* docs, pkg/vcs, sys/fuchsia: update fuchsia urlsMarco Vanotti2019-03-202-2/+2
| | | | | | | | | Recently the fuchsia team decided to merge all their subrepos into one big git repo. This meant that the "zircon" repo doesn't exist anymore. Instead almost everything is under the fuchsia repo. This change updates all the reference I could find in the code that point to the zircon and docs repo to make them point to the new fuchsia repo.
* sys/fuchsia/fidlgen: update FIDL path & extract new descriptionsJulia Hansbrough2019-02-214-48/+38
| | | | | | | | Garnet-layer FIDL descriptions are in a new subdirectory. This CL changes it to the proper directory, and performed a "make extract" shortly after. This should fix some of the errors on the Syzkaller hub.
* sys/fuchsia: fix fidlgen issuesMarco Vanotti2019-02-0626-3630/+3966
| | | | | | | | | | | | | | | | | | | | | | | | | * sys/fuchsia: fix fidlgen issues. This change modifies fidlgen removing fuchsia.mediacodec and renaming zircon-ethernet to fuchsia-hardware-ethernet. fuchsia.mediacodec has most of its functionality merged into fuchsia.media and it's not included in the default amd64 builds. zircon-ethernet has been renamed to fuchsia-hardware-ethernet recently: https://fuchsia-review.googlesource.com/c/zircon/+/237178 * docs/fuchsia: Add troubleshooting sections This commit adds a troubleshooting section in the fuchsia syzkaller docs that mentions how to solve fidlgen issues when fidl interfaces are removed or renamed. * sys/fuchsia: remove stale autogenerated files. * sys/fucsia run make extract && make generate.
* sys/linux: update TODO commentsDmitry Vyukov2019-01-241-1/+1
| | | | | | Change TODO comments that refer to missing description language features to NEED comments as that it's easier to grep for them. Remove some outdated comments. Fix 2 easy fixable TODOs.
* sys/fuchsia: fix task syscalls.Marco Vanotti2018-11-293-15/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | This commit fixes two issues related to the task syscalls. The zx_task_resume syscall has been recently removed from zircon[0]. It has been deprecated for some time already. This commit removes the syscall. The `ZX_EXCEPTION_PORT_UNBIND_QUIETLY` option for the syscall `zx_task_bind_exception_port` has been removed recently as well[1]. This commit removes that option from tasks.txt. To test this change, I followed the procedure for building syzkaller for fuchsia: ```shell $ make extract TARGETOS=fuchsia SOURCEDIR=${FUCHSIADIR} $ make generate $ make TARGETOS=fuchsia TARGETARCH=amd64 SOURCEDIR=${FUCHSIADIR} ``` I excluded the changes from make extract. This commit only has the generated files from make generate. [0]: https://fuchsia-review.googlesource.com/c/zircon/+/228712 [1]: https://fuchsia-review.googlesource.com/c/zircon/+/228658
* sys/fuchsia: update VMAR syscallsMarco Vanotti2018-11-213-14/+14
| | | | | | | | | | | | | | | | | | | | | | | * sys/fuchsia: update vmar syscalls. In a previous zircon commit[0], the vmar related syscalls (like `zx_vmar_map`, `zx_vmar_protect` and `zx_vmar_allocate`) changed the order of their parameters, making putting the flags parameter as the second parameter, and renaming it to "options". This commit modifies vmars.txt so that it reflects the latest state of the syscalls in zircon. I also modified the usage in `executor/common_fuchsia.h` I ran make extract, make generate and compiled syzkaller to test this change. [0]: https://fuchsia-review.googlesource.com/c/zircon/+/168060 * sys/fuchsia run make generate This commit is just the result of running make generate after its parent. This regenerates the definitions for the modified VMAR syscalls.
* sys/fuchsia: update fidl mappings.Marco Vanotti2018-11-218-100/+1347
| | | | | | | This commit is just a run of make extract + make generate with an up to date fuchsia tree. This commit only updates the fidl definitions, there are some other syscalls that had changed and need to be manually updated (that will come in a future commit).
* pkg/compiler: add error handler in CollectUnusedMarco Vanotti2018-11-211-1/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * pkg/compiler: Add error handler in `CollectUnused`. This commit adds an error handler for the `CollectUnused` function. The error handler just panics on any error, but is useful for debugging. The error handler is used any time `comp` finds an error, and if it's missing, it will panic due to a `nil` pointer dereference. At least now we get a better understanding of the errors. The only user of `CollectUnused` is `sys/fuchsia/fidlgen`, which is failing now and will be fixed in a future commit. The output message looks like this: ``` panic: could not collect unused nodes. fidl_net-stack.txt:110:15: unknown type zx_chan_zircon_ethernet_Device_client ``` * pkg/compiler Better error handling in CollectUnused This commit changes the default error handler for compiler to `ast.LoggingHandler`, meaning that if `nil` is passed as an error handler, `LoggingHandler` will be used instead. `CollectUnused` now returns an error if any of the subfunctions produce errors. `fidlgen` is the only caller of `CollectUnused`, and now checks for errors as well. * pkg/compiler Add tests for CollectUnused This commit adds basic tests for the CollectUnused function. There's one test that checks that it returns the right nodes, and another one that makes sure that it returns errors when needed. To make the test clearer, I had to add the error handler as an explicit parameter in `CollectUnunsed`, instead of using the default one. This avoid printing garbage in the logs. The `TestCollectUnusedError` function uses a nopErrorHandler to avoid printing anything. * pkg/compiler fix presubmit warnings
* sys/fuchsia: add zircon-ethernet to fidlgen libsMarco Vanotti2018-11-211-0/+1
| | | | | | | | | | | | | | | | | This commits adds "zircon-ethernet" to the list of fidl libraries that fidlgen would look at. This is required because recently, a change in fuchsia[0] added a new method to the netstack interface, that allows for adding an EthernetInterface. One of the parameters is a zircon.ethernet.Device, so we need to import that type for fidlgen to be able to understand fidl_net-stack.txt. I tested this by running: ```shell $ make extract TARGETOS=fuchsia SOURCEDIR=${FUCHSIADIR} $ make generate ``` [0]: https://fuchsia-review.googlesource.com/c/zircon/+/220580
* Update fidlgen to keep current with upstream.Julia Hansbrough2018-10-1017-436/+2119
| | | | | The Syzkaller IR upstream has been updated, so we can properly update consts/fidl descriptions now.
* Include generate_fidl as part of the `extract` step.Julia Hansbrough2018-10-021-1/+1
| | | | | | | | | | | Anytime we're running `make extract/generate` with Fuchsia as a target, we probably want to update FIDL descriptions too, so we don't fall behind what upstream is up to. This includes generate_fidl as part of the `make extract` workflow. Also, corrects fidlgenPath to properly find the path for ARM targets (we only have host_x64 right now).
* sys/fuchsia: add description for fuchsia.net, .net-stack, .ldsvc servicesDokyung Song2018-09-1414-174/+3438
|