Commit 88090ba
bpf: arm64: Fix panic due to missing BTI at indirect jump targets
When BTI is enabled, the indirect jump selftest triggers BTI exception:
Internal error: Oops - BTI: 0000000036000003 [#1] SMP
...
Call trace:
bpf_prog_2e5f1c71c13ac3e0_big_jump_table+0x54/0xf8 (P)
bpf_prog_run_pin_on_cpu+0x140/0x468
bpf_prog_test_run_syscall+0x280/0x3b8
bpf_prog_test_run+0x22c/0x2c0
__sys_bpf+0x4d8/0x5c8
__arm64_sys_bpf+0x88/0xa8
invoke_syscall+0x80/0x220
el0_svc_common+0x160/0x1d0
do_el0_svc+0x54/0x70
el0_svc+0x54/0x188
el0t_64_sync_handler+0x84/0x130
el0t_64_sync+0x198/0x1a0
This happens because no BTI instruction is generated by the JIT for
indirect jump targets.
Fix it by emitting BTI instruction for every possible indirect jump
targets when BTI is enabled. The targets are identified by traversing
all instruction arrays used by the BPF program, since indirect jump
targets can only be read from instruction arrays.
Fixes: f4a66cf ("bpf: arm64: Add support for indirect jumps")
Signed-off-by: Xu Kuohai <[email protected]>1 parent 4355736 commit 88090ba
File tree
3 files changed
+75
-0
lines changed- arch/arm64/net
- include/linux
- kernel/bpf
3 files changed
+75
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
78 | 78 | | |
79 | 79 | | |
80 | 80 | | |
| 81 | + | |
81 | 82 | | |
82 | 83 | | |
83 | 84 | | |
| |||
1199 | 1200 | | |
1200 | 1201 | | |
1201 | 1202 | | |
| 1203 | + | |
| 1204 | + | |
| 1205 | + | |
| 1206 | + | |
| 1207 | + | |
1202 | 1208 | | |
1203 | 1209 | | |
1204 | 1210 | | |
| |||
1231 | 1237 | | |
1232 | 1238 | | |
1233 | 1239 | | |
| 1240 | + | |
| 1241 | + | |
| 1242 | + | |
1234 | 1243 | | |
1235 | 1244 | | |
1236 | 1245 | | |
| |||
2085 | 2094 | | |
2086 | 2095 | | |
2087 | 2096 | | |
| 2097 | + | |
| 2098 | + | |
| 2099 | + | |
| 2100 | + | |
| 2101 | + | |
| 2102 | + | |
| 2103 | + | |
| 2104 | + | |
| 2105 | + | |
| 2106 | + | |
2088 | 2107 | | |
2089 | 2108 | | |
2090 | 2109 | | |
| |||
2248 | 2267 | | |
2249 | 2268 | | |
2250 | 2269 | | |
| 2270 | + | |
2251 | 2271 | | |
2252 | 2272 | | |
2253 | 2273 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3822 | 3822 | | |
3823 | 3823 | | |
3824 | 3824 | | |
| 3825 | + | |
| 3826 | + | |
3825 | 3827 | | |
3826 | 3828 | | |
3827 | 3829 | | |
3828 | 3830 | | |
3829 | 3831 | | |
| 3832 | + | |
| 3833 | + | |
| 3834 | + | |
| 3835 | + | |
| 3836 | + | |
| 3837 | + | |
| 3838 | + | |
| 3839 | + | |
| 3840 | + | |
| 3841 | + | |
3830 | 3842 | | |
3831 | 3843 | | |
3832 | 3844 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
302 | 302 | | |
303 | 303 | | |
304 | 304 | | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
0 commit comments