diff options
| author | Andrii Nakryiko <andrii@kernel.org> | 2022-07-15 08:31:43 +0300 |
|---|---|---|
| committer | Alexei Starovoitov <ast@kernel.org> | 2022-07-19 19:45:34 +0300 |
| commit | 87ac0d600943994444e24382a87aa19acc4cd3d4 (patch) | |
| tree | e4af751c0f261ec49b5d6d6221ef26cf7ff99348 /scripts/kernel-doc | |
| parent | e5e23424e51edbd8b3fabae382aeec0bb8926cf1 (diff) | |
| download | linux-87ac0d600943994444e24382a87aa19acc4cd3d4.tar.xz | |
bpf: fix potential 32-bit overflow when accessing ARRAY map element
If BPF array map is bigger than 4GB, element pointer calculation can
overflow because both index and elem_size are u32. Fix this everywhere
by forcing 64-bit multiplication. Extract this formula into separate
small helper and use it consistently in various places.
Speculative-preventing formula utilizing index_mask trick is left as is,
but explicit u64 casts are added in both places.
Fixes: c85d69135a91 ("bpf: move memory size checks to bpf_map_charge_init()")
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/r/20220715053146.1291891-2-andrii@kernel.org
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Diffstat (limited to 'scripts/kernel-doc')
0 files changed, 0 insertions, 0 deletions
