Commit Graph

1024 Commits

Author SHA1 Message Date
Dmitry Vyukov
8b96726707 sys/linux: fix warnings in template definition
Update #590
2019-12-22 11:39:02 +01:00
Dmitry Vyukov
c5907f7c7a tools/syz-check: check templates
Also rename some netfilter types to eliminate massive amounts of template warnings.

Update #590
2019-12-22 11:19:49 +01:00
Dmitry Vyukov
9b81e6bdb8 sys/linux: fix warning in dev_video4linux.txt
Update #590
2019-12-22 10:15:24 +01:00
Dmitry Vyukov
8fecec2eb0 sys/linux: another batch of warning fixes
The only remaining part now is dev_video4linux.txt

Update #590
2019-12-22 09:29:44 +01:00
Dmitry Vyukov
bfdfc2603c prog: don't fail decoding on non-default out args
We get them in cross-compilation test where an out const
arg has different values in different archs.
No reason to fail deserialization in that case, replace with default
arg instead.
2019-12-21 14:53:37 +01:00
Dmitry Vyukov
bc5869180f sys/linux: fix 240 warnings in descriptions
Sweeping fix of everything up to socket_netlink_route.txt.

Update #590
2019-12-20 16:45:35 +01:00
Dmitry Vyukov
ae5ed0b140 pkg/compiler: fix bitfield layout bug
Fixes #1542

Found thanks to syz-check. Update #590
2019-12-20 16:45:34 +01:00
Dmitry Vyukov
4bba9fd162 pkg/compiler: fix alignment of string-formatted values
We used size as alignment, this is very wrong.

Found thanks to syz-check. Update #590
2019-12-20 16:45:34 +01:00
Dmitry Vyukov
5655dc58a9 executor: make syz_compare output more handy to use 2019-12-20 16:45:33 +01:00
Dmitry Vyukov
08f0467614 sys/test: and another set of bitfield tests
Just trying to get my head around it (and fix this in tests).

Update #1542
2019-12-20 16:45:33 +01:00
Dmitry Vyukov
e30cbdae48 sys/test: and another bitfield test
Just trying to get my head around it (and fix this in tests).

Update #1542
2019-12-19 20:00:44 +01:00
Dmitry Vyukov
20c6855484 prog: refactor bitfields representation
All callers of BitfieldMiddle just want static size (0 for middle).
Make it so: Size for middle bitfields just returns 0. Removes lots of if's.
Introduce Type.UnitSize, which now holds the underlying type for bitfields.
This will be needed to fix #1542 b/c even if UnitSize=4 for last bitfield
Size can be anywhere from 0 to 4 (not necessary equal to UnitSize due to overlapping).
2019-12-19 19:32:45 +01:00
Dmitry Vyukov
52395b6ee8 sys/test: add few other tests for tricky bitfields
Update #1542
2019-12-18 16:42:17 +01:00
Dmitry Vyukov
73c3845438 pkg/compiler: fix incorrect alignment calculation for padding
We assumed that for ConstType alignment is equal to size,
which is perfectly reasonable for normal int8/16/32/64/ptr.
However, padding is also represented by ConstType of arbitrary size,
so if we added 157 bytes of padding that becomes alignment of
the padding field and as the result of the whole struct.
This affects very few structs, but quite radically and quite
important structs.

Discovered thanks to syz-check.

Update #590
2019-12-18 14:44:12 +01:00
Dmitry Vyukov
42dc692776 sys/linux: another batch of syz-check fixes
Update #590
2019-12-18 14:38:24 +01:00
Dmitry Vyukov
82b3c9dfee sys/linux: fix few bugs
Fix some descirptions disperancies with kernel and regenerate warnings on next-20191218.
2019-12-18 12:00:12 +01:00
Dmitry Vyukov
2f68adff0b sys/linux: support new split sound ioctls
Some sounds ioctls are now explicitly doubled for 32/64 bits. Support that.
Fix mips SOL_SOCKET issues by rearranging includes.
Improve few other fields.
2019-12-18 10:50:24 +01:00
Andrey Konovalov
f2fe0772a9 sys/linux: various descriptions fixes 2019-12-18 07:48:36 +01:00
Dmitry Vyukov
7b9de469e6 sys/linux: regenerate consts
Regenerate on next-20191217.
Rename s/VMADDR_CID_RESERVED/VMADDR_CID_LOCAL/ as it was renamed in kernel.
2019-12-17 11:21:45 +01:00
Jouni Hogander
2b31345f36 Autogenerated files for linux/mips64le
This patch adds all autogenerated files for linux/mips64le. Files are
generated by following commands:

make extract
bin/syz-extract -build -os=linux -arch=mips64le -sourcedir=linux
make generate
2019-12-17 11:10:52 +01:00
Jouni Hogander
07bfd71dac Implement basic support for MIPS64LE
Add basic stuff to enable MIPS64ELR2 target:
 - build
 - make extract
 - make generate
 - qemu execution
 - system call parsing from /proc/kallsyms
2019-12-17 11:10:52 +01:00
Dmitry Vyukov
f9ae583e77 executor: fix FUTEX_WAKE call
Amusingly we never passed number of threads to wake for FUTEX_WAKE.
It somehow worked reliably on linux (we just needed it to not be 0,
so presumably garbage in registers did it).
However, in gVisor every other syscall wasn't even started
(first syscall on a thread started, but second on the same worker
thread wasn't unable to start).
2019-12-16 19:37:38 +01:00
Andrey Konovalov
0ae38e4489 sys/linux: minor improvements for USB descriptions
1. Define endpoint maxpacket as flags with a few valid values.

2. Define bits of bmNetworkCapabilities.
2019-12-16 09:28:02 +01:00
Dmitry Vyukov
a5c1ab05b3 sys/test: add more tests for bitfields
Add tests for issue #1542

The correct results are obtained with the following program:

struct foo {
	unsigned char	f0;
	unsigned int	f1:4;
	unsigned short	f2:4;
};

struct bar {
	char f0;
	struct foo foo;
};

int main() {
	struct bar y;
	memset(&y, 0, sizeof(y));
	y.f0 = 0x12;
	y.foo.f0 = 0x34;
	y.foo.f1 = 0x56;
	y.foo.f2 = 0x78;
	int i;
	for (i = 0; i < sizeof(y); i++)
		printf("%02x", ((unsigned char*)&y)[i]);
	printf("\n");
}
2019-12-13 15:26:10 +01:00
Andrey Konovalov
d973f52833 executor: update raw gadget interface 2019-12-11 19:20:07 +01:00
Dmitry Vyukov
101194ebf6 executor: check pwrite return values again
Build with some gcc's fails:

In file included from executor/executor.cc:133:0:
executor/common_linux.h: In function ‘long int syz_read_part_table(long unsigned int, long unsigned int, long int)’:
executor/common.h:117:15: error: ignoring return value of ‘ssize_t pwrite(int, const void*, size_t, __off_t)’, declared with attribute warn_unused_result [-Werror=unused-result]
    __VA_ARGS__;                                 \
               ^
executor/common_linux.h:1279:3: note: in expansion of macro ‘NONFAILING’
   NONFAILING(pwrite(memfd, segs[i].data, segs[i].size, segs[i].offset));
   ^
executor/common_linux.h: In function ‘long int syz_mount_image(long int, long int, long unsigned int, long unsigned int, long int, long int, long int)’:
executor/common.h:117:15: error: ignoring return value of ‘ssize_t pwrite(int, const void*, size_t, __off_t)’, declared with attribute warn_unused_result [-Werror=unused-result]
    __VA_ARGS__;                                 \
               ^
executor/common_linux.h:1364:3: note: in expansion of macro ‘NONFAILING’
   NONFAILING(pwrite(memfd, segs[i].data, segs[i].size, segs[i].offset));
   ^
cc1plus: all warnings being treated as errors
2019-12-10 18:59:06 +01:00
Dmitry Vyukov
cb704a294c executor: fix syz_mount_image
1. It always crashed in cover_reset when coverage is disabled.
2. Use NONFAILING when accessing image segments.
3. Give it additional 100 ms as it may be slow.
4. Add a test for syz_mount_image.
2019-12-10 16:08:35 +01:00
Dmitry Vyukov
1508f45368 sys/linux: refine few framebuffer/kbd ioctls 2019-12-07 18:45:45 +01:00
Dmitry Vyukov
4906fbb698 executor: don't use static_assert
Not all gcc's everywhere support C++11 by default.
We have some old on Travis.
2019-12-06 10:20:58 +01:00
Dmitry Vyukov
ba97c611a3 executor: fix remote coverage setup
Layout of kcov_remote_arg is ABI-dependent,
as the result when 32-bit userspace talks to 64-bit kernel
it does not work out of the box. We need both statically
different structs for kernels of different bitnesses,
but also dynamic dispatch because a 32-bit userspace
can talk to both 64-bit and 32-bit kernels.
2019-12-06 09:47:54 +01:00
Siddharth Muralee
9fd5a512f3 sys/netbsd: fix the build issues with posix_spawn 2019-12-05 10:06:13 +01:00
R3x
a734d2a6d9 sys/netbsd: add the newer vfork syscall 2019-12-05 10:06:13 +01:00
R3x
e06d2ea701 sys/netbsd: Added posix_spawn and fork syscalls 2019-12-05 10:06:13 +01:00
Dmitry Vyukov
cbfd910250 sys/linux: more tuning of tty devices
Enable /dev/tty{1-6}. These seem to be special.
Few first connected to framebuffers. But the rest
seem to be different from e.g. tty20 anyway.
Also /dev/tty is different from the rest.
/dev/ttyS3 and /dev/ttyprintk are different.
Properly pair BSD pty terminals.
2019-12-03 18:48:14 +01:00
Dmitry Vyukov
a715d760ae sys/linux: add /dev/fb1
qemu -vga cirrus results in /dev/fb0 and /dev/fb1.
2019-12-03 18:48:14 +01:00
Dmitry Vyukov
ab342da3f9 sys/linux: add binderfs descriptions 2019-12-02 18:21:43 +01:00
Dmitry Vyukov
dc01aea003 sys/linux: add /dev/fb descriptions
Framebuffer descriptions + open more tty dev nodes.
2019-12-02 18:17:04 +01:00
Dmitry Vyukov
82d81ba98e sys/linux: regenerate consts
Regenerate consts now that make extract is fixed.
Interestingly some arm consts have changed (arm/i386 abi difference?).
2019-12-02 14:44:04 +01:00
Dmitry Vyukov
f879db37f9 sys/linux: more device refinements
Add some mode /dev/nodes*
Add anoter midi device.
2019-12-01 19:51:52 +01:00
Dmitry Vyukov
5d12311f3a sys/linux: add /dev/ptp descriptions 2019-12-01 19:07:51 +01:00
Dmitry Vyukov
9dfc7e00d5 sys/linux: refine some device types
/dev/pmem0 is a block device.
/dev/adsp1 is the same as /dev/dsp1.
dmmidi,admmidi,amidi is the same as /dev/snd/midi.
2019-12-01 18:29:00 +01:00
Dmitry Vyukov
27d609bf84 sys/linux: add /dev/snd/pcm* descriptions 2019-12-01 17:47:28 +01:00
Dmitry Vyukov
c35a341c32 sys/linux: add /dev/dsp descriptions 2019-12-01 11:08:13 +01:00
Dmitry Vyukov
3504484430 sys/linux: update consts
Regenerate const files for all arches.
2019-12-01 11:03:27 +01:00
Dmitry Vyukov
a76bf83ffa sys/linux: fix /dev/watch_queue name
It's /dev/watch_queue not /dev/fd_watch_queue.
Don't know if it was renamed, or alwys wrong, but does not matter much,
now it's /dev/watch_queue.

Also attach v4l ioctls to /dev/swradio,radio,vbi,cec.
It seems that _some_ of them are applicable to these devices as well.
2019-11-30 19:17:15 +01:00
Dmitry Vyukov
3a75be00f5 sys/linux: add open of /dev/dri/renderD128
It's created by qemu but is not matched by the existing /dev/dri/renderD# pattern.
2019-11-29 15:03:37 +01:00
Dmitry Vyukov
ad6aec4193 sys/linux: fix NFC_SOCKPROTO_RAW socket call
It requires SOCK_SEQPACKET not SOCK_STREAM.
2019-11-29 14:47:56 +01:00
Dmitry Vyukov
4f7e1d0f5e sys/linux: use openat for /dev/cdrom
No need to use syz_open_dev here, openat will do.
Also add /dev/cdrom1 b/c qemu -machine q35 creates cdrom1 instead of cdrom.
2019-11-29 10:46:50 +01:00
Dmitry Vyukov
aac51b70cd sys/linux: use known tags for 9p virtio/xen
Name virtio/xen sources "syz" so that it's possible to expose
it from host and actually use.
2019-11-29 10:46:26 +01:00
Paul Chaignon
7a53a9d93f sys/linux: update BPF constants
Signed-off-by: Paul Chaignon <paul.chaignon@orange.com>
2019-11-29 10:45:42 +01:00