Commit fa0d976
bpf: zero-fill re-used per-cpu map element
Zero-fill element values for all other cpus than current, just as
when not using prealloc. This is the only way the bpf program can
ensure known initial values for all cpus ('onallcpus' cannot be
set when coming from the bpf program).
The scenario is: bpf program inserts some elements in a per-cpu
map, then deletes some (or userspace does). When later adding
new elements using bpf_map_update_elem(), the bpf program can
only set the value of the new elements for the current cpu.
When prealloc is enabled, previously deleted elements are re-used.
Without the fix, values for other cpus remain whatever they were
when the re-used entry was previously freed.
Fixes: 6c90598 ("bpf: pre-allocate hash map elements")
Acked-by: Matthieu Baerts <[email protected]>
Signed-off-by: David Verbeiren <[email protected]>1 parent 68ed5ea commit fa0d976
1 file changed
+28
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
821 | 821 | | |
822 | 822 | | |
823 | 823 | | |
| 824 | + | |
| 825 | + | |
| 826 | + | |
| 827 | + | |
| 828 | + | |
| 829 | + | |
| 830 | + | |
| 831 | + | |
| 832 | + | |
| 833 | + | |
| 834 | + | |
| 835 | + | |
| 836 | + | |
| 837 | + | |
| 838 | + | |
| 839 | + | |
| 840 | + | |
| 841 | + | |
| 842 | + | |
| 843 | + | |
| 844 | + | |
| 845 | + | |
| 846 | + | |
| 847 | + | |
| 848 | + | |
| 849 | + | |
824 | 850 | | |
825 | 851 | | |
826 | 852 | | |
| |||
891 | 917 | | |
892 | 918 | | |
893 | 919 | | |
894 | | - | |
| 920 | + | |
895 | 921 | | |
896 | 922 | | |
897 | 923 | | |
| |||
1183 | 1209 | | |
1184 | 1210 | | |
1185 | 1211 | | |
1186 | | - | |
| 1212 | + | |
1187 | 1213 | | |
1188 | 1214 | | |
1189 | 1215 | | |
| |||
0 commit comments