Commit 2f44034
bpf: Set -ENOMEM to err in bpf_int_jit_compile().
syzkaller reported a splat below. [0]
It always followed another splat by fault injection in
bpf_int_jit_compile(). [1]
Instead of proceeding with __bpf_prog_ret0_warn() and seeing
a splat later, let's return -ENOMEM to userspace.
[0]:
WARNING: CPU: 1 PID: 36 at kernel/bpf/core.c:2357 __bpf_prog_ret0_warn+0xa/0x10 kernel/bpf/core.c:2357
Modules linked in:
CPU: 1 UID: 0 PID: 36 Comm: kworker/1:1 Not tainted 6.14.0-13344-ga9843689e2de #28 PREEMPT(voluntary) 167b7ecb8f281ed56016416cdf1d8bb342db88fc
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.16.3-0-ga6ed6b701f0a-prebuilt.qemu.org 04/01/2014
Workqueue: mld mld_ifc_work
RIP: 0010:__bpf_prog_ret0_warn+0xa/0x10 kernel/bpf/core.c:2357
Code: ff eb 84 e8 b8 cf ee ff e9 7a ff ff ff e8 ae cf ee ff e9 70 ff ff ff 66 0f 1f 84 00 00 00 00 00 f3 0f 1e fa e8 97 cf ee ff 90 <0f> 0b 90 31 c0 c3 f3 0f 1e fa 55 48 89 e5 41 57 41 56 41 55 41 54
RSP: 0000:ffa0000000267050 EFLAGS: 00010293
RAX: ffffffff81881569 RBX: ffa0000000393030 RCX: ff11000100dc4500
RDX: 0000000000000000 RSI: ffa0000000393048 RDI: ff1100010b812a00
RBP: 0000000000000000 R08: 0000000000000002 R09: 0000000000000000
R10: dffffc0000000000 R11: fffffbfff0e5ef77 R12: 0000000000000000
R13: dffffc0000000000 R14: ff1100010b812a00 R15: ffa0000000393048
FS: 0000000000000000(0000) GS:ff11000192213000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007ff451d686ec CR3: 00000001037eb004 CR4: 0000000000771ef0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe07f0 DR7: 0000000000000600
PKRU: 55555554
Call Trace:
<TASK>
bpf_dispatcher_nop_func include/linux/bpf.h:1316 [inline]
__bpf_prog_run include/linux/filter.h:718 [inline]
bpf_prog_run include/linux/filter.h:725 [inline]
bpf_prog_run_pin_on_cpu include/linux/filter.h:742 [inline]
bpf_prog_run_clear_cb+0x7f/0x140 include/linux/filter.h:983
run_filter+0x156/0x260 net/packet/af_packet.c:2135
packet_rcv+0x491/0x15b0 net/packet/af_packet.c:2208
dev_queue_xmit_nit+0xc27/0xcb0 net/core/dev.c:2592
xmit_one net/core/dev.c:3831 [inline]
dev_hard_start_xmit+0x1d5/0x720 net/core/dev.c:3851
sch_direct_xmit+0x242/0x4a0 net/sched/sch_generic.c:343
__dev_xmit_skb net/core/dev.c:4127 [inline]
__dev_queue_xmit+0x186d/0x37a0 net/core/dev.c:4654
dev_queue_xmit include/linux/netdevice.h:3355 [inline]
neigh_hh_output include/net/neighbour.h:523 [inline]
neigh_output include/net/neighbour.h:537 [inline]
ip6_finish_output2+0x11f3/0x16e0 net/ipv6/ip6_output.c:141
dst_output include/net/dst.h:459 [inline]
NF_HOOK+0x160/0x470 include/linux/netfilter.h:314
mld_sendpack+0x7f7/0xd70 net/ipv6/mcast.c:1868
mld_send_cr net/ipv6/mcast.c:2169 [inline]
mld_ifc_work+0x835/0xde0 net/ipv6/mcast.c:2702
process_one_work kernel/workqueue.c:3238 [inline]
process_scheduled_works+0xa77/0x16a0 kernel/workqueue.c:3319
worker_thread+0x8b6/0xd50 kernel/workqueue.c:3400
kthread+0x413/0x870 kernel/kthread.c:464
ret_from_fork+0x48/0x80 arch/x86/kernel/process.c:153
ret_from_fork_asm+0x11/0x20 arch/x86/entry/entry_64.S:245
</TASK>
[1]:
FAULT_INJECTION: forcing a failure.
name failslab, interval 1, probability 0, space 0, times 1
CPU: 1 UID: 0 PID: 4562 Comm: syz.4.1225 Not tainted 6.14.0-13344-ga9843689e2de #28 PREEMPT(voluntary) 167b7ecb8f281ed56016416cdf1d8bb342db88fc
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.16.3-0-ga6ed6b701f0a-prebuilt.qemu.org 04/01/2014
Call Trace:
<TASK>
dump_stack_lvl+0xfa/0x120
should_fail_ex+0x501/0x610
should_failslab+0xba/0x120
__kmalloc_cache_noprof+0x5d/0x310
bpf_int_jit_compile+0x1292/0x18b0
bpf_prog_select_runtime+0x439/0x780
Fixes: fa9dd59 ("bpf: get rid of pure_initcall dependency to enable jits")
Reported-by: syzkaller <syzkaller@googlegroups.com>
Signed-off-by: Kuniyuki Iwashima <kuniyu@amazon.com>1 parent 9a5f807 commit 2f44034
File tree
12 files changed
+91
-20
lines changed- arch
- arc/net
- arm64/net
- arm/net
- loongarch/net
- mips/net
- parisc/net
- powerpc/net
- riscv/net
- s390/net
- sparc/net
- x86/net
12 files changed
+91
-20
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1335 | 1335 | | |
1336 | 1336 | | |
1337 | 1337 | | |
1338 | | - | |
| 1338 | + | |
1339 | 1339 | | |
1340 | 1340 | | |
1341 | 1341 | | |
1342 | 1342 | | |
1343 | 1343 | | |
1344 | 1344 | | |
1345 | 1345 | | |
1346 | | - | |
| 1346 | + | |
| 1347 | + | |
1347 | 1348 | | |
1348 | 1349 | | |
1349 | 1350 | | |
1350 | 1351 | | |
1351 | 1352 | | |
1352 | | - | |
| 1353 | + | |
| 1354 | + | |
| 1355 | + | |
| 1356 | + | |
1353 | 1357 | | |
1354 | 1358 | | |
1355 | 1359 | | |
| |||
1374 | 1378 | | |
1375 | 1379 | | |
1376 | 1380 | | |
1377 | | - | |
| 1381 | + | |
1378 | 1382 | | |
1379 | 1383 | | |
1380 | 1384 | | |
1381 | 1385 | | |
1382 | 1386 | | |
1383 | 1387 | | |
1384 | 1388 | | |
1385 | | - | |
| 1389 | + | |
| 1390 | + | |
1386 | 1391 | | |
1387 | 1392 | | |
1388 | 1393 | | |
| |||
1417 | 1422 | | |
1418 | 1423 | | |
1419 | 1424 | | |
1420 | | - | |
| 1425 | + | |
1421 | 1426 | | |
1422 | | - | |
| 1427 | + | |
1423 | 1428 | | |
1424 | 1429 | | |
1425 | 1430 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2164 | 2164 | | |
2165 | 2165 | | |
2166 | 2166 | | |
2167 | | - | |
| 2167 | + | |
| 2168 | + | |
| 2169 | + | |
2168 | 2170 | | |
| 2171 | + | |
2169 | 2172 | | |
2170 | 2173 | | |
2171 | 2174 | | |
| |||
2180 | 2183 | | |
2181 | 2184 | | |
2182 | 2185 | | |
| 2186 | + | |
2183 | 2187 | | |
2184 | 2188 | | |
2185 | 2189 | | |
| |||
2214 | 2218 | | |
2215 | 2219 | | |
2216 | 2220 | | |
| 2221 | + | |
2217 | 2222 | | |
2218 | 2223 | | |
2219 | 2224 | | |
| |||
2239 | 2244 | | |
2240 | 2245 | | |
2241 | 2246 | | |
| 2247 | + | |
2242 | 2248 | | |
2243 | 2249 | | |
2244 | 2250 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1843 | 1843 | | |
1844 | 1844 | | |
1845 | 1845 | | |
1846 | | - | |
| 1846 | + | |
| 1847 | + | |
| 1848 | + | |
1847 | 1849 | | |
| 1850 | + | |
1848 | 1851 | | |
1849 | 1852 | | |
1850 | 1853 | | |
| |||
1854 | 1857 | | |
1855 | 1858 | | |
1856 | 1859 | | |
| 1860 | + | |
1857 | 1861 | | |
1858 | 1862 | | |
1859 | 1863 | | |
| |||
1875 | 1879 | | |
1876 | 1880 | | |
1877 | 1881 | | |
| 1882 | + | |
1878 | 1883 | | |
1879 | 1884 | | |
1880 | 1885 | | |
| |||
1914 | 1919 | | |
1915 | 1920 | | |
1916 | 1921 | | |
| 1922 | + | |
1917 | 1923 | | |
1918 | 1924 | | |
1919 | 1925 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1209 | 1209 | | |
1210 | 1210 | | |
1211 | 1211 | | |
1212 | | - | |
| 1212 | + | |
| 1213 | + | |
| 1214 | + | |
1213 | 1215 | | |
| 1216 | + | |
1214 | 1217 | | |
1215 | 1218 | | |
1216 | 1219 | | |
| |||
1221 | 1224 | | |
1222 | 1225 | | |
1223 | 1226 | | |
| 1227 | + | |
1224 | 1228 | | |
1225 | 1229 | | |
1226 | 1230 | | |
| |||
1240 | 1244 | | |
1241 | 1245 | | |
1242 | 1246 | | |
| 1247 | + | |
1243 | 1248 | | |
1244 | 1249 | | |
1245 | 1250 | | |
| |||
1266 | 1271 | | |
1267 | 1272 | | |
1268 | 1273 | | |
| 1274 | + | |
1269 | 1275 | | |
1270 | 1276 | | |
1271 | 1277 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
932 | 932 | | |
933 | 933 | | |
934 | 934 | | |
935 | | - | |
| 935 | + | |
| 936 | + | |
| 937 | + | |
936 | 938 | | |
| 939 | + | |
937 | 940 | | |
938 | 941 | | |
939 | 942 | | |
| |||
948 | 951 | | |
949 | 952 | | |
950 | 953 | | |
951 | | - | |
| 954 | + | |
| 955 | + | |
952 | 956 | | |
| 957 | + | |
953 | 958 | | |
954 | 959 | | |
955 | 960 | | |
| |||
991 | 996 | | |
992 | 997 | | |
993 | 998 | | |
994 | | - | |
| 999 | + | |
| 1000 | + | |
995 | 1001 | | |
| 1002 | + | |
996 | 1003 | | |
997 | 1004 | | |
998 | 1005 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
54 | 54 | | |
55 | 55 | | |
56 | 56 | | |
57 | | - | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
58 | 60 | | |
| 61 | + | |
59 | 62 | | |
60 | 63 | | |
61 | 64 | | |
| |||
65 | 68 | | |
66 | 69 | | |
67 | 70 | | |
| 71 | + | |
68 | 72 | | |
69 | 73 | | |
70 | 74 | | |
| |||
82 | 86 | | |
83 | 87 | | |
84 | 88 | | |
| 89 | + | |
85 | 90 | | |
86 | 91 | | |
87 | 92 | | |
| |||
117 | 122 | | |
118 | 123 | | |
119 | 124 | | |
| 125 | + | |
120 | 126 | | |
121 | 127 | | |
122 | 128 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
155 | 155 | | |
156 | 156 | | |
157 | 157 | | |
158 | | - | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
159 | 161 | | |
| 162 | + | |
160 | 163 | | |
161 | 164 | | |
162 | 165 | | |
| |||
167 | 170 | | |
168 | 171 | | |
169 | 172 | | |
| 173 | + | |
170 | 174 | | |
171 | 175 | | |
172 | 176 | | |
| |||
195 | 199 | | |
196 | 200 | | |
197 | 201 | | |
| 202 | + | |
198 | 203 | | |
199 | 204 | | |
200 | 205 | | |
| |||
246 | 251 | | |
247 | 252 | | |
248 | 253 | | |
| 254 | + | |
249 | 255 | | |
250 | 256 | | |
251 | 257 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
55 | 55 | | |
56 | 56 | | |
57 | 57 | | |
58 | | - | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
59 | 61 | | |
| 62 | + | |
60 | 63 | | |
61 | 64 | | |
62 | 65 | | |
| |||
66 | 69 | | |
67 | 70 | | |
68 | 71 | | |
| 72 | + | |
69 | 73 | | |
70 | 74 | | |
71 | 75 | | |
| |||
85 | 89 | | |
86 | 90 | | |
87 | 91 | | |
| 92 | + | |
88 | 93 | | |
89 | 94 | | |
90 | 95 | | |
| |||
128 | 133 | | |
129 | 134 | | |
130 | 135 | | |
| 136 | + | |
131 | 137 | | |
132 | 138 | | |
133 | 139 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2274 | 2274 | | |
2275 | 2275 | | |
2276 | 2276 | | |
2277 | | - | |
| 2277 | + | |
| 2278 | + | |
| 2279 | + | |
2278 | 2280 | | |
| 2281 | + | |
2279 | 2282 | | |
2280 | 2283 | | |
2281 | 2284 | | |
| |||
2285 | 2288 | | |
2286 | 2289 | | |
2287 | 2290 | | |
| 2291 | + | |
2288 | 2292 | | |
2289 | 2293 | | |
2290 | 2294 | | |
| |||
2301 | 2305 | | |
2302 | 2306 | | |
2303 | 2307 | | |
| 2308 | + | |
2304 | 2309 | | |
2305 | 2310 | | |
2306 | 2311 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1496 | 1496 | | |
1497 | 1497 | | |
1498 | 1498 | | |
1499 | | - | |
| 1499 | + | |
| 1500 | + | |
| 1501 | + | |
1500 | 1502 | | |
| 1503 | + | |
1501 | 1504 | | |
1502 | 1505 | | |
1503 | 1506 | | |
| |||
1507 | 1510 | | |
1508 | 1511 | | |
1509 | 1512 | | |
| 1513 | + | |
1510 | 1514 | | |
1511 | 1515 | | |
1512 | 1516 | | |
| |||
1528 | 1532 | | |
1529 | 1533 | | |
1530 | 1534 | | |
| 1535 | + | |
1531 | 1536 | | |
1532 | 1537 | | |
1533 | 1538 | | |
| |||
1570 | 1575 | | |
1571 | 1576 | | |
1572 | 1577 | | |
| 1578 | + | |
1573 | 1579 | | |
1574 | 1580 | | |
1575 | 1581 | | |
| |||
0 commit comments