~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/tools/testing/selftests/bpf/verifier/ld_imm64.c

Version: ~ [ linux-6.12-rc7 ] ~ [ linux-6.11.7 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.60 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.116 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.171 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.229 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.285 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.323 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.12 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

Diff markup

Differences between /tools/testing/selftests/bpf/verifier/ld_imm64.c (Architecture i386) and /tools/testing/selftests/bpf/verifier/ld_imm64.c (Architecture mips)


  1 {                                                   1 {
  2         "test1 ld_imm64",                           2         "test1 ld_imm64",
  3         .insns = {                                  3         .insns = {
  4         BPF_JMP_IMM(BPF_JEQ, BPF_REG_1, 0, 1),      4         BPF_JMP_IMM(BPF_JEQ, BPF_REG_1, 0, 1),
  5         BPF_LD_IMM64(BPF_REG_0, 0),                 5         BPF_LD_IMM64(BPF_REG_0, 0),
  6         BPF_LD_IMM64(BPF_REG_0, 0),                 6         BPF_LD_IMM64(BPF_REG_0, 0),
  7         BPF_LD_IMM64(BPF_REG_0, 1),                 7         BPF_LD_IMM64(BPF_REG_0, 1),
  8         BPF_LD_IMM64(BPF_REG_0, 1),                 8         BPF_LD_IMM64(BPF_REG_0, 1),
  9         BPF_MOV64_IMM(BPF_REG_0, 2),                9         BPF_MOV64_IMM(BPF_REG_0, 2),
 10         BPF_EXIT_INSN(),                           10         BPF_EXIT_INSN(),
 11         },                                         11         },
 12         .errstr = "jump into the middle of ldi     12         .errstr = "jump into the middle of ldimm64 insn 1",
 13         .errstr_unpriv = "jump into the middle     13         .errstr_unpriv = "jump into the middle of ldimm64 insn 1",
 14         .result = REJECT,                          14         .result = REJECT,
 15 },                                                 15 },
 16 {                                                  16 {
 17         "test2 ld_imm64",                          17         "test2 ld_imm64",
 18         .insns = {                                 18         .insns = {
 19         BPF_JMP_IMM(BPF_JEQ, BPF_REG_1, 0, 1),     19         BPF_JMP_IMM(BPF_JEQ, BPF_REG_1, 0, 1),
 20         BPF_LD_IMM64(BPF_REG_0, 0),                20         BPF_LD_IMM64(BPF_REG_0, 0),
 21         BPF_LD_IMM64(BPF_REG_0, 0),                21         BPF_LD_IMM64(BPF_REG_0, 0),
 22         BPF_LD_IMM64(BPF_REG_0, 1),                22         BPF_LD_IMM64(BPF_REG_0, 1),
 23         BPF_LD_IMM64(BPF_REG_0, 1),                23         BPF_LD_IMM64(BPF_REG_0, 1),
 24         BPF_EXIT_INSN(),                           24         BPF_EXIT_INSN(),
 25         },                                         25         },
 26         .errstr = "jump into the middle of ldi     26         .errstr = "jump into the middle of ldimm64 insn 1",
 27         .errstr_unpriv = "jump into the middle     27         .errstr_unpriv = "jump into the middle of ldimm64 insn 1",
 28         .result = REJECT,                          28         .result = REJECT,
 29 },                                                 29 },
 30 {                                                  30 {
 31         "test3 ld_imm64",                          31         "test3 ld_imm64",
 32         .insns = {                                 32         .insns = {
 33         BPF_JMP_IMM(BPF_JEQ, BPF_REG_1, 0, 1),     33         BPF_JMP_IMM(BPF_JEQ, BPF_REG_1, 0, 1),
 34         BPF_RAW_INSN(BPF_LD | BPF_IMM | BPF_DW     34         BPF_RAW_INSN(BPF_LD | BPF_IMM | BPF_DW, 0, 0, 0, 0),
 35         BPF_LD_IMM64(BPF_REG_0, 0),                35         BPF_LD_IMM64(BPF_REG_0, 0),
 36         BPF_LD_IMM64(BPF_REG_0, 0),                36         BPF_LD_IMM64(BPF_REG_0, 0),
 37         BPF_LD_IMM64(BPF_REG_0, 1),                37         BPF_LD_IMM64(BPF_REG_0, 1),
 38         BPF_LD_IMM64(BPF_REG_0, 1),                38         BPF_LD_IMM64(BPF_REG_0, 1),
 39         BPF_EXIT_INSN(),                           39         BPF_EXIT_INSN(),
 40         },                                         40         },
 41         .errstr = "invalid bpf_ld_imm64 insn",     41         .errstr = "invalid bpf_ld_imm64 insn",
 42         .result = REJECT,                          42         .result = REJECT,
 43 },                                                 43 },
 44 {                                                  44 {
 45         "test4 ld_imm64",                          45         "test4 ld_imm64",
 46         .insns = {                                 46         .insns = {
 47         BPF_RAW_INSN(BPF_LD | BPF_IMM | BPF_DW     47         BPF_RAW_INSN(BPF_LD | BPF_IMM | BPF_DW, 0, 0, 0, 0),
 48         BPF_EXIT_INSN(),                           48         BPF_EXIT_INSN(),
 49         },                                         49         },
 50         .errstr = "invalid bpf_ld_imm64 insn",     50         .errstr = "invalid bpf_ld_imm64 insn",
 51         .result = REJECT,                          51         .result = REJECT,
 52 },                                                 52 },
 53 {                                                  53 {
 54         "test6 ld_imm64",                          54         "test6 ld_imm64",
 55         .insns = {                                 55         .insns = {
 56         BPF_RAW_INSN(BPF_LD | BPF_IMM | BPF_DW     56         BPF_RAW_INSN(BPF_LD | BPF_IMM | BPF_DW, 0, 0, 0, 0),
 57         BPF_RAW_INSN(0, 0, 0, 0, 0),               57         BPF_RAW_INSN(0, 0, 0, 0, 0),
 58         BPF_EXIT_INSN(),                           58         BPF_EXIT_INSN(),
 59         },                                         59         },
 60         .result = ACCEPT,                          60         .result = ACCEPT,
 61 },                                                 61 },
 62 {                                                  62 {
 63         "test7 ld_imm64",                          63         "test7 ld_imm64",
 64         .insns = {                                 64         .insns = {
 65         BPF_RAW_INSN(BPF_LD | BPF_IMM | BPF_DW     65         BPF_RAW_INSN(BPF_LD | BPF_IMM | BPF_DW, 0, 0, 0, 1),
 66         BPF_RAW_INSN(0, 0, 0, 0, 1),               66         BPF_RAW_INSN(0, 0, 0, 0, 1),
 67         BPF_EXIT_INSN(),                           67         BPF_EXIT_INSN(),
 68         },                                         68         },
 69         .result = ACCEPT,                          69         .result = ACCEPT,
 70         .retval = 1,                               70         .retval = 1,
 71 },                                                 71 },
 72 {                                                  72 {
 73         "test8 ld_imm64",                          73         "test8 ld_imm64",
 74         .insns = {                                 74         .insns = {
 75         BPF_RAW_INSN(BPF_LD | BPF_IMM | BPF_DW     75         BPF_RAW_INSN(BPF_LD | BPF_IMM | BPF_DW, 0, 0, 1, 1),
 76         BPF_RAW_INSN(0, 0, 0, 0, 1),               76         BPF_RAW_INSN(0, 0, 0, 0, 1),
 77         BPF_EXIT_INSN(),                           77         BPF_EXIT_INSN(),
 78         },                                         78         },
 79         .errstr = "uses reserved fields",          79         .errstr = "uses reserved fields",
 80         .result = REJECT,                          80         .result = REJECT,
 81 },                                                 81 },
 82 {                                                  82 {
 83         "test9 ld_imm64",                          83         "test9 ld_imm64",
 84         .insns = {                                 84         .insns = {
 85         BPF_RAW_INSN(BPF_LD | BPF_IMM | BPF_DW     85         BPF_RAW_INSN(BPF_LD | BPF_IMM | BPF_DW, 0, 0, 0, 1),
 86         BPF_RAW_INSN(0, 0, 0, 1, 1),               86         BPF_RAW_INSN(0, 0, 0, 1, 1),
 87         BPF_EXIT_INSN(),                           87         BPF_EXIT_INSN(),
 88         },                                         88         },
 89         .errstr = "invalid bpf_ld_imm64 insn",     89         .errstr = "invalid bpf_ld_imm64 insn",
 90         .result = REJECT,                          90         .result = REJECT,
 91 },                                                 91 },
 92 {                                                  92 {
 93         "test10 ld_imm64",                         93         "test10 ld_imm64",
 94         .insns = {                                 94         .insns = {
 95         BPF_RAW_INSN(BPF_LD | BPF_IMM | BPF_DW     95         BPF_RAW_INSN(BPF_LD | BPF_IMM | BPF_DW, 0, 0, 0, 1),
 96         BPF_RAW_INSN(0, BPF_REG_1, 0, 0, 1),       96         BPF_RAW_INSN(0, BPF_REG_1, 0, 0, 1),
 97         BPF_EXIT_INSN(),                           97         BPF_EXIT_INSN(),
 98         },                                         98         },
 99         .errstr = "invalid bpf_ld_imm64 insn",     99         .errstr = "invalid bpf_ld_imm64 insn",
100         .result = REJECT,                         100         .result = REJECT,
101 },                                                101 },
102 {                                                 102 {
103         "test11 ld_imm64",                        103         "test11 ld_imm64",
104         .insns = {                                104         .insns = {
105         BPF_RAW_INSN(BPF_LD | BPF_IMM | BPF_DW    105         BPF_RAW_INSN(BPF_LD | BPF_IMM | BPF_DW, 0, 0, 0, 1),
106         BPF_RAW_INSN(0, 0, BPF_REG_1, 0, 1),      106         BPF_RAW_INSN(0, 0, BPF_REG_1, 0, 1),
107         BPF_EXIT_INSN(),                          107         BPF_EXIT_INSN(),
108         },                                        108         },
109         .errstr = "invalid bpf_ld_imm64 insn",    109         .errstr = "invalid bpf_ld_imm64 insn",
110         .result = REJECT,                         110         .result = REJECT,
111 },                                                111 },
112 {                                                 112 {
113         "test12 ld_imm64",                        113         "test12 ld_imm64",
114         .insns = {                                114         .insns = {
115         BPF_MOV64_IMM(BPF_REG_1, 0),              115         BPF_MOV64_IMM(BPF_REG_1, 0),
116         BPF_RAW_INSN(BPF_LD | BPF_IMM | BPF_DW    116         BPF_RAW_INSN(BPF_LD | BPF_IMM | BPF_DW, 0, BPF_REG_1, 0, 1),
117         BPF_RAW_INSN(0, 0, 0, 0, 0),              117         BPF_RAW_INSN(0, 0, 0, 0, 0),
118         BPF_EXIT_INSN(),                          118         BPF_EXIT_INSN(),
119         },                                        119         },
120         .errstr = "not pointing to valid bpf_m    120         .errstr = "not pointing to valid bpf_map",
121         .result = REJECT,                         121         .result = REJECT,
122 },                                                122 },
123 {                                                 123 {
124         "test13 ld_imm64",                        124         "test13 ld_imm64",
125         .insns = {                                125         .insns = {
126         BPF_MOV64_IMM(BPF_REG_1, 0),              126         BPF_MOV64_IMM(BPF_REG_1, 0),
127         BPF_RAW_INSN(BPF_LD | BPF_IMM | BPF_DW    127         BPF_RAW_INSN(BPF_LD | BPF_IMM | BPF_DW, 0, BPF_REG_1, 0, 1),
128         BPF_RAW_INSN(0, 0, BPF_REG_1, 0, 1),      128         BPF_RAW_INSN(0, 0, BPF_REG_1, 0, 1),
129         BPF_EXIT_INSN(),                          129         BPF_EXIT_INSN(),
130         },                                        130         },
131         .errstr = "invalid bpf_ld_imm64 insn",    131         .errstr = "invalid bpf_ld_imm64 insn",
132         .result = REJECT,                         132         .result = REJECT,
133 },                                                133 },
134 {                                                 134 {
135         "test14 ld_imm64: reject 2nd imm != 0"    135         "test14 ld_imm64: reject 2nd imm != 0",
136         .insns = {                                136         .insns = {
137         BPF_MOV64_IMM(BPF_REG_0, 0),              137         BPF_MOV64_IMM(BPF_REG_0, 0),
138         BPF_RAW_INSN(BPF_LD | BPF_IMM | BPF_DW    138         BPF_RAW_INSN(BPF_LD | BPF_IMM | BPF_DW, BPF_REG_1,
139                      BPF_PSEUDO_MAP_FD, 0, 0),    139                      BPF_PSEUDO_MAP_FD, 0, 0),
140         BPF_RAW_INSN(0, 0, 0, 0, 0xfefefe),       140         BPF_RAW_INSN(0, 0, 0, 0, 0xfefefe),
141         BPF_EXIT_INSN(),                          141         BPF_EXIT_INSN(),
142         },                                        142         },
143         .fixup_map_hash_48b = { 1 },              143         .fixup_map_hash_48b = { 1 },
144         .errstr = "unrecognized bpf_ld_imm64 i    144         .errstr = "unrecognized bpf_ld_imm64 insn",
145         .result = REJECT,                         145         .result = REJECT,
146 },                                                146 },
147                                                   147 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php