From bad18a53de8fa8d3d097e3d701efb72a014661cb Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Tue, 4 Jan 2022 15:29:10 +0100 Subject: pkg/compiler: require stricter resource constructors Don't consider syscalls that return resources in unions/arrays as constructors. Unions and arrays are problematic because we don't have directed generation in prog.randGen.createResource() and can fail to generate a syscall that returns a particular resource (generate a wrong union option that does not contain the necessary resource). This leads to the following panics: panic: failed to create a resource ifindex with ioctl$sock_SIOCGIFCONF Require each resource to have a constructor syscall that returns the resource outside of unions/arrays. --- docs/syscall_descriptions_syntax.md | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'docs') diff --git a/docs/syscall_descriptions_syntax.md b/docs/syscall_descriptions_syntax.md index dd5dbeb3d..a8f79b580 100644 --- a/docs/syscall_descriptions_syntax.md +++ b/docs/syscall_descriptions_syntax.md @@ -228,6 +228,10 @@ test_struct { } ``` +Each resource type must be "produced" (used as an output) by at least one syscall +(outside of unions and optional pointers) and "consumed" (used as an input) +by at least one syscall. + ## Type Aliases Complex types that are often repeated can be given short type aliases using the -- cgit mrf-deployment