Commit 7ab300d
committed
bpf: Make per_cpu_ptr return rdonly PTR_TO_MEM.
jira VULN-136
cve CVE-2022-0500
commit-author Hao Luo <[email protected]>
commit 34d3a78
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 <[email protected]>
Signed-off-by: Alexei Starovoitov <[email protected]>
Link: https://lore.kernel.org/bpf/[email protected]
(cherry picked from commit 34d3a78)
Signed-off-by: Brett Mastbergen <[email protected]>1 parent 7ce03f9 commit 7ab300d
2 files changed
+28
-6
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
670 | 670 | | |
671 | 671 | | |
672 | 672 | | |
673 | | - | |
| 673 | + | |
674 | 674 | | |
675 | 675 | | |
676 | 676 | | |
| |||
683 | 683 | | |
684 | 684 | | |
685 | 685 | | |
686 | | - | |
| 686 | + | |
687 | 687 | | |
688 | 688 | | |
689 | 689 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4078 | 4078 | | |
4079 | 4079 | | |
4080 | 4080 | | |
4081 | | - | |
| 4081 | + | |
| 4082 | + | |
| 4083 | + | |
| 4084 | + | |
| 4085 | + | |
| 4086 | + | |
| 4087 | + | |
| 4088 | + | |
| 4089 | + | |
| 4090 | + | |
| 4091 | + | |
| 4092 | + | |
| 4093 | + | |
| 4094 | + | |
| 4095 | + | |
4082 | 4096 | | |
4083 | 4097 | | |
4084 | 4098 | | |
4085 | 4099 | | |
4086 | 4100 | | |
| 4101 | + | |
4087 | 4102 | | |
4088 | 4103 | | |
4089 | | - | |
| 4104 | + | |
4090 | 4105 | | |
4091 | 4106 | | |
4092 | 4107 | | |
| |||
6098 | 6113 | | |
6099 | 6114 | | |
6100 | 6115 | | |
| 6116 | + | |
| 6117 | + | |
| 6118 | + | |
| 6119 | + | |
| 6120 | + | |
| 6121 | + | |
| 6122 | + | |
6101 | 6123 | | |
6102 | 6124 | | |
6103 | 6125 | | |
| |||
8883 | 8905 | | |
8884 | 8906 | | |
8885 | 8907 | | |
8886 | | - | |
| 8908 | + | |
8887 | 8909 | | |
8888 | 8910 | | |
8889 | 8911 | | |
| |||
10981 | 11003 | | |
10982 | 11004 | | |
10983 | 11005 | | |
10984 | | - | |
| 11006 | + | |
10985 | 11007 | | |
10986 | 11008 | | |
10987 | 11009 | | |
| |||
0 commit comments