Commit e7a0adb
committed
Merge branch 'libbpf-move-arena-variables-out-of-the-zero-page'
Emil Tsalapatis says:
====================
libbpf: move arena variables out of the zero page
Modify libbpf to place arena globals at the end of the arena mapping
instead of the very beginning. This allows programs to leave the
"zero page" of the arena unmapped, so that NULL arena pointer
dereferences trigger a page fault and associated backtrace in BPF streams.
In contrast, the current policy of placing global data in the zero pages
means that NULL dereferences silently corrupt global data, e.g, arena
qspinlock state. This makes arena bugs more difficult to debug.
The patchset adds code to libbpf to move global arena data to the end of
the arena. At load time, libbpf adjusts each symbol's location within
the arena to point to the right location in the arena. The patchset
also adjusts the arena skeleton pointer to point to the arena globals,
now that they are not in the beginning of the arena region.
CHANGESET
=========
v3->v4: (https://lore.kernel.org/bpf/[email protected]/T/#t)
- Added Acks by Eduard
- Changed jumptable sym_off to unsigned int for consistency (AI)
- Adjusted selftests to ensure arena globals are actually mapped in (Eduard)
- (Patch 2) Adjusted selftests that were failing because they were expecting the
now removed "direct map offset" error message
v2->v3: (https://lore.kernel.org/bpf/[email protected]/)
- Remove unnecessary kernel bounds check in resolve_pseudo_ldimm64
(Andrii)
- Added patch to turn sym_off unsigned to prevent overflow (AI)
- Remove obsolete references to offsets from test patch description
(Andrii)
- Use size_t for arena_data_off (Andrii)
- Remove extra mutable variable from offset calculations (Andrii)
v1->v2: (https://lore.kernel.org/bpf/[email protected])
- Moved globals to the end of the mapping: (Andrii)
- Removed extra parameter for offset and parameter picking logic
- Removed padding in the skeleton
- Removed additional libbpf call
- Added Reviewed-by from Eduard on patch 1
Signed-off-by: Emil Tsalapatis <[email protected]>
====================
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Andrii Nakryiko <[email protected]>File tree
7 files changed
+179
-22
lines changed- kernel/bpf
- tools
- lib/bpf
- testing/selftests/bpf
- prog_tests
- progs
- verifier
7 files changed
+179
-22
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21132 | 21132 | | |
21133 | 21133 | | |
21134 | 21134 | | |
21135 | | - | |
21136 | | - | |
21137 | | - | |
21138 | | - | |
21139 | | - | |
21140 | 21135 | | |
21141 | 21136 | | |
21142 | 21137 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
380 | 380 | | |
381 | 381 | | |
382 | 382 | | |
383 | | - | |
| 383 | + | |
384 | 384 | | |
385 | 385 | | |
386 | 386 | | |
| |||
757 | 757 | | |
758 | 758 | | |
759 | 759 | | |
| 760 | + | |
760 | 761 | | |
761 | 762 | | |
762 | 763 | | |
763 | 764 | | |
764 | 765 | | |
765 | 766 | | |
766 | | - | |
| 767 | + | |
767 | 768 | | |
768 | 769 | | |
769 | 770 | | |
| |||
2991 | 2992 | | |
2992 | 2993 | | |
2993 | 2994 | | |
| 2995 | + | |
2994 | 2996 | | |
2995 | 2997 | | |
2996 | 2998 | | |
2997 | | - | |
| 2999 | + | |
2998 | 3000 | | |
2999 | 3001 | | |
3000 | 3002 | | |
| |||
3006 | 3008 | | |
3007 | 3009 | | |
3008 | 3010 | | |
| 3011 | + | |
| 3012 | + | |
| 3013 | + | |
3009 | 3014 | | |
3010 | 3015 | | |
3011 | 3016 | | |
| |||
4663 | 4668 | | |
4664 | 4669 | | |
4665 | 4670 | | |
4666 | | - | |
| 4671 | + | |
4667 | 4672 | | |
4668 | 4673 | | |
4669 | 4674 | | |
| |||
5624 | 5629 | | |
5625 | 5630 | | |
5626 | 5631 | | |
5627 | | - | |
| 5632 | + | |
| 5633 | + | |
5628 | 5634 | | |
5629 | 5635 | | |
5630 | 5636 | | |
| |||
6192 | 6198 | | |
6193 | 6199 | | |
6194 | 6200 | | |
6195 | | - | |
| 6201 | + | |
6196 | 6202 | | |
6197 | 6203 | | |
6198 | 6204 | | |
| |||
6210 | 6216 | | |
6211 | 6217 | | |
6212 | 6218 | | |
6213 | | - | |
| 6219 | + | |
6214 | 6220 | | |
6215 | 6221 | | |
6216 | 6222 | | |
| |||
6244 | 6250 | | |
6245 | 6251 | | |
6246 | 6252 | | |
6247 | | - | |
| 6253 | + | |
6248 | 6254 | | |
6249 | 6255 | | |
6250 | 6256 | | |
| |||
6260 | 6266 | | |
6261 | 6267 | | |
6262 | 6268 | | |
6263 | | - | |
| 6269 | + | |
6264 | 6270 | | |
6265 | 6271 | | |
6266 | 6272 | | |
| |||
6316 | 6322 | | |
6317 | 6323 | | |
6318 | 6324 | | |
6319 | | - | |
| 6325 | + | |
6320 | 6326 | | |
6321 | 6327 | | |
6322 | 6328 | | |
| |||
14429 | 14435 | | |
14430 | 14436 | | |
14431 | 14437 | | |
14432 | | - | |
| 14438 | + | |
| 14439 | + | |
| 14440 | + | |
| 14441 | + | |
14433 | 14442 | | |
14434 | 14443 | | |
14435 | 14444 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
| 10 | + | |
9 | 11 | | |
10 | 12 | | |
11 | 13 | | |
| |||
147 | 149 | | |
148 | 150 | | |
149 | 151 | | |
| 152 | + | |
| 153 | + | |
150 | 154 | | |
151 | 155 | | |
152 | 156 | | |
| |||
Lines changed: 87 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
Lines changed: 49 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
26 | | - | |
| 26 | + | |
27 | 27 | | |
28 | | - | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
29 | 31 | | |
30 | 32 | | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
31 | 37 | | |
32 | | - | |
| 38 | + | |
33 | 39 | | |
34 | 40 | | |
35 | 41 | | |
36 | 42 | | |
37 | | - | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
38 | 51 | | |
39 | 52 | | |
40 | 53 | | |
| |||
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
81 | 81 | | |
82 | 82 | | |
83 | 83 | | |
84 | | - | |
| 84 | + | |
85 | 85 | | |
86 | 86 | | |
87 | 87 | | |
| |||
141 | 141 | | |
142 | 142 | | |
143 | 143 | | |
144 | | - | |
| 144 | + | |
145 | 145 | | |
146 | 146 | | |
147 | 147 | | |
| |||
0 commit comments