github.com/google/syzkaller@v0.0.0-20240517125934-c0f1611a36d6/pkg/compiler/testdata/all.txt (about)

     1  # Copyright 2018 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  meta noextract
     5  meta arches["32_shmem", "32_fork_shmem", "64", "64_fork"]
     6  
     7  foo_0(a int8)
     8  foo_1(a int8[C1:C2])
     9  foo_2(a ptr[out, array[int32]])
    10  foo_3(a union_arg)
    11  foo_4() r0
    12  foo_5(a int8['a':'z'])
    13  foo_6(a int8[-20:-10])
    14  foo_7(a int8[-20:20])
    15  foo_8(a ptr[in, strings])
    16  foo_9(a ptr[out, ptr[in, string]])
    17  foo_10(a ptr[out, buffer[in]])
    18  foo_11(a int64[1:100, 2])
    19  foo_12(a int64[0:-1, 0x1000])
    20  foo_13() (disabled)
    21  foo_14() r0 (timeout[100])
    22  foo_15() r0 (disabled, timeout[C1], prog_timeout[C2])
    23  foo_16(a int32[int_flags])
    24  foo_17(a int8[C1])
    25  foo_18(a int64[100])
    26  
    27  resource r0[intptr]
    28  
    29  union_arg [
    30  	f1	int8
    31  	f2	int64
    32  	f3	ptr[in, int32]
    33  	f4	r0
    34  	f5	const[1, intptr]
    35  	f6	flags[int_flags, int32]
    36  	f7	proc[0, 1, int16]
    37  ]
    38  
    39  strings {
    40  	f1	string
    41  	f2	string["foo"]
    42  	f3	string["foo", 10]
    43  	f4	string[string_flags1, 10]
    44  	f5	stringnoz
    45  	f6	stringnoz["foo"]
    46  	f7	string[""]
    47  	f8	string["", 10]
    48  	f9	stringnoz[""]
    49  	f11	stringnoz[string_flags1]
    50  	f12	string[string_flags2]
    51  	f13	stringnoz[string_flags2]
    52  	f14	string[`abcdef`, 4]
    53  	f15	string[string_flags3, 4]
    54  } [packed]
    55  
    56  string_flags1 = "foo", "barbaz"
    57  string_flags2 = ""
    58  string_flags3 = "ab", `010203`, `de`
    59  int_flags = 0, 1, 0xabc, 'x', -11
    60  _ = 1, 2
    61  _ = C1, C2
    62  
    63  # Proc type.
    64  
    65  proc_struct1 {
    66  	f1	proc[C0, 8, int8]
    67  }
    68  
    69  foo_proc1(a ptr[in, proc_struct1])
    70  
    71  # Len/bytesize types.
    72  
    73  type len_templ1[DATA1, DATA2] {
    74  	data	DATA1
    75  	inner	len_temp2[DATA2]
    76  }
    77  
    78  type len_temp2[DATA] {
    79  	data	DATA
    80  	len	len[len_templ1, int8]
    81  }
    82  
    83  foo_len_templ(a ptr[in, len_templ1[int8, int16]])
    84  foo_len_var0(a ptr[in, array[string]], b len[a])
    85  foo_len_var1(a ptr[in, array[string]], b ptr[in, len[a, int32]])
    86  
    87  len_expr1 {
    88  	f11	len_expr2
    89  	f12	bytesize[syscall:b, int32]
    90  }
    91  
    92  len_expr2 {
    93  	f21	len_expr3
    94  	f22	len_expr4
    95  	f23	ptr[in, len_expr4]
    96  	f24	ptr[in, ptr[in, len_expr4]]
    97  	f25	len[f21:f31, int32]
    98  	f26	len_union
    99  }
   100  
   101  len_expr3 {
   102  	f31	int32
   103  	f32	bytesize[len_expr2:f21, int32]
   104  	f33	bytesize[len_expr2:f22:f41, int32]
   105  	f34	bytesize[len_expr1:f11:f22:f41, int32]
   106  	f35	bytesize[len_expr2:f23:f41, int32]
   107  	f36	bytesize[len_expr2:f24:f41, int32]
   108  	f37	offsetof[f32, int32]
   109  	f38	offsetof[len_expr2:f21, int32]
   110  }
   111  
   112  len_expr4 {
   113  	f41	int32
   114  }
   115  
   116  len_union [
   117  	u1	len[parent:parent:f21:f31, int32]
   118  	u2	int32
   119  ]
   120  
   121  foo_len_expr(a ptr[in, len_expr1], b ptr[in, array[int8, 3]])
   122  
   123  # Pointer type.
   124  
   125  foo_ptr(a ptr[in, int64])
   126  foo_ptr64(a ptr64[in, int64])
   127  foo_vma(a vma)
   128  foo_vma64(a vma64)
   129  
   130  # Void type.
   131  
   132  void0 {
   133  	f	void
   134  }
   135  
   136  void1 {
   137  	f1	void
   138  	f2	int8
   139  }
   140  
   141  void2 {
   142  	f1	void
   143  	f2	int8
   144  }
   145  
   146  void3 [
   147  	f1	void
   148  	f2	int8
   149  ]
   150  
   151  void4 [
   152  	f1	void
   153  	f2	int8
   154  ] [varlen]
   155  
   156  void5 {
   157  	f1	void
   158  	f2	void
   159  }
   160  
   161  struct_with_void0 {
   162  	f1	int8
   163  	f2	array[array[void]]
   164  	f3	int64
   165  }
   166  
   167  struct_with_void1 {
   168  	f1	int8
   169  	f2	array[void5]
   170  	f3	int64
   171  	f4	optional[int8]
   172  }
   173  
   174  foo_void0(a ptr[in, void0])
   175  foo_void1(a ptr[in, void1])
   176  foo_void2(a ptr[in, void2])
   177  foo_void3(a ptr[in, void3])
   178  foo_void4(a ptr[in, void4])
   179  foo_void5(a ptr[in, void5])
   180  foo_void6(a ptr[in, struct_with_void0])
   181  foo_void7(a ptr[in, struct_with_void1])
   182  foo_void8(a ptr[in, void])
   183  
   184  # Bitfields.
   185  
   186  bitfield0 {
   187  	f1	int8:1
   188  	f2	int8:2
   189  	f3	int16:8[-127:0]
   190  	f4	int16:8[0:255]
   191  	f5	int64:64[-1:1]
   192  	f6	int32:4[int_flags]
   193  	f7	int8:3[C1]
   194  }
   195  
   196  foo_bitfield0(a ptr[in, bitfield0])
   197  
   198  # Type templates.
   199  
   200  type type0 int8
   201  type templ0[A, B] const[A, B]
   202  type templ2[STR] string[STR]
   203  type type3 templ2["a"]
   204  
   205  type templ_struct0[A, B] {
   206  	len	len[parent, int16]
   207  	typ	const[A, int16]
   208  	data	B
   209  } [align[4]]
   210  
   211  type templ_struct1[C] {
   212  	f1	const[C, int8]
   213  	f2	int8[0:C]
   214  }
   215  
   216  union_with_templ_struct [
   217  	f1	templ_struct0[C1, type0]
   218  	f2	templ_struct0[C2, struct0]
   219  ] [varlen]
   220  
   221  struct0 {
   222  	f1	int8
   223  	f2	int16
   224  }
   225  
   226  type templ_base0[TYPE, CONST] {
   227  	f1	TYPE
   228  	f2	const[CONST, int32]
   229  }
   230  
   231  type templ_base1[TYPE, CONST] {
   232  	f2	const[CONST, int8]
   233  	f1	TYPE
   234  }
   235  
   236  type templ_templ[TMPL, CONST] {
   237  	f1	TMPL[int8, CONST]
   238  	f2	TMPL[int32, 0]
   239  }
   240  
   241  templ_templ_use {
   242  	f1	templ_templ[templ_base0, 0]
   243  	f2	templ_templ[templ_base1, 1]
   244  }
   245  
   246  type templ_struct2[A] templ_struct0[A, int8]
   247  type templ_struct3 templ_struct2[C1]
   248  type templ_struct4 templ_struct3
   249  type templ_struct5 templ_struct0[C1, templ_struct0[C2, int8]]
   250  type templ_struct6 templ_struct0[C1, templ_struct2[C2]]
   251  type templ_union union_with_templ_struct
   252  type templ_base3[BASE] BASE
   253  type templ_base4[BASE] const[0, BASE]
   254  type templ_base5[VAL, BASE] const[VAL, BASE]
   255  
   256  foo_templ0(a templ0[42, int8])
   257  foo_templ1(a ptr[in, templ_struct0[C2, int8]])
   258  foo_templ2(a ptr[in, union_with_templ_struct])
   259  foo_templ3(a ptr[in, templ_struct1[1]], b ptr[in, templ_struct1[2]])
   260  foo_templ4(a ptr[in, templ_struct1[3]])
   261  foo_templ5(a ptr[in, templ_struct1[3]])
   262  foo_templ6(a ptr[in, templ_struct4])
   263  foo_templ7(a ptr[in, templ_struct5], b ptr[in, templ_struct6], c ptr[in, templ_union], d ptr[in, type3])
   264  foo_templ8(a ptr[in, templ_templ_use])
   265  foo_templ9(a ptr[in, templ_base3[int64]])
   266  foo_templ10(a ptr[in, templ_base4[int8]])
   267  foo_templ11(a ptr[in, templ_base5[42, int8]])
   268  
   269  foo_glob0(a ptr[in, glob["/sys/"]])
   270  foo_glob1(a ptr[in, glob["/sys/**/*"]])
   271  
   272  # Structs.
   273  
   274  s0 {
   275  	f1	int8
   276  } [size[64]]
   277  
   278  s1 {
   279  	f1	int8
   280  } [size[C2]]
   281  
   282  s2 {
   283  	f1	int8
   284  	f2	s3
   285  } [size[101]]
   286  
   287  s3 {
   288  	f1	int8
   289  } [size[100]]
   290  
   291  s4 {
   292  	f1	fmt[hex, int32]
   293  	f2	int8
   294  } [size[19]]
   295  
   296  s5 {
   297  	f_in0		int32	(in)
   298  	f_in1		int32[0:1]	(in)
   299  	f_out		int32	(out)
   300  	f_inout0	int32	(inout)
   301  	f_inout1	int32[0:1]	(inout)
   302  }
   303  
   304  s6 {
   305  	f0	int32
   306  	f1	r0
   307  	f2	int32	(out_overlay)
   308  	f3	r0
   309  }
   310  
   311  foo_s0(a ptr[in, s0], b ptr[in, s1], c ptr[in, s2], d ptr[in, s4], e ptr[in, s5], f ptr[in, s6])
   312  
   313  # Unions.
   314  
   315  u0 [
   316  	f1	int32
   317  ]
   318  
   319  foo_u0(a ptr[in, u0])
   320  
   321  # fmt
   322  
   323  foo_fmt0(a ptr[in, fmt[dec, int32[1:10]]])
   324  foo_fmt1(a ptr[in, fmt[hex, flags[int_flags]]])
   325  foo_fmt2(a ptr[in, fmt[oct, len[b]]], b ptr[in, array[int8]])
   326  foo_fmt3(a ptr[in, fmt[dec, proc[10, 20]]])
   327  foo_fmt4(a ptr[in, fmt[dec, r0]])
   328  foo_fmt5(a ptr[in, struct$fmt0])
   329  foo_fmt6(a ptr[in, fmt[dec, flags[flags_with_one_value]]])
   330  
   331  struct$fmt0 {
   332  	f0	fmt[dec, int8]
   333  }
   334  
   335  flags_with_one_value = 0
   336  
   337  # Compressed images.
   338  
   339  struct_compressed {
   340  	f0	compressed_image
   341  }
   342  
   343  union_compressed [
   344  	f0	compressed_image
   345  	f1	int32
   346  ] [varlen]
   347  
   348  compressed$1(a compressed_image) (no_generate, no_minimize)
   349  compressed$2(a ptr[in, compressed_image]) (no_generate, no_minimize)
   350  compressed$3(a ptr[in, struct_compressed]) (no_generate, no_minimize)
   351  compressed$4(a ptr[in, union_compressed]) (no_generate, no_minimize)
   352  
   353  struct$conditional {
   354  	f0	int32
   355  	f1	int64	(if[value[f0] == 1])
   356  	f2	struct$conditional2
   357  	f3	union$conditional3
   358  } [packed]
   359  
   360  struct$conditional2 {
   361  	f3	int32	(if[value[parent:parent:f0] == 2])
   362  	f4	int32	(if[value[struct$conditional:f0] == 2])
   363  } [packed]
   364  
   365  union$conditional3 [
   366  	u1	int32	(if[value[parent:parent:f0] == 3])
   367  	u2	int32	(if[value[struct$conditional:f0] == 3])
   368  	u3	const[0xabcd, int64]
   369  ]
   370  
   371  conditional(a ptr[in, struct$conditional])