Commit Graph

111 Commits

Author SHA1 Message Date
Dmitry Vyukov
4ae183a783 sys: fix StrConstType size and alignment
The current code is probably a leftover from times when
StrConstType itself implied an indirection (it was a pointer to the string).
Now strconst it is lowered to PtrType[StrConstType],
so its size is len of the string and align is 1.

It is not possible to test it now, as it is always used with indirection,
so static size and align do not affect struct layout.
2016-10-18 21:17:29 +02:00
Andrey Konovalov
e4edb0e20b Add tests for big-endian ints 2016-10-13 15:38:58 +02:00
Andrey Konovalov
7686d19aff Add big-endian ints 2016-10-13 15:38:53 +02:00
Andrey Konovalov
2392578fe9 Update sys/README.md 2016-10-11 20:09:29 +02:00
Andrey Konovalov
d7ba1b8f86 Add assign len fields tests 2016-10-11 20:09:25 +02:00
Andrey Konovalov
78f79fee93 Refactor & improve len type handling 2016-10-11 20:09:19 +02:00
Andrey Konovalov
7311e016f3 Rename duplicate fields in templates 2016-10-10 16:13:26 +02:00
Andrey Konovalov
f2d77726c8 Add exec serialize tests for array[int8] 2016-10-04 18:50:02 +02:00
Andrey Konovalov
c99cbdbe58 Emit BufferBlob for array[int8] 2016-10-04 18:49:57 +02:00
Dmitry Vyukov
3ca39dfc4d sys: add padding to structs again
Struct padding was accidentially lost after:
852e3d2eae
Restore it. Now with tests.

Fixes #78
2016-09-29 13:30:08 +02:00
Dmitry Vyukov
bf21057e7c prog: add a test for union layout
This is a retrospect tests for the union bug fixed in:
91eb1b922f
2016-09-29 12:21:26 +02:00
Dmitry Vyukov
11a690d275 sys, prog: add tests for description parsing and serialization
Add sys/test.txt file with description of syscalls for tests.
These descriptions can be used to ensure that we can parse everything we clain we can parse.
Use these descriptions to write several tests for exec serialization
(one test shows that alignment handling is currently incorrect).
These test descriptions can also be used to write e.g. mutation tests.

Update #78
2016-09-28 20:06:42 +02:00
Dmitry Vyukov
b1a9164b86 sys: refine KCM ioctl type 2016-09-28 17:22:56 +02:00
Dmitry Vyukov
d18f8aa366 Merge pull request #73 from xairy/ranged_arrays
Allow range sized arrays
2016-09-19 19:42:00 +02:00
Andrey Konovalov
551c2aa7e4 sys: delete Size() and Align() methods for struct and union 2016-09-19 16:43:44 +02:00
Andrey Konovalov
f41935d53f Allow range sized arrays 2016-09-19 16:16:24 +02:00
Dmitry Vyukov
255fdfb938 sys: resolve the TODO with recursive structs
syskaller now supports them
@ramosian-glider
2016-09-05 13:00:06 +02:00
Dmitry Vyukov
136250619e sys: resolve some old TODOs in descriptions 2016-09-05 12:49:47 +02:00
Dmitry Vyukov
852e3d2eae sys: support recursive structs
A struct can have a pointer to itself directly or indirectly.
Currently it leads to inifinite recursion when generating descriptions.
Fix this.
2016-09-05 12:49:47 +02:00
Alexander Potapenko
fb6f59caba Add the /dev/tlk_device (Open Trusted Execution device driver) description 2016-09-05 11:00:05 +02:00
Dmitry Vyukov
fcf6db1996 sys: remove autogenerated files
They were necessary when they were the source of constant values
extracted from kernel code (hard to do). Now constants are checked-in
separately, and these large files can be easily regenerated with 'make generate'.
Now they are only a source of large uninteresting diffs in commits.
Remove them.
2016-09-02 18:57:29 +02:00
Dmitry Vyukov
e9d2eec662 sys: fix incorrect argument type introduced in 7690667267 2016-08-28 20:17:50 +02:00
Dmitry Vyukov
58b2762fed sysgen: sort resources by name to avoid unnecessary diffs 2016-08-28 15:04:37 +02:00
Dmitry Vyukov
9b91ede860 executor, csource: share some common code between executor and csource 2016-08-28 14:59:48 +02:00
Dmitry Vyukov
7690667267 sys: specify resources in text descriptions
Currently to add a new resource one needs to modify multiple source files,
which complicates descirption of new system calls.
Move resource descriptions from source code to text desciptions.
2016-08-27 18:27:50 +02:00
Dmitry Vyukov
a71989d077 sys: fix links and formatting in README.md 2016-08-26 15:36:17 +02:00
Dmitry Vyukov
78553d2247 sys: update README to describe the new 2-step generation process 2016-08-26 15:20:36 +02:00
Dmitry Vyukov
d78bc6e66c sys: fix skipping of syscalls with unknown constants
Still need to generate description for such syscalls so that
they at least can be parsed, and so that Go and C entries match.
2016-08-26 12:51:25 +02:00
Dmitry Vyukov
0d0fbbe73f overhaul syscall description generation process
This splits generation process into two phases:
1. Extract values of constants from linux kernel sources.
2. Generate Go code.

Constant values are checked in.
The advantage is that the second phase is now completely independent
from linux source files, kernel version, presence of headers for
particular drivers, etc. This allows to change what Go code we generate
any time without access to all kernel headers (which in future won't be
limited to only upstream headers).

Constant extraction process does require proper kernel sources,
but this can be done only once by the person who added the driver
and has access to the required sources. Then the constant values
are checked in for others to use.
Consant extraction process is per-file/per-arch. That is,
if I am adding a driver that is not present upstream and that
works only on a single arch, I will check in constants only for
that driver and for that arch.
2016-08-26 07:09:25 +02:00
Dmitry Vyukov
1e22c7aefa sys: use ranged int in few syscalls so that it is tested 2016-08-13 09:16:28 -07:00
Dmitry Vyukov
7e6402c003 sys: change int range to use ':' instead of '~'
We can't use '-' because '-' can denote negative numbers.
Colon is used is several range notations (e.g. Go, Mathlab, Excel).
2016-08-13 09:10:12 -07:00
Dmitry Vyukov
3b9fe41fe3 reformat sources 2016-08-13 09:02:44 -07:00
Dmitry Vyukov
ae9d77a96b sys: regenerate syscall descriptions with latest linux sources 2016-08-13 09:01:42 -07:00
Baozeng Ding
7db2edcb33 sys/sysgen/prog: support ranged int
This commit supports inclusive ranged int, like foo int32[-10~10], which will
generate random integer between -10 and 10. In future we will support more than
one range, like int32[0, -5~10, 50, 100~200]
2016-08-10 13:43:15 +08:00
Dmitry Vyukov
32061a606f executor: add support for 386 arch (COMPAT syscalls)
This is not fully working now: e.g. prog and sys packages assume
that pointer size is 8. But at least it compiles and works.
2016-06-30 20:11:04 +02:00
Dmitry Vyukov
1816c21f2b sys: fix kvm_pit_channel_state.count_load_time type 2016-06-21 20:12:26 +02:00
Dmitry Vyukov
da7529ea51 sys: update generated files 2016-06-13 12:50:32 +02:00
Baozeng Ding
1dbfdcf757 sys: support kcm and netrom 2016-06-13 09:28:38 +08:00
Baozeng Ding
09a6b9531f sys: support getsockopt for sctp 2016-06-10 21:47:33 +08:00
Lorenzo Stoakes
a420b770de sys: add removed defines to fix generate in linux-next
This patch redefines constants that were removed in patches between 4.4 and
linux-next, so both linux-next and mainline work with make generate.
2016-03-11 21:54:52 +00:00
Lorenzo Stoakes
61f5f870ac sys: add missing include
IOPRIO_WHO_PGRP, IOPRIO_WHO_USER, and IOPRIO_WHO_PROCESS are defined in
linux/ioprio.h.
2016-03-08 09:56:08 +00:00
Dmitry Vyukov
7fe9da14de sys: fix build with Go1.4
It does not know about arm64 arch.

Fixes #17
2016-02-15 21:33:00 +01:00
Dmitry Vyukov
b21bafb97d sys: fix /dev/snd/pcm description 2016-02-05 22:12:15 +01:00
Dmitry Vyukov
ba993a55b9 sys: terminate string constants with \x00
C expects string constants to be zero terminated.
It worked to some degree probably because most memory is zeros in executor.
2016-02-05 22:12:15 +01:00
Dmitry Vyukov
0f6ca04596 sys: slighly improve diagnostics for incorrect syscall descriptions 2016-01-28 08:20:59 +01:00
Dmitry Vyukov
5dfefdb158 sys: fix write$tun description
Also remove \r in files.
2016-01-26 17:48:13 +01:00
Dmitry Vyukov
66b440bd17 sys: regenerate after tun/random support 2016-01-26 16:53:23 +01:00
Dmitry Vyukov
efe43dc071 sys: open a bunch of new devices 2016-01-26 16:48:37 +01:00
Baozeng Ding
4bbea2300f sys: support /dev/random and /dev/net/tun 2016-01-26 00:45:49 +08:00
Dmitry Vyukov
0d4b201150 sys: allow to open all devices as stopgap 2016-01-24 20:28:38 +01:00