Repository navigation
Commit 199cdd0
bpf: Make per_cpu_ptr return rdonly PTR_TO_MEM.
commit 34d3a78 upstream.
Tag the return type of {per, this}_cpu_ptr with RDONLY_MEM. The
returned value of this pair of helpers is kernel object, which
can not be updated by bpf programs. Previously these two helpers
return PTR_OT_MEM for kernel objects of scalar type, which allows
one to directly modify the memory. Now with RDONLY_MEM tagging,
the verifier will reject programs that write into RDONLY_MEM.
Fixes: 63d9b80 ("bpf: Introducte bpf_this_cpu_ptr()")
Fixes: eaa6bcb ("bpf: Introduce bpf_per_cpu_ptr()")
Fixes: 4976b71 ("bpf: Introduce pseudo_btf_id")
Signed-off-by: Hao Luo <haoluo@google.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://lore.kernel.org/bpf/20211217003152.48334-8-haoluo@google.com
Cc: stable@vger.kernel.org # 5.16.x
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>1 parent 6f6edc4 commit 199cdd0
2 files changed
Lines changed: 28 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
667 | 667 | | |
668 | 668 | | |
669 | 669 | | |
670 | | - | |
| 670 | + | |
671 | 671 | | |
672 | 672 | | |
673 | 673 | | |
| |||
680 | 680 | | |
681 | 681 | | |
682 | 682 | | |
683 | | - | |
| 683 | + | |
684 | 684 | | |
685 | 685 | | |
686 | 686 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4333 | 4333 | | |
4334 | 4334 | | |
4335 | 4335 | | |
4336 | | - | |
| 4336 | + | |
| 4337 | + | |
| 4338 | + | |
| 4339 | + | |
| 4340 | + | |
| 4341 | + | |
| 4342 | + | |
| 4343 | + | |
| 4344 | + | |
| 4345 | + | |
| 4346 | + | |
| 4347 | + | |
| 4348 | + | |
| 4349 | + | |
| 4350 | + | |
4337 | 4351 | | |
4338 | 4352 | | |
4339 | 4353 | | |
4340 | 4354 | | |
4341 | 4355 | | |
| 4356 | + | |
4342 | 4357 | | |
4343 | 4358 | | |
4344 | | - | |
| 4359 | + | |
4345 | 4360 | | |
4346 | 4361 | | |
4347 | 4362 | | |
| |||
6550 | 6565 | | |
6551 | 6566 | | |
6552 | 6567 | | |
| 6568 | + | |
| 6569 | + | |
| 6570 | + | |
| 6571 | + | |
| 6572 | + | |
| 6573 | + | |
| 6574 | + | |
6553 | 6575 | | |
6554 | 6576 | | |
6555 | 6577 | | |
| |||
9362 | 9384 | | |
9363 | 9385 | | |
9364 | 9386 | | |
9365 | | - | |
| 9387 | + | |
9366 | 9388 | | |
9367 | 9389 | | |
9368 | 9390 | | |
| |||
11505 | 11527 | | |
11506 | 11528 | | |
11507 | 11529 | | |
11508 | | - | |
| 11530 | + | |
11509 | 11531 | | |
11510 | 11532 | | |
11511 | 11533 | | |
| |||
0 commit comments