Home | History | Annotate | Download | only in testdata
      1 # Copyright 2017 syzkaller project authors. All rights reserved.
      2 # Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file.
      3 
      4 foo$0(x fileoff, y int8, z buffer[in])
      5 foo$1(x "bar")			### unexpected string "bar", expect type
      6 foo$2(x 123, y "bar")		### unexpected int 123, expect type	### unexpected string "bar", expect type
      7 foo$3(x string)			### string can't be syscall argument
      8 
      9 resource r0[int32]: 0, 0x1
     10 resource r1[string["foo"]]	### string can't be resource base (int types can)
     11 resource r1[int32]		### type r1 redeclared, previously declared as resource at LOCATION
     12 resource int32[int32]		### resource name int32 conflicts with builtin type
     13 resource fileoff[intptr]	### resource name fileoff conflicts with builtin type
     14 
     15 s1 {
     16 	f1	int32
     17 }
     18 
     19 s1 {				### type s1 redeclared, previously declared as struct at LOCATION
     20 	f1	int32
     21 	f1	intptr		### duplicate field f1 in struct s1
     22 	parent	int8		### reserved field name parent in struct s1
     23 }
     24 
     25 s2 {				### struct s2 has no fields, need at least 1 field
     26 }
     27 
     28 int32 {				### struct name int32 conflicts with builtin type
     29 	f1	int32
     30 }
     31 
     32 r0 {				### type r0 redeclared, previously declared as resource at LOCATION
     33 	f1	int32
     34 }
     35 
     36 u0 [
     37 	f1	int32
     38 	f2	fileoff[int32]
     39 ]
     40 
     41 u1 [				### union u1 has no fields, need at least 1 field
     42 ]
     43 
     44 u2 [
     45 	f1	int8
     46 	f1	int16		### duplicate field f1 in union u2
     47 	parent	int32		### reserved field name parent in union u2
     48 ]
     49 
     50 foo$4(a int8, a int16)		### duplicate argument a in syscall foo$4
     51 foo$4()				### syscall foo$4 redeclared, previously declared at LOCATION
     52 foo()
     53 foo()				### syscall foo redeclared, previously declared at LOCATION
     54 foo$5(a0 int8, a1 int8, a2 int8, a3 int8, a4 int8, a5 int8, a6 int8, a7 int8, a8 int8, a9 int8)	### syscall foo$5 has 10 arguments, allowed maximum is 9
     55 foo$6(parent int8)		### reserved argument name parent in syscall foo$6
     56 
     57 f1 = 1
     58 f2 = 1, 2
     59 f2 = 1, 2			### flags f2 redeclared, previously declared at LOCATION
     60 sf1 = "a"
     61 sf2 = "a", "b"
     62 sf2 = "c"			### string flags sf2 redeclared, previously declared at LOCATION
     63 
     64 resource r2[r0]: 2
     65 resource r3[int32:1]		###  unexpected ':', only struct fields can be bitfields
     66 resource r4[int32[opt]]		### resource base can't be marked as opt
     67 resource r5[non_existent]	### unknown type non_existent
     68 resource r9["foo"]		### unexpected string "foo", expect type
     69 
     70 foo$7(a r0, a1 r2[opt])
     71 foo$8(a fileoff[a, b, c])	### wrong number of arguments for type fileoff, expect no arguments
     72 foo$9(a buffer[inout])
     73 foo$10(a buffer[intout])	### unexpected value intout for direction argument of buffer type, expect [in out inout]
     74 foo$11(a buffer["in"])		### unexpected string "in" for direction argument of buffer type, expect [in out inout]
     75 foo$12(a buffer[10])		### unexpected int 10 for direction argument of buffer type, expect [in out inout]
     76 foo$13(a int32[2:3])
     77 foo$14(a int32[2:2])
     78 foo$16(a int32[3])
     79 foo$17(a ptr[in, int32])
     80 foo$18(a ptr[in, int32[2:3]])
     81 foo$19(a ptr[in, int32[opt]])
     82 foo$20(a ptr)			### wrong number of arguments for type ptr, expect direction, type, [opt]
     83 foo$21(a ptr["foo"])		### wrong number of arguments for type ptr, expect direction, type, [opt]
     84 foo$22(a ptr[in])		### wrong number of arguments for type ptr, expect direction, type, [opt]
     85 foo$23(a ptr[in, s3[in]])	### wrong number of arguments for type s3, expect no arguments
     86 foo$25(a proc[0, "foo"])	### unexpected string "foo" for per-proc values argument of proc type, expect int
     87 foo$26(a flags[no])		### unknown flags no
     88 foo$27(a flags["foo"])		### unexpected string "foo" for flags argument of flags type, expect identifier
     89 foo$28(a ptr[in, string["foo"]], b ptr[in, string["foo", 4]])
     90 foo$30(a ptr[in, string[no]])	### unknown string flags no
     91 foo$31(a int8, b ptr[in, csum[a, inet]])		### wrong number of arguments for type csum, expect csum target, kind, [proto], base type
     92 foo$32(a int8, b ptr[in, csum[a, inet, 1, int32]])	### only pseudo csum can have proto
     93 foo$33(a int8, b ptr[in, csum[a, pseudo, 1, int32]])
     94 foo$34(a int32["foo"])		### unexpected string "foo" for range argument of int32 type, expect int
     95 foo$35(a ptr[in, s3[opt]])	### s3 can't be marked as opt
     96 foo$36(a const[1:2])		### unexpected ':'
     97 foo$39(a fileoff:1)		### unexpected ':'
     98 foo$40(a len["a"])		### unexpected string "a" for len target argument of len type, expect identifier
     99 foo$41(a vma[C1:C2])
    100 foo$43(a ptr[in, string[1]])	### unexpected int 1, string arg must be a string literal or string flags
    101 foo$44(a int32) len[a]		### len can't be syscall return
    102 foo$45(a int32) len[b]		### len can't be syscall return
    103 foo$46(a ptr[in, in])		### unknown type in
    104 foo$47(a int32:2)		### unexpected ':', only struct fields can be bitfields
    105 foo$48(a ptr[in, int32:7])	### unexpected ':', only struct fields can be bitfields
    106 foo$49(a ptr[in, array[int32, 0:1]])
    107 foo$52(a intptr, b bitsize[a])
    108 foo$53(a proc[20, 10, opt])
    109 # This must not error yet (consts are not patched).
    110 foo$54(a ptr[in, string["foo", C1]])
    111 foo$55(a int8[opt[int8]])	### opt can't have arguments
    112 foo$56(a void)			### void can't be syscall argument
    113 foo$57(a ptr[in, stringnoz["foo", 10]])	### fixed-size string can't be non-zero-terminated
    114 foo$58(a ptr[in, stringnoz[sf2, 10]])	### fixed-size string can't be non-zero-terminated
    115 foo$59(a s1)			### s1 can't be syscall argument
    116 foo$60() s1			### s1 can't be syscall return
    117 foo$61(a u6)			### u6 can't be syscall argument
    118 foo$62() u6			### u6 can't be syscall return
    119 foo$63(a int32[1[2]])		### range argument has subargs
    120 foo$64(a ptr[in, flags[f1[int32], int32]])	### flags argument has subargs
    121 
    122 opt {				### struct uses reserved name opt
    123 	f1	int32
    124 }
    125 
    126 in = 1, 2			### flags uses reserved name in
    127 out = "1", "2"			### string flags uses reserved name out
    128 
    129 out [				### union uses reserved name out
    130 	f1	int32
    131 	f2	int8
    132 ]
    133 
    134 resource inout[int32]		### resource uses reserved name inout
    135 
    136 bar()
    137 
    138 s3 {
    139 	f1	int8:0		### bitfields of size 0 are not supported
    140 	f2	int8:1
    141 	f3	int8:7
    142 	f4	int8:8
    143 	f5	int8:9		### bitfield of size 9 is too large for base type of size 8
    144 	f6	int32:32
    145 	f7	int32:33	### bitfield of size 33 is too large for base type of size 32
    146 	f8	const[0, int32:C1]	### literal const bitfield sizes are not supported
    147 } [packed, align_4]
    148 
    149 s4 {
    150 	f1	int8
    151 } [align_7]			###  bad struct s4 alignment 7 (must be a sane power of 2)
    152 
    153 s5 {
    154 	f1	int8
    155 } [varlen]			### unknown struct s5 attribute varlen
    156 
    157 s6 {
    158 	f1	int8
    159 } [align_foo]			### bad struct s6 alignment foo
    160 
    161 s7 {
    162 	f1	ptr64[in, int32]
    163 }
    164 
    165 s8 {
    166 	f1	int8
    167 } [unknown]			### unknown struct s8 attribute unknown
    168 
    169 s9 {
    170 	f1	int8
    171 } ["foo"[0]]			### unexpected string "foo", expect attribute
    172 
    173 s10 {
    174 	f1	int8
    175 } [packed[0]]			### packed attribute has args
    176 
    177 s11 {
    178 	f1	int8
    179 } [size["foo"]]			### unexpected string "foo", expect int
    180 
    181 s12 {
    182 	f1	int8
    183 } [size[0:1]]			### size attribute has colon or args
    184 
    185 s13 {
    186 	f1	int8
    187 } [size[0[0]]]			### size attribute has colon or args
    188 
    189 u3 [
    190 	f1	int8
    191 	f2	int32
    192 ] [varlen]
    193 
    194 u4 [
    195 	f1	int8
    196 	f2	int32
    197 ] [packed]			### unknown union u4 attribute packed
    198 
    199 u5 [
    200 	f1	int8:1		### unexpected ':', only struct fields can be bitfields
    201 	f2	int8:2		### unexpected ':', only struct fields can be bitfields
    202 ]
    203 
    204 u6 [
    205 	f1	int8
    206 	f2	int64
    207 	f3	array[int8]
    208 ]
    209 
    210 define d0 SOMETHING
    211 define d1 `some C expression`
    212 define d2 some C expression
    213 define d2 SOMETHING		### duplicate define d2
    214 define d3 1
    215 
    216 # Type aliases.
    217 
    218 type mybool8 int8[0:1]
    219 type mybool16 int16[0:1]
    220 type net_port proc[100, 1, int16be]
    221 resource typeres0[mybool8]
    222 typestruct {
    223 	f1	mybool8
    224 	f2	mybool16
    225 }
    226 
    227 type type0 int8
    228 type type0 int8			### type type0 redeclared, previously declared as type alias at LOCATION
    229 resource type0[int32]		### type type0 redeclared, previously declared as type alias at LOCATION
    230 type0 = 0, 1
    231 type type1 type1		### type instantiation loop: type1 -> type1
    232 type type2 int8:4		### unexpected ':', only struct fields can be bitfields
    233 type type3 type2		### unknown type type2
    234 type type4 const[0]		### wrong number of arguments for type const, expect value, base type
    235 type type6 len[foo, int32]	### len can't be type alias target
    236 type type7 len[foo]		### len can't be type alias target
    237 resource typeres1[int32]
    238 type type8 typeres1		### typeres1 can't be type alias target
    239 type int8 int8			### type name int8 conflicts with builtin type
    240 type opt int8			### type uses reserved name opt
    241 type type9 const[0, int8]
    242 type type12 proc[123, 2, int16, opt]
    243 type type13 ptr[in, typestruct13]
    244 type type14 flags[type0, int32]
    245 type type15 const[0, type0]	### unexpected value type0 for base type argument of const type, expect [int8 int16 int32 int64 int16be int32be int64be intptr]
    246 type bool8 int8[0:1]		### type name bool8 conflicts with builtin type
    247 
    248 typestruct11 {
    249 	f	type11		### unknown type type11
    250 }
    251 
    252 typestruct12 {
    253 	f	type11		### unknown type type11
    254 }
    255 
    256 typestruct13 {
    257 	f1	type9
    258 	f2	type12
    259 }
    260 
    261 foo$100(a mybool8, b mybool16)
    262 foo$102(a type2)		### unknown type type2
    263 foo$103(a type0:4)		### type alias type0 with ':'
    264 foo$104(a type0[opt])		### type type0 is not a template
    265 foo$105() type0			### int8 can't be syscall return
    266 foo$106() type6			### unknown type type6
    267 foo$107(a type9, b type12)
    268 foo$108(a flags[type0])
    269 foo$109(a ptr[in, type0])
    270 
    271 # Type templates.
    272 
    273 type templ0[A, B] const[A, B]
    274 type templ2[A] A[0]
    275 type templ3[A] ptr[in, A]
    276 type templ4[A, A] ptr[in, A]	### duplicate type argument A
    277 type templ5[abc] ptr[in, abc]	### type argument abc must be ALL_CAPS
    278 type templ6[T] ptr[in, T]
    279 type templ7 templ0[templ6, int8]
    280 
    281 # Note: here 42 is stripped as base type, so const ends up without arguments.
    282 foo$201(a templ1[42])		### wrong number of arguments for type const, expect value
    283 type templ1[A] const[A]
    284 
    285 type templ_struct0[A, B] {
    286 	len	len[parent, int16]
    287 	typ	const[A, int16]
    288 	data	B
    289 } [align_4]
    290 
    291 type templ_struct1[STR] {
    292 	f	string[STR, 40]
    293 	f	int32		### duplicate field f in template struct templ_struct1
    294 }
    295 
    296 type templ_struct2[A] {
    297 	f	B		### unknown type B
    298 }
    299 
    300 type templ_base0[TYPE] {
    301 	f1	TYPE
    302 }
    303 
    304 type templ_templ0[BASE] {
    305 	f1	BASE
    306 }
    307 
    308 type templ_templ1[BASE] {
    309 	f1	BASE[int16]			### both template parameter BASE and its usage have sub-arguments
    310 }
    311 
    312 templ_templ_use0 {
    313 	f1	templ_templ0[templ_base0]	### template templ_base0 needs 1 arguments instead of 0
    314 	f2	templ_templ1[templ_base0[int32]]
    315 }
    316 
    317 foo$200(a templ0[42, int8])
    318 foo$202(a templ0)		### template templ0 needs 2 arguments instead of 0
    319 foo$203(a type0[42])		### type type0 is not a template
    320 foo$204(a ptr[in, templ_struct0[42, int8]])
    321 foo$205(a ptr[in, templ_struct0[int8, int8]])
    322 foo$207(a ptr[in, templ_struct2[1]])
    323 
    324 # fmt
    325 
    326 foo$fmt0(a ptr[in, fmt])			### wrong number of arguments for type fmt, expect format, value
    327 foo$fmt1(a fmt[dec, int8])			### fmt can't be syscall argument
    328 foo$fmt2(a ptr[in, fmt[dec, ptr[in, int8]]])	### bad fmt value ptr, expect an integer
    329 foo$fmt3(a ptr[in, fmt[foo, int8]])		### unexpected value foo for format argument of fmt type, expect [dec hex oct]
    330 foo$fmt4(a ptr[in, fmt[dec, int8:3]])		### unexpected ':', only struct fields can be bitfields
    331 
    332 struct$fmt0 {
    333 	f0	fmt[dec, int8:3]		### unexpected ':', only struct fields can be bitfields
    334 	f1	int32:-1			### bitfield of size 18446744073709551615 is too large for base type of size 32
    335 }
    336