Commit eed807f
bpf: Tweak definition of KF_TRUSTED_ARGS
Instead of forcing all arguments to be referenced pointers with non-zero
reg->ref_obj_id, tweak the definition of KF_TRUSTED_ARGS to mean that
only PTR_TO_BTF_ID (and socket types translated to PTR_TO_BTF_ID) have
that constraint, and require their offset to be set to 0.
The rest of pointer types are also accomodated in this definition of
trusted pointers, but with more relaxed rules regarding offsets.
The inherent meaning of setting this flag is that all kfunc pointer
arguments have a guranteed lifetime, and kernel object pointers
(PTR_TO_BTF_ID, PTR_TO_CTX) are passed in their unmodified form (with
offset 0). In general, this is not true for PTR_TO_BTF_ID as it can be
obtained using pointer walks.
Signed-off-by: Kumar Kartikeya Dwivedi <memxor@gmail.com>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Link: https://lore.kernel.org/r/cdede0043c47ed7a357f0a915d16f9ce06a1d589.1663778601.git.lorenzo@kernel.org
Signed-off-by: Alexei Starovoitov <ast@kernel.org>1 parent 1d8b82c commit eed807f
2 files changed
+29
-13
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
137 | 137 | | |
138 | 138 | | |
139 | 139 | | |
140 | | - | |
141 | | - | |
142 | | - | |
143 | | - | |
144 | | - | |
145 | | - | |
146 | | - | |
147 | | - | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
148 | 156 | | |
149 | 157 | | |
150 | 158 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6227 | 6227 | | |
6228 | 6228 | | |
6229 | 6229 | | |
6230 | | - | |
| 6230 | + | |
6231 | 6231 | | |
6232 | 6232 | | |
6233 | 6233 | | |
| |||
6265 | 6265 | | |
6266 | 6266 | | |
6267 | 6267 | | |
6268 | | - | |
| 6268 | + | |
6269 | 6269 | | |
6270 | 6270 | | |
6271 | 6271 | | |
| |||
6276 | 6276 | | |
6277 | 6277 | | |
6278 | 6278 | | |
| 6279 | + | |
6279 | 6280 | | |
6280 | 6281 | | |
6281 | 6282 | | |
| |||
6323 | 6324 | | |
6324 | 6325 | | |
6325 | 6326 | | |
| 6327 | + | |
| 6328 | + | |
| 6329 | + | |
| 6330 | + | |
| 6331 | + | |
| 6332 | + | |
6326 | 6333 | | |
6327 | 6334 | | |
| 6335 | + | |
6328 | 6336 | | |
6329 | | - | |
| 6337 | + | |
6330 | 6338 | | |
6331 | 6339 | | |
6332 | 6340 | | |
| |||
6335 | 6343 | | |
6336 | 6344 | | |
6337 | 6345 | | |
6338 | | - | |
| 6346 | + | |
6339 | 6347 | | |
6340 | 6348 | | |
6341 | 6349 | | |
| |||
6435 | 6443 | | |
6436 | 6444 | | |
6437 | 6445 | | |
6438 | | - | |
| 6446 | + | |
6439 | 6447 | | |
6440 | 6448 | | |
6441 | 6449 | | |
| |||
0 commit comments